diff --git a/app/Console/Commands/VerifyDatabase.php b/app/Console/Commands/VerifyDatabase.php index ba53da1aa7..c67ddb2787 100644 --- a/app/Console/Commands/VerifyDatabase.php +++ b/app/Console/Commands/VerifyDatabase.php @@ -38,8 +38,6 @@ class VerifyDatabase extends Command /** * Create a new command instance. - * - * @return void */ public function __construct() { diff --git a/app/Export/Entry/Entry.php b/app/Export/Entry/Entry.php index a7387f13db..d27480b67f 100644 --- a/app/Export/Entry/Entry.php +++ b/app/Export/Entry/Entry.php @@ -10,7 +10,6 @@ declare(strict_types = 1); namespace FireflyIII\Export\Entry; -use FireflyIII\Models\Account; use FireflyIII\Models\TransactionJournal; /** @@ -66,13 +65,11 @@ class Entry $entry->category = new EntryCategory($journal->categories->first()); $entry->bill = new EntryBill($journal->bill); - /** @var Account $sourceAccount */ - $sourceAccount = TransactionJournal::sourceAccount($journal); - $entry->sourceAccount = new EntryAccount($sourceAccount); - - /** @var Account $destination */ - $destination = TransactionJournal::destinationAccount($journal); - $entry->destinationAccount = new EntryAccount($destination); + // TODO support split journals + $sources = TransactionJournal::sourceAccountList($journal); + $entry->sourceAccount = new EntryAccount($sources->first()); + $destinations = TransactionJournal::destinationAccountList($journal); + $entry->destinationAccount = new EntryAccount($destinations->first()); return $entry; diff --git a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php index 484a7aa517..04b0851f23 100644 --- a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php +++ b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php @@ -83,9 +83,6 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface */ public function single(Account $account, array $labels, array $dataSet): array { - // language: - $format = (string)trans('config.month_and_day'); - $data = [ 'count' => 1, 'labels' => $labels, diff --git a/app/Handlers/Events/ConnectJournalToPiggyBank.php b/app/Handlers/Events/ConnectJournalToPiggyBank.php index 83089674cc..7ac02550ba 100644 --- a/app/Handlers/Events/ConnectJournalToPiggyBank.php +++ b/app/Handlers/Events/ConnectJournalToPiggyBank.php @@ -44,6 +44,7 @@ class ConnectJournalToPiggyBank $amount = TransactionJournal::amountPositive($journal); // if piggy account matches source account, the amount is positive + // TODO support split journals if ($piggyBank->account_id == TransactionJournal::sourceAccount($journal)->id) { $amount = bcmul($amount, '-1'); } diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index 84858d3b61..46bd9577ae 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -30,6 +30,8 @@ use View; * Class SplitController * * @package FireflyIII\Http\Controllers\Transaction + * + * TODO support piggy banks */ class SplitController extends Controller { diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index cb2f61e374..0015bc99a6 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -136,18 +136,20 @@ class TransactionController extends Controller if ($count > 2) { return redirect(route('split.journal.edit', [$journal->id])); } - $accountRepository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); - $budgetRepository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); - $piggyRepository = app('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface'); - $assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccountsByType(['Default account', 'Asset account'])); - $budgetList = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets()); - $piggyBankList = ExpandedForm::makeSelectListWithEmpty($piggyRepository->getPiggyBanks()); - $maxFileSize = Steam::phpBytes(ini_get('upload_max_filesize')); - $maxPostSize = Steam::phpBytes(ini_get('post_max_size')); - $uploadSize = min($maxFileSize, $maxPostSize); - $what = strtolower(TransactionJournal::transactionTypeStr($journal)); - $subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); - $preFilled = [ + $accountRepository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); + $budgetRepository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); + $piggyRepository = app('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface'); + $assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccountsByType(['Default account', 'Asset account'])); + $budgetList = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets()); + $piggyBankList = ExpandedForm::makeSelectListWithEmpty($piggyRepository->getPiggyBanks()); + $maxFileSize = Steam::phpBytes(ini_get('upload_max_filesize')); + $maxPostSize = Steam::phpBytes(ini_get('post_max_size')); + $uploadSize = min($maxFileSize, $maxPostSize); + $what = strtolower(TransactionJournal::transactionTypeStr($journal)); + $subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); + $sourceAccounts = TransactionJournal::sourceAccountList($journal); + $destinationAccounts = TransactionJournal::destinationAccountList($journal); + $preFilled = [ 'date' => TransactionJournal::dateAsString($journal), 'interest_date' => TransactionJournal::dateAsString($journal, 'interest_date'), 'book_date' => TransactionJournal::dateAsString($journal, 'book_date'), @@ -156,16 +158,19 @@ class TransactionController extends Controller 'budget_id' => TransactionJournal::budgetId($journal), 'piggy_bank_id' => TransactionJournal::piggyBankId($journal), 'tags' => join(',', $journal->tags->pluck('tag')->toArray()), - 'source_account_id' => TransactionJournal::sourceAccount($journal)->id, - 'source_account_name' => TransactionJournal::sourceAccount($journal)->name, - 'destination_account_id' => TransactionJournal::destinationAccount($journal)->id, - 'destination_account_name' => TransactionJournal::destinationAccount($journal)->name, + 'source_account_id' => $sourceAccounts->first()->id, + 'source_account_name' => $sourceAccounts->first()->name, + 'destination_account_id' => $destinationAccounts->first()->id, + 'destination_account_name' => $destinationAccounts->first()->name, 'amount' => TransactionJournal::amountPositive($journal), ]; + // TODO support split withdrawal if ($journal->isWithdrawal() && TransactionJournal::destinationAccountTypeStr($journal) == 'Cash account') { $preFilled['destination_account_name'] = ''; } + + // TODO support split withdrawal if ($journal->isDeposit() && TransactionJournal::sourceAccountTypeStr($journal) == 'Cash account') { $preFilled['source_account_name'] = ''; } diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 60fb1ab575..8964cde01d 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -5,13 +5,10 @@ namespace FireflyIII\Repositories\Bill; use Carbon\Carbon; use DB; -use FireflyIII\Models\Account; use FireflyIII\Models\Bill; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; -use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\User; -use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\JoinClause; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -431,12 +428,12 @@ class BillRepository implements BillRepositoryInterface if (false === $journal->isWithdrawal()) { return false; } - - $matches = explode(',', $bill->match); - $description = strtolower($journal->description) . ' ' . strtolower(TransactionJournal::destinationAccount($journal)->name); - - // new: add source to word match: - $description .= ' ' . strtolower(TransactionJournal::sourceAccount($journal)->name); + $destinationAccounts = TransactionJournal::destinationAccountList($journal); + $sourceAccounts = TransactionJournal::sourceAccountList($journal); + $matches = explode(',', $bill->match); + $description = strtolower($journal->description) . ' '; + $description .= strtolower(join(' ', $destinationAccounts->pluck('name')->toArray())); + $description .= strtolower(join(' ', $sourceAccounts->pluck('name')->toArray())); $wordMatch = $this->doWordMatch($matches, $description); $amountMatch = $this->doAmountMatch(TransactionJournal::amountPositive($journal), $bill->amount_min, $bill->amount_max); diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index 5c34a58bd7..10e9adf536 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -23,24 +23,6 @@ interface BudgetRepositoryInterface */ public function destroy(Budget $budget): bool; - // /** - // * - // * Same as ::spentInPeriod but corrects journals for a set of accounts - // * - // * @param Budget $budget - // * @param Carbon $start - // * @param Carbon $end - // * @param Collection $accounts - // * - // * @return string - // */ - // public function balanceInPeriod(Budget $budget, Carbon $start, Carbon $end, Collection $accounts); - - // /** - // * @return bool - // */ - // public function cleanupBudgets(): bool; - /** * Find a budget. * @@ -60,28 +42,11 @@ interface BudgetRepositoryInterface */ public function firstUseDate(Budget $budget): Carbon; - // /** - // * @param Budget $budget - // * @param Account $account - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return Collection - // */ - // public function expensesSplit(Budget $budget, Account $account, Carbon $start, Carbon $end): Collection; - /** * @return Collection */ public function getActiveBudgets(): Collection; - // /** - // * @param Budget $budget - // * - // * @return Carbon - // */ - // public function firstActivity(Budget $budget): Carbon; - /** * @param Carbon $start * @param Carbon $end @@ -95,111 +60,11 @@ interface BudgetRepositoryInterface */ public function getBudgets(): Collection; - // /** - // * @param Account $account - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return Collection - // */ - // public function getAllWithoutBudget(Account $account, Collection $accounts, Carbon $start, Carbon $end): Collection; - - // /** - // * Get the budgeted amounts for each budgets in each year. - // * - // * @param Collection $budgets - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return Collection - // */ - // public function getBudgetedPerYear(Collection $budgets, Carbon $start, Carbon $end): Collection; - /** * @return Collection */ public function getInactiveBudgets(): Collection; - // /** - // * Returns an array with every budget in it and the expenses for each budget - // * per month. - // * - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return array - // */ - // public function getBudgetsAndExpensesPerMonth(Collection $accounts, Carbon $start, Carbon $end): array; - - // /** - // * Returns an array with every budget in it and the expenses for each budget - // * per year for. - // * - // * @param Collection $budgets - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @deprecated - // * - // * @return array - // */ - // public function getBudgetsAndExpensesPerYear(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array; - - // /** - // * Returns a list of budgets, budget limits and limit repetitions - // * (doubling any of them in a left join) - // * - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return Collection - // */ - // public function getBudgetsAndLimitsInRange(Carbon $start, Carbon $end): Collection; - - // /** - // * Returns a list of budget limits that are valid in the current given range. - // * - // * @param Budget $budget - // * @param Carbon $start - // * @param Carbon $end - // * @param LimitRepetition $ignore - // * - // * @return Collection - // */ - // public function getValidRepetitions(Budget $budget, Carbon $start, Carbon $end, LimitRepetition $ignore) : Collection; - - // /** - // * @param Budget $budget - // * @param string $repeatFreq - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return LimitRepetition - // */ - // public function getCurrentRepetition(Budget $budget, string $repeatFreq, Carbon $start, Carbon $end): LimitRepetition; - - // /** - // * Returns all expenses for the given budget and the given accounts, in the given period. - // * - // * @param Budget $budget - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return Collection - // */ - // public function getExpenses(Budget $budget, Collection $accounts, Carbon $start, Carbon $end):Collection; - - // /** - // * @param Budget $budget - // * - // * @return Carbon - // */ - // public function getFirstBudgetLimitDate(Budget $budget):Carbon; - /** * @param Collection $budgets * @param Collection $accounts @@ -238,94 +103,6 @@ interface BudgetRepositoryInterface */ public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end) : string; - // /** - // * Returns all the transaction journals for a limit, possibly limited by a limit repetition. - // * - // * @param Budget $budget - // * @param LimitRepetition $repetition - // * @param int $take - // * - // * @return LengthAwarePaginator - // */ - // public function getJournals(Budget $budget, LimitRepetition $repetition = null, int $take = 50): LengthAwarePaginator; - - // /** - // * @param Carbon $start - // * @param Carbon $end - // * @param int $page - // * @param int $pageSize - // * - // * @return LengthAwarePaginator - // */ - // public function getWithoutBudget(Carbon $start, Carbon $end, int $page, int $pageSize = 50): LengthAwarePaginator; - - // /** - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return Collection - // */ - // public function getWithoutBudgetForAccounts(Collection $accounts, Carbon $start, Carbon $end): Collection; - - // /** - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return string - // */ - // public function getWithoutBudgetSum(Collection $accounts, Carbon $start, Carbon $end): string; - - // /** - // * Returns an array with the following key:value pairs: - // * - // * yyyy-mm-dd: - // * - // * That array contains: - // * - // * budgetid: - // * - // * Where yyyy-mm-dd is the date and is the money spent using WITHDRAWALS in the $budget - // * from the given users accounts.. - // * - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return array - // */ - // public function spentAllPerDayForAccounts(Collection $accounts, Carbon $start, Carbon $end): array; - - // /** - // * Returns a list of expenses (in the field "spent", grouped per budget per account. - // * - // * @param Collection $budgets - // * @param Collection $accounts - // * @param Carbon $start - // * @param Carbon $end - // * - // * @return Collection - // */ - // public function spentPerBudgetPerAccount(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): Collection; - - // /** - // * Returns an array with the following key:value pairs: - // * - // * yyyy-mm-dd: - // * - // * Where yyyy-mm-dd is the date and is the money spent using WITHDRAWALS in the $budget - // * from all the users accounts. - // * - // * @param Budget $budget - // * @param Carbon $start - // * @param Carbon $end - // * @param Collection $accounts - // * - // * @return array - // */ - // public function spentPerDay(Budget $budget, Carbon $start, Carbon $end, Collection $accounts): array; - /** * @param array $data * diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 3ec470e6a3..1d7099779d 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -131,32 +131,6 @@ class JournalRepository implements JournalRepositoryInterface return $entry; } - /** - * @deprecated - * - * @param TransactionJournal $journal - * @param Transaction $transaction - * - * @return string - */ - public function getAmountBefore(TransactionJournal $journal, Transaction $transaction): string - { - $set = $transaction->account->transactions()->leftJoin( - 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' - ) - ->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d')) - ->where('transaction_journals.order', '>=', $journal->order) - ->where('transaction_journals.id', '!=', $journal->id) - ->get(['transactions.*']); - $sum = '0'; - foreach ($set as $entry) { - $sum = bcadd($entry->amount, $sum); - } - - return $sum; - - } - /** * @param array $types * @param int $page diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index f93e8f9c74..b55a74f32b 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -50,18 +50,6 @@ interface JournalRepositoryInterface */ public function first(): TransactionJournal; - /** - * Returns the amount in the account before the specified transaction took place. - * - * @deprecated - * - * @param TransactionJournal $journal - * @param Transaction $transaction - * - * @return string - */ - public function getAmountBefore(TransactionJournal $journal, Transaction $transaction): string; - /** * Returns a page of a specific type(s) of journal. * diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index c376c755e6..864df83367 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -229,9 +229,11 @@ class TagRepository implements TagRepositoryInterface // $checkAccount is the source_account for a withdrawal // $checkAccount is the destination_account for a deposit + // TODO match split journals if ($check->isWithdrawal() && TransactionJournal::sourceAccount($check)->id != TransactionJournal::destinationAccount($journal)->id) { $match = false; } + // TODO match split journals if ($check->isDeposit() && TransactionJournal::destinationAccount($check)->id != TransactionJournal::destinationAccount($journal)->id) { $match = false; } diff --git a/app/Rules/Triggers/FromAccountContains.php b/app/Rules/Triggers/FromAccountContains.php index 58799b60d4..fe2abb7e4f 100644 --- a/app/Rules/Triggers/FromAccountContains.php +++ b/app/Rules/Triggers/FromAccountContains.php @@ -52,6 +52,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf */ public function triggered(TransactionJournal $journal): bool { + // TODO support split withdrawals $fromAccountName = strtolower($journal->source_account_name ?? TransactionJournal::sourceAccount($journal)->name); $search = strtolower($this->triggerValue); $strpos = strpos($fromAccountName, $search); diff --git a/app/Rules/Triggers/FromAccountEnds.php b/app/Rules/Triggers/FromAccountEnds.php index 96e83fadcf..a588742988 100644 --- a/app/Rules/Triggers/FromAccountEnds.php +++ b/app/Rules/Triggers/FromAccountEnds.php @@ -52,6 +52,7 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal): bool { + // TODO support split withdrawals $name = strtolower($journal->source_account_name ?? TransactionJournal::sourceAccount($journal)->name); $nameLength = strlen($name); $search = strtolower($this->triggerValue); diff --git a/app/Rules/Triggers/FromAccountIs.php b/app/Rules/Triggers/FromAccountIs.php index 061044cf7d..fb4aae7006 100644 --- a/app/Rules/Triggers/FromAccountIs.php +++ b/app/Rules/Triggers/FromAccountIs.php @@ -52,6 +52,7 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal): bool { + // TODO support split withdrawals $name = strtolower($journal->source_account_name ?? TransactionJournal::sourceAccount($journal)->name); $search = strtolower($this->triggerValue); diff --git a/app/Rules/Triggers/FromAccountStarts.php b/app/Rules/Triggers/FromAccountStarts.php index 62eaafac67..f53a64ba28 100644 --- a/app/Rules/Triggers/FromAccountStarts.php +++ b/app/Rules/Triggers/FromAccountStarts.php @@ -52,6 +52,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac */ public function triggered(TransactionJournal $journal): bool { + // TODO support split withdrawals $name = strtolower($journal->source_account_name ?? TransactionJournal::sourceAccount($journal)->name); $search = strtolower($this->triggerValue); diff --git a/app/Rules/Triggers/ToAccountContains.php b/app/Rules/Triggers/ToAccountContains.php index f6d7c31c68..12e138dcdd 100644 --- a/app/Rules/Triggers/ToAccountContains.php +++ b/app/Rules/Triggers/ToAccountContains.php @@ -52,6 +52,7 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac */ public function triggered(TransactionJournal $journal): bool { + // TODO support split journals $toAccountName = strtolower($journal->destination_account_name ?? TransactionJournal::destinationAccount($journal)->name); $search = strtolower($this->triggerValue); $strpos = strpos($toAccountName, $search); diff --git a/app/Rules/Triggers/ToAccountEnds.php b/app/Rules/Triggers/ToAccountEnds.php index f01d8d8ba5..220730ac50 100644 --- a/app/Rules/Triggers/ToAccountEnds.php +++ b/app/Rules/Triggers/ToAccountEnds.php @@ -52,6 +52,7 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal): bool { + // TODO support split journals $toAccountName = strtolower($journal->destination_account_name ?? TransactionJournal::destinationAccount($journal)->name); $toAccountNameLength = strlen($toAccountName); $search = strtolower($this->triggerValue); diff --git a/app/Rules/Triggers/ToAccountIs.php b/app/Rules/Triggers/ToAccountIs.php index 6d1ea0181e..8a2f46ea14 100644 --- a/app/Rules/Triggers/ToAccountIs.php +++ b/app/Rules/Triggers/ToAccountIs.php @@ -52,6 +52,7 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal): bool { + // TODO support split journals $toAccountName = strtolower($journal->destination_account_name ?? TransactionJournal::destinationAccount($journal)->name); $search = strtolower($this->triggerValue); diff --git a/app/Rules/Triggers/ToAccountStarts.php b/app/Rules/Triggers/ToAccountStarts.php index 8f00f80d0c..64bebd5ce1 100644 --- a/app/Rules/Triggers/ToAccountStarts.php +++ b/app/Rules/Triggers/ToAccountStarts.php @@ -52,6 +52,7 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal): bool { + // TODO support split journals $toAccountName = strtolower($journal->destination_account_name ?? TransactionJournal::destinationAccount($journal)->name); $search = strtolower($this->triggerValue); diff --git a/app/Support/Models/TransactionJournalSupport.php b/app/Support/Models/TransactionJournalSupport.php index b83bec79b5..86ac894a81 100644 --- a/app/Support/Models/TransactionJournalSupport.php +++ b/app/Support/Models/TransactionJournalSupport.php @@ -184,6 +184,8 @@ class TransactionJournalSupport extends Model } /** + * @deprecated + * * @param TransactionJournal $journal * * @return string @@ -198,6 +200,7 @@ class TransactionJournalSupport extends Model return $cache->get(); } + $account = self::destinationAccount($journal); $type = $account->accountType ? $account->accountType->type : '(unknown)'; $cache->store($type); @@ -205,6 +208,26 @@ class TransactionJournalSupport extends Model return $type; } + /** + * @param TransactionJournal $journal + * + * @return Collection + */ + public static function destinationTransactionList(TransactionJournal $journal): Collection + { + $cache = new CacheProperties; + $cache->addProperty($journal->id); + $cache->addProperty('transaction-journal'); + $cache->addProperty('destination-transaction-list'); + if ($cache->has()) { + return $cache->get(); + } + $list = $journal->transactions()->where('amount', '>', 0)->with('account')->get(); + $cache->store($list); + + return $list; + } + /** * @param Builder $query * @param string $table @@ -305,6 +328,8 @@ class TransactionJournalSupport extends Model } /** + * @deprecated + * * @param TransactionJournal $journal * * @return string @@ -346,26 +371,6 @@ class TransactionJournalSupport extends Model return $list; } - /** - * @param TransactionJournal $journal - * - * @return Collection - */ - public static function destinationTransactionList(TransactionJournal $journal): Collection - { - $cache = new CacheProperties; - $cache->addProperty($journal->id); - $cache->addProperty('transaction-journal'); - $cache->addProperty('destination-transaction-list'); - if ($cache->has()) { - return $cache->get(); - } - $list = $journal->transactions()->where('amount', '>', 0)->with('account')->get(); - $cache->store($list); - - return $list; - } - /** * @param TransactionJournal $journal *