From bf57dec07ccb5d7d8aec9a4260dd0710702f9164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sun, 18 Aug 2019 17:51:30 +0200 Subject: [PATCH] Fix wrong indexes in BudgetRepository Closes #2443 --- app/Repositories/Budget/BudgetRepository.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 7117414748..e2ea5f9103 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -931,9 +931,9 @@ class BudgetRepository implements BudgetRepositoryInterface public function updateAvailableBudget(AvailableBudget $availableBudget, array $data): AvailableBudget { $existing = $this->user->availableBudgets() - ->where('transaction_currency_id', $data['transaction_currency_id']) - ->where('start_date', $data['start_date']->format('Y-m-d 00:00:00')) - ->where('end_date', $data['end_date']->format('Y-m-d 00:00:00')) + ->where('transaction_currency_id', $data['currency_id']) + ->where('start_date', $data['start']->format('Y-m-d 00:00:00')) + ->where('end_date', $data['end']->format('Y-m-d 00:00:00')) ->where('id', '!=', $availableBudget->id) ->first(); @@ -941,8 +941,8 @@ class BudgetRepository implements BudgetRepositoryInterface throw new FireflyException(sprintf('An entry already exists for these parameters: available budget object with ID #%d', $existing->id)); } $availableBudget->transaction_currency_id = $data['currency_id']; - $availableBudget->start_date = $data['start_date']; - $availableBudget->end_date = $data['end_date']; + $availableBudget->start_date = $data['start']; + $availableBudget->end_date = $data['end']; $availableBudget->amount = $data['amount']; $availableBudget->save();