From f475393bc130feb723ca352577c78427d6cd1b22 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 29 Sep 2024 16:04:54 +0200 Subject: [PATCH] Fix https://github.com/firefly-iii/firefly-iii/issues/9282 --- app/Helpers/Report/PopupReport.php | 10 ++++------ app/Support/Http/Controllers/RenderPartialViews.php | 1 + resources/views/reports/partials/budgets.twig | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php index e5276d6161..7503e22261 100644 --- a/app/Helpers/Report/PopupReport.php +++ b/app/Helpers/Report/PopupReport.php @@ -100,10 +100,10 @@ class PopupReport implements PopupReportInterface $repos = app(CurrencyRepositoryInterface::class); $currency = $repos->find((int)$currencyId); } - /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); - $collector->setAccounts($attributes['accounts']) + $collector + ->setAccounts($attributes['accounts']) ->withAccountInformation() ->withBudgetInformation() ->withCategoryInformation() @@ -113,14 +113,12 @@ class PopupReport implements PopupReportInterface if (null !== $currency) { $collector->setCurrency($currency); } - - if (null === $budget->id) { + if (null === $budget->id || 0 === $budget->id) { $collector->setTypes([TransactionType::WITHDRAWAL])->withoutBudget(); } - if (null !== $budget->id) { + if (null !== $budget->id && 0 !== $budget->id) { $collector->setBudget($budget); } - return $collector->getExtractedJournals(); } diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php index d03ecb2835..30ffb39194 100644 --- a/app/Support/Http/Controllers/RenderPartialViews.php +++ b/app/Support/Http/Controllers/RenderPartialViews.php @@ -115,6 +115,7 @@ trait RenderPartialViews $budget = $budgetRepository->find((int)$attributes['budgetId']); if (null === $budget) { + // transactions without a budget. $budget = new Budget(); } $journals = $popupHelper->byBudget($budget, $attributes); diff --git a/resources/views/reports/partials/budgets.twig b/resources/views/reports/partials/budgets.twig index 0c362e2aab..86f393cdb2 100644 --- a/resources/views/reports/partials/budgets.twig +++ b/resources/views/reports/partials/budgets.twig @@ -61,7 +61,7 @@ {% if budget_limit.spent != 0 %} + data-location="budget-spent-amount" data-currency-id="{{ budget_limit.currency_id }}" data-budget-id="{% if '' == budget.budget_id %}0{% else %}{{ budget.budget_id }}{% endif %}"> {% endif %}