mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-16 18:25:00 -06:00
Fix #3630
This commit is contained in:
parent
723d1cffe2
commit
3bf6891e1c
@ -151,7 +151,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$repository = app(OperationsRepositoryInterface::class);
|
||||
$repository->setUser($autoBudget->budget->user);
|
||||
$spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
|
||||
$currencyId = (int) $autoBudget->transaction_currency_id;
|
||||
$currencyId = (int)$autoBudget->transaction_currency_id;
|
||||
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
|
||||
Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
|
||||
|
||||
@ -200,6 +200,11 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
*/
|
||||
private function handleAutoBudget(AutoBudget $autoBudget): void
|
||||
{
|
||||
if (null === $autoBudget->budget) {
|
||||
Log::info(sprintf('Auto budget #%d is associated with a deleted budget.', $autoBudget->id));
|
||||
$autoBudget->delete();
|
||||
return;
|
||||
}
|
||||
if (!$this->isMagicDay($autoBudget)) {
|
||||
Log::info(
|
||||
sprintf(
|
||||
@ -255,8 +260,8 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
/**
|
||||
* @param AutoBudget $autoBudget
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function isMagicDay(AutoBudget $autoBudget): bool
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user