Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix for #1675
James Cole6286daa88175
diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.phpindex 975a1080aa..2b6e3d067d 100644--- a/app/Generator/Report/Tag/MonthReportGenerator.php+++ b/app/Generator/Report/Tag/MonthReportGenerator.php@@ -42,6 +42,7 @@ use Throwable;/*** Class MonthReportGenerator.+ ** @codeCoverageIgnore*/class MonthReportGenerator extends Support implements ReportGeneratorInterface@@ -66,6 +67,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface{$this->expenses = new Collection;$this->income = new Collection;+ $this->tags = new Collection;}/**@@ -218,8 +220,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface$collector->addFilter(OpposingAccountFilter::class);$collector->addFilter(PositiveAmountFilter::class);- $transactions = $collector->getTransactions();-+ $transactions = $collector->getTransactions();$this->expenses = $transactions;return $transactions;@@ -260,6 +261,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface*/protected function summarizeByTag(Collection $collection): array{+ $tagIds = array_map('\intval', $this->tags->pluck('id')->toArray());$result = [];/** @var Transaction $transaction */foreach ($collection as $transaction) {@@ -267,9 +269,11 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface$journalTags = $journal->tags;/** @var Tag $journalTag */foreach ($journalTags as $journalTag) {- $journalTagId = $journalTag->id;- $result[$journalTagId] = $result[$journalTagId] ?? '0';- $result[$journalTagId] = bcadd($transaction->transaction_amount, $result[$journalTagId]);+ $journalTagId = (int)$journalTag->id;+ if (\in_array($journalTagId, $tagIds, true)) {+ $result[$journalTagId] = $result[$journalTagId] ?? '0';+ $result[$journalTagId] = bcadd($transaction->transaction_amount, $result[$journalTagId]);+ }}}