mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Consistent end dates for budget limits.
This commit is contained in:
@@ -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.
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user