Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fixed a bug where incoming transactions would not be properly filtered in several reports.
James Coleb494be228bb4
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex b6b3ee927c..62534384a9 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -377,7 +377,10 @@ class AccountRepository implements AccountRepositoryInterface* The destination of a transfer must be one of the $accounts in order to* be included. Otherwise, it would not be income.*/- if (in_array($journal->destination_account_id, $accountIds)) {+ $destinations = TransactionJournal::destinationAccountList($journal)->pluck('id')->toArray();++ if (count(array_intersect($destinations, $accountIds)) > 0) {+ // at least one of $target is in $haystackreturn true;}diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.phpindex eef4b62769..08c9c7f54d 100644--- a/app/Repositories/Bill/BillRepository.php+++ b/app/Repositories/Bill/BillRepository.php@@ -189,22 +189,22 @@ class BillRepository implements BillRepositoryInterface'bills.active','bills.name_encrypted','bills.match_encrypted'];- $ids = $accounts->pluck('id')->toArray();- $set = $this->user->bills()- ->leftJoin(- 'transaction_journals', function (JoinClause $join) {- $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at');- }- )- ->leftJoin(- 'transactions', function (JoinClause $join) {- $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);- }- )- ->whereIn('transactions.account_id', $ids)- ->whereNull('transaction_journals.deleted_at')- ->groupBy($fields)- ->get($fields);+ $ids = $accounts->pluck('id')->toArray();+ $set = $this->user->bills()+ ->leftJoin(+ 'transaction_journals', function (JoinClause $join) {+ $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at');+ }+ )+ ->leftJoin(+ 'transactions', function (JoinClause $join) {+ $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);+ }+ )+ ->whereIn('transactions.account_id', $ids)+ ->whereNull('transaction_journals.deleted_at')+ ->groupBy($fields)+ ->get($fields);$set = $set->sortBy(function (Bill $bill) {