diff --git a/app/Events/StoredBudgetLimit.php b/app/Events/StoredBudgetLimit.php deleted file mode 100644 index 65b7be0008..0000000000 --- a/app/Events/StoredBudgetLimit.php +++ /dev/null @@ -1,50 +0,0 @@ -budgetLimit = $budgetLimit; - $this->end = $end; - - } - -} diff --git a/app/Events/UpdatedBudgetLimit.php b/app/Events/UpdatedBudgetLimit.php deleted file mode 100644 index 3642531e75..0000000000 --- a/app/Events/UpdatedBudgetLimit.php +++ /dev/null @@ -1,50 +0,0 @@ -budgetLimit = $budgetLimit; - $this->end = $end; - - } - -} diff --git a/app/Handlers/Events/BudgetEventHandler.php b/app/Handlers/Events/BudgetEventHandler.php deleted file mode 100644 index 2acc5a29d9..0000000000 --- a/app/Handlers/Events/BudgetEventHandler.php +++ /dev/null @@ -1,93 +0,0 @@ -processRepetitionChange($budgetLimitEvent->budgetLimit, $budgetLimitEvent->end); - } - - /** - * Updates, if present the budget limit repetition part of a budget limit. - * - * @param UpdatedBudgetLimit $budgetLimitEvent - * - * @return bool - */ - public function updateRepetition(UpdatedBudgetLimit $budgetLimitEvent): bool - { - return $this->processRepetitionChange($budgetLimitEvent->budgetLimit, $budgetLimitEvent->end); - } - - /** - * @param BudgetLimit $budgetLimit - * @param Carbon $date - * - * @return bool - */ - private function processRepetitionChange(BudgetLimit $budgetLimit, Carbon $date): bool - { - $set = $budgetLimit->limitrepetitions() - ->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00')) - ->where('enddate', $date->format('Y-m-d 00:00:00')) - ->get(); - if ($set->count() == 0) { - $repetition = new LimitRepetition; - $repetition->startdate = $budgetLimit->startdate; - $repetition->enddate = $date; - $repetition->amount = $budgetLimit->amount; - $repetition->budgetLimit()->associate($budgetLimit); - - try { - $repetition->save(); - } catch (QueryException $e) { - Log::error('Trying to save new LimitRepetition failed: ' . $e->getMessage()); - } - } - - if ($set->count() == 1) { - $repetition = $set->first(); - $repetition->amount = $budgetLimit->amount; - $repetition->save(); - - } - - return true; - } -} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 61e41f8342..19d79a9fd6 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -45,16 +45,6 @@ class EventServiceProvider extends ServiceProvider 'FireflyIII\Events\RequestedNewPassword' => [ // is a User related event. 'FireflyIII\Handlers\Events\UserEventHandler@sendNewPassword', ], - 'FireflyIII\Events\StoredBudgetLimit' => // is a Budget related event. - [ - 'FireflyIII\Handlers\Events\BudgetEventHandler@storeRepetition', - ], - - 'FireflyIII\Events\UpdatedBudgetLimit' => // is a Budget related event. - [ - 'FireflyIII\Handlers\Events\BudgetEventHandler@updateRepetition', - ], - 'FireflyIII\Events\StoredTransactionJournal' => // is a Transaction Journal related event. [ 'FireflyIII\Handlers\Events\StoredJournalEventHandler@scanBills',