diff --git a/app/Handlers/Events/StoredJournalEventHandler.php b/app/Handlers/Events/StoredJournalEventHandler.php index 8839287e4f..2ea6f97659 100644 --- a/app/Handlers/Events/StoredJournalEventHandler.php +++ b/app/Handlers/Events/StoredJournalEventHandler.php @@ -141,7 +141,7 @@ class StoredJournalEventHandler private function getExactAmount(TransactionJournal $journal, PiggyBank $piggyBank, PiggyBankRepetition $repetition): string { $amount = $journal->amountPositive(); - $sources = TransactionJournal::sourceAccountList($journal)->pluck('id')->toArray(); + $sources = $journal->sourceAccountList()->pluck('id')->toArray(); $room = bcsub(strval($piggyBank->targetamount), strval($repetition->currentamount)); $compare = bcmul($repetition->currentamount, '-1'); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index bbf6cb51d5..9773032f9b 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -100,7 +100,7 @@ class Controller extends BaseController */ protected function isOpeningBalance(TransactionJournal $journal): bool { - return TransactionJournal::transactionTypeStr($journal) === TransactionType::OPENING_BALANCE; + return $journal->transactionTypeStr() === TransactionType::OPENING_BALANCE; } /** diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php index 8f4ae3e23d..b4d648a873 100644 --- a/app/Http/Controllers/Popup/ReportController.php +++ b/app/Http/Controllers/Popup/ReportController.php @@ -239,7 +239,7 @@ class ReportController extends Controller $journals = $journals->filter( function (Transaction $transaction) use ($report) { // get the destinations: - $sources = TransactionJournal::sourceAccountList($transaction->transactionJournal)->pluck('id')->toArray(); + $sources = $transaction->transactionJournal->sourceAccountList()->pluck('id')->toArray(); // do these intersect with the current list? return !empty(array_intersect($report, $sources)); @@ -275,7 +275,7 @@ class ReportController extends Controller $journals = $journals->filter( function (Transaction $transaction) use ($report) { // get the destinations: - $destinations = $transaction->transactionJournal->destinationAccountList()->pluck('id')->toArray(); + $destinations = $transaction->destinationAccountList($transaction->transactionJournal)->pluck('id')->toArray(); // do these intersect with the current list? return !empty(array_intersect($report, $destinations)); diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index b3565a2079..c95544296f 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -195,7 +195,7 @@ class MassController extends Controller $journal = $repository->find(intval($journalId)); if ($journal) { // get optional fields: - $what = strtolower(TransactionJournal::transactionTypeStr($journal)); + $what = strtolower($journal->transactionTypeStr()); $sourceAccountId = $request->get('source_account_id')[$journal->id] ?? 0; $sourceAccountName = $request->get('source_account_name')[$journal->id] ?? ''; $destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0; diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index a12e8d77aa..8038734622 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -150,7 +150,7 @@ class SplitController extends Controller } // @codeCoverageIgnoreEnd - $type = strtolower(TransactionJournal::transactionTypeStr($journal)); + $type = strtolower($journal->transactionTypeStr()); Session::flash('success', strval(trans('firefly.updated_' . $type, ['description' => e($data['journal_description'])]))); Preferences::mark(); diff --git a/app/Rules/Triggers/FromAccountContains.php b/app/Rules/Triggers/FromAccountContains.php index 1b8241ef7b..f2a36b6c67 100644 --- a/app/Rules/Triggers/FromAccountContains.php +++ b/app/Rules/Triggers/FromAccountContains.php @@ -66,7 +66,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf $fromAccountName = ''; /** @var Account $account */ - foreach (TransactionJournal::sourceAccountList($journal) as $account) { + foreach ($journal->sourceAccountList() as $account) { $fromAccountName .= strtolower($account->name); } diff --git a/app/Rules/Triggers/FromAccountEnds.php b/app/Rules/Triggers/FromAccountEnds.php index 54afb67808..9cc61c2066 100644 --- a/app/Rules/Triggers/FromAccountEnds.php +++ b/app/Rules/Triggers/FromAccountEnds.php @@ -66,7 +66,7 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface $name = ''; /** @var Account $account */ - foreach (TransactionJournal::sourceAccountList($journal) as $account) { + foreach ($journal->sourceAccountList() as $account) { $name .= strtolower($account->name); } diff --git a/app/Rules/Triggers/FromAccountIs.php b/app/Rules/Triggers/FromAccountIs.php index c3f494d48c..944a26c529 100644 --- a/app/Rules/Triggers/FromAccountIs.php +++ b/app/Rules/Triggers/FromAccountIs.php @@ -61,7 +61,7 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface $name = ''; /** @var Account $account */ - foreach (TransactionJournal::sourceAccountList($journal) as $account) { + foreach ($journal->sourceAccountList() as $account) { $name .= strtolower($account->name); } diff --git a/app/Rules/Triggers/FromAccountStarts.php b/app/Rules/Triggers/FromAccountStarts.php index f32ce2b545..5ddf1f4240 100644 --- a/app/Rules/Triggers/FromAccountStarts.php +++ b/app/Rules/Triggers/FromAccountStarts.php @@ -66,7 +66,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac $name = ''; /** @var Account $account */ - foreach (TransactionJournal::sourceAccountList($journal) as $account) { + foreach ($journal->sourceAccountList() as $account) { $name .= strtolower($account->name); } diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index 6b70876014..543c1204d5 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -119,7 +119,7 @@ class Journal extends Twig_Extension return $cache->get(); } - $list = TransactionJournal::sourceAccountList($journal); + $list = $journal->sourceAccountList(); $array = []; /** @var Account $entry */ foreach ($list as $entry) {