From 13d3b863097abd315e068c8554f498a615dfc244 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 28 May 2023 06:07:26 +0200 Subject: [PATCH] Fix #7557 --- app/Handlers/Events/Model/BudgetLimitHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Handlers/Events/Model/BudgetLimitHandler.php b/app/Handlers/Events/Model/BudgetLimitHandler.php index 235c0c9c19..df70b523cc 100644 --- a/app/Handlers/Events/Model/BudgetLimitHandler.php +++ b/app/Handlers/Events/Model/BudgetLimitHandler.php @@ -181,7 +181,7 @@ class BudgetLimitHandler $start = app('navigation')->startOfPeriod($budgetLimit->start_date, $viewRange); $end = app('navigation')->startOfPeriod($budgetLimit->end_date, $viewRange); $end = app('navigation')->endOfPeriod($end, $viewRange); - $budget = Budget::withTrashed()->find($budgetLimit->budget_id); + $budget = Budget::find($budgetLimit->budget_id); if(null === $budget) { Log::warning('Budget is null, cannot continue.'); $budgetLimit->forceDelete(); @@ -210,6 +210,7 @@ class BudgetLimitHandler 'end_date', $currentEnd->format('Y-m-d') )->where('transaction_currency_id', $budgetLimit->transaction_currency_id)->first(); + if (null !== $availableBudget) { Log::debug('Found 1 AB, will update.'); $this->calculateAmount($availableBudget);