From 0d0906c5e2dc707be2a90c3ee9577457700f3a30 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 16 Feb 2019 11:43:05 +0100 Subject: [PATCH] Fix for #2070 --- app/Repositories/Journal/JournalRepository.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 244e786e99..1f4bd93eed 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -383,15 +383,16 @@ class JournalRepository implements JournalRepositoryInterface * Return a list of all destination accounts related to journal. * * @param TransactionJournal $journal + * @param bool $useCache * * @return Collection */ - public function getJournalDestinationAccounts(TransactionJournal $journal): Collection + public function getJournalDestinationAccounts(TransactionJournal $journal, bool $useCache = true): Collection { $cache = new CacheProperties; $cache->addProperty($journal->id); $cache->addProperty('destination-account-list'); - if ($cache->has()) { + if ($useCache && $cache->has()) { return $cache->get(); // @codeCoverageIgnore } $transactions = $journal->transactions()->where('amount', '>', 0)->orderBy('transactions.account_id')->with('account')->get(); @@ -410,15 +411,16 @@ class JournalRepository implements JournalRepositoryInterface * Return a list of all source accounts related to journal. * * @param TransactionJournal $journal + * @param bool $useCache * * @return Collection */ - public function getJournalSourceAccounts(TransactionJournal $journal): Collection + public function getJournalSourceAccounts(TransactionJournal $journal, bool $useCache = true): Collection { $cache = new CacheProperties; $cache->addProperty($journal->id); $cache->addProperty('source-account-list'); - if ($cache->has()) { + if ($useCache && $cache->has()) { return $cache->get(); // @codeCoverageIgnore } $transactions = $journal->transactions()->where('amount', '<', 0)->orderBy('transactions.account_id')->with('account')->get();