mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
First part of a large code cleanup commit.
This commit is contained in:
@@ -28,6 +28,7 @@ use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Services\Internal\Support\BillServiceTrait;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class BillUpdateService
|
||||
@@ -59,7 +60,7 @@ class BillUpdateService
|
||||
/** @var TransactionCurrency $currency */
|
||||
$currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null);
|
||||
|
||||
if(null === $currency) {
|
||||
if (null === $currency) {
|
||||
// use default currency:
|
||||
$currency = app('amount')->getDefaultCurrencyByUser($bill->user);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Services\Internal\Support\JournalServiceTrait;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class to centralise code that updates a journal given the input by system.
|
||||
*
|
||||
@@ -38,6 +39,7 @@ use Log;
|
||||
class JournalUpdateService
|
||||
{
|
||||
use JournalServiceTrait;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
@@ -159,6 +161,7 @@ class JournalUpdateService
|
||||
foreach ($journal->transactions as $transaction) {
|
||||
$service->updateBudget($transaction, $budgetId);
|
||||
}
|
||||
|
||||
return $journal;
|
||||
}
|
||||
// clear budget.
|
||||
|
||||
@@ -27,6 +27,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Services\Internal\Support\TransactionServiceTrait;
|
||||
use FireflyIII\User;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class TransactionUpdateService
|
||||
*/
|
||||
@@ -34,6 +35,9 @@ class TransactionUpdateService
|
||||
{
|
||||
use TransactionServiceTrait;
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
@@ -44,9 +48,6 @@ class TransactionUpdateService
|
||||
}
|
||||
}
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @param int $transactionId
|
||||
*
|
||||
@@ -87,10 +88,10 @@ class TransactionUpdateService
|
||||
*/
|
||||
public function update(Transaction $transaction, array $data): Transaction
|
||||
{
|
||||
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
|
||||
$journal = $transaction->transactionJournal;
|
||||
$amount = (string)$data['amount'];
|
||||
$account = null;
|
||||
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
|
||||
$journal = $transaction->transactionJournal;
|
||||
$amount = (string)$data['amount'];
|
||||
$account = null;
|
||||
// update description:
|
||||
$transaction->description = $data['description'];
|
||||
$foreignAmount = null;
|
||||
|
||||
Reference in New Issue
Block a user