diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.php index f24dd2b551..a21fb4c3e3 100644 --- a/app/Http/Controllers/Report/BudgetController.php +++ b/app/Http/Controllers/Report/BudgetController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Report; +use FireflyIII\Support\Facades\Navigation; use Throwable; use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; @@ -290,11 +291,12 @@ class BudgetController extends Controller $cache->addProperty('budget-period-report'); $cache->addProperty($accounts->pluck('id')->toArray()); if ($cache->has()) { - return $cache->get(); + // return $cache->get(); } - $periods = app('navigation')->listOfPeriods($start, $end); - $keyFormat = app('navigation')->preferredCarbonFormat($start, $end); + $periods = Navigation::listOfPeriods($start, $end); + $keyFormat = Navigation::preferredCarbonFormat($start, $end); + // list expenses for budgets in account(s) $expenses = $this->opsRepository->listExpenses($start, $end, $accounts); @@ -303,6 +305,17 @@ class BudgetController extends Controller foreach ($currency['budgets'] as $budget) { $count = 0; foreach ($budget['transaction_journals'] as $journal) { + // #10678 + // skip transactions between two asset / liability accounts. + if( + in_array($journal['source_account_type'], config('firefly.valid_currency_account_types')) && + in_array($journal['destination_account_type'], config('firefly.valid_currency_account_types')) + ) { + continue; + } + + + ++$count; $key = sprintf('%d-%d', $budget['id'], $currency['currency_id']); $dateKey = $journal['date']->format($keyFormat); diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index 26daa4aa1e..052a6622b8 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -202,8 +202,11 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn 'amount' => $amount, 'destination_account_id' => $journal['destination_account_id'], 'destination_account_name' => $journal['destination_account_name'], + 'destination_account_type' => $journal['destination_account_type'], + 'currency_id' => $journalCurrencyId, 'source_account_id' => $journal['source_account_id'], 'source_account_name' => $journal['source_account_name'], + 'source_account_type' => $journal['source_account_type'], 'category_name' => $journal['category_name'], 'description' => $journal['description'], 'transaction_group_id' => $journal['transaction_group_id'],