Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Consistent end dates for budget limits.
James Coleb0f18a04195e
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.phpindex 907ef5b189..e92bee059b 100644--- a/app/Http/Controllers/Budget/BudgetLimitController.php+++ b/app/Http/Controllers/Budget/BudgetLimitController.php@@ -52,14 +52,10 @@ class BudgetLimitController extends Controller{use DateCalculation;- /** @var BudgetLimitRepositoryInterface */- private $blRepository;- /** @var CurrencyRepositoryInterface */- private $currencyRepos;- /** @var OperationsRepositoryInterface */- private $opsRepository;- /** @var BudgetRepositoryInterface The budget repository */- private $repository;+ private BudgetLimitRepositoryInterface $blRepository;+ private CurrencyRepositoryInterface $currencyRepos;+ private OperationsRepositoryInterface $opsRepository;+ private BudgetRepositoryInterface $repository;/*** AmountController constructor.diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.phpindex 5ebb6c26f3..ce6ad0e504 100644--- a/app/Repositories/Budget/BudgetLimitRepository.php+++ b/app/Repositories/Budget/BudgetLimitRepository.php@@ -115,8 +115,8 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface{return $budget->budgetlimits()->where('transaction_currency_id', $currency->id)- ->where('start_date', $start->format('Y-m-d'))- ->where('end_date', $end->format('Y-m-d'))->first();+ ->where('start_date', $start->format('Y-m-d 00:00:00'))+ ->where('end_date', $end->format('Y-m-d 23:59:59'))->first();}/**@@ -307,7 +307,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface// find limit with same date range and currency.$limit = $budget->budgetlimits()->where('budget_limits.start_date', $data['start_date']->format('Y-m-d 00:00:00'))- ->where('budget_limits.end_date', $data['end_date']->format('Y-m-d 00:00:00'))+ ->where('budget_limits.end_date', $data['end_date']->format('Y-m-d 23:59:59'))->where('budget_limits.transaction_currency_id', $currency->id)->get(['budget_limits.*'])->first();if (null !== $limit) {@@ -319,7 +319,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface$limit = new BudgetLimit;$limit->budget()->associate($budget);$limit->start_date = $data['start_date']->format('Y-m-d 00:00:00');- $limit->end_date = $data['end_date']->format('Y-m-d 00:00:00');+ $limit->end_date = $data['end_date']->format('Y-m-d 23:59:59');$limit->amount = $data['amount'];$limit->transaction_currency_id = $currency->id;$limit->save();@@ -339,7 +339,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface$budgetLimit->amount = array_key_exists('amount',$data) ? $data['amount'] : $budgetLimit->amount;$budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id;$budgetLimit->start_date = array_key_exists('start_date', $data) ? $data['start_date']->format('Y-m-d 00:00:00') : $budgetLimit->start_date;- $budgetLimit->end_date = array_key_exists('end_date', $data) ? $data['end_date']->format('Y-m-d 00:00:00') : $budgetLimit->end_date;+ $budgetLimit->end_date = array_key_exists('end_date', $data) ? $data['end_date']->format('Y-m-d 23:59:59') : $budgetLimit->end_date;// if no currency has been provided, use the user's default currency:$currency = null;