mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 19:00:22 -06:00
Consistent dates for #3847
This commit is contained in:
parent
46ebf3c07c
commit
c0f363cf86
@ -66,8 +66,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
{
|
{
|
||||||
return $this->user->availableBudgets()
|
return $this->user->availableBudgets()
|
||||||
->where('transaction_currency_id', $currency->id)
|
->where('transaction_currency_id', $currency->id)
|
||||||
->where('start_date', $start->format('Y-m-d 00:00:00'))
|
->where('start_date', $start->format('Y-m-d'))
|
||||||
->where('end_date', $end->format('Y-m-d 00:00:00'))
|
->where('end_date', $end->format('Y-m-d'))
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -86,8 +86,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
if (null !== $start && null !== $end) {
|
if (null !== $start && null !== $end) {
|
||||||
$query->where(
|
$query->where(
|
||||||
static function (Builder $q1) use ($start, $end) {
|
static function (Builder $q1) use ($start, $end) {
|
||||||
$q1->where('start_date', '=', $start->format('Y-m-d 00:00:00'));
|
$q1->where('start_date', '=', $start->format('Y-m-d'));
|
||||||
$q1->where('end_date', '=', $end->format('Y-m-d 23:59:59'));
|
$q1->where('end_date', '=', $end->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -107,8 +107,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
$amount = '0';
|
$amount = '0';
|
||||||
$availableBudget = $this->user->availableBudgets()
|
$availableBudget = $this->user->availableBudgets()
|
||||||
->where('transaction_currency_id', $currency->id)
|
->where('transaction_currency_id', $currency->id)
|
||||||
->where('start_date', $start->format('Y-m-d 00:00:00'))
|
->where('start_date', $start->format('Y-m-d'))
|
||||||
->where('end_date', $end->format('Y-m-d 23:59:59'))->first();
|
->where('end_date', $end->format('Y-m-d'))->first();
|
||||||
if (null !== $availableBudget) {
|
if (null !== $availableBudget) {
|
||||||
$amount = (string)$availableBudget->amount;
|
$amount = (string)$availableBudget->amount;
|
||||||
}
|
}
|
||||||
@ -126,8 +126,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
$availableBudgets = $this->user->availableBudgets()
|
$availableBudgets = $this->user->availableBudgets()
|
||||||
->where('start_date', $start->format('Y-m-d 00:00:00'))
|
->where('start_date', $start->format('Y-m-d'))
|
||||||
->where('end_date', $end->format('Y-m-d 23:59:59'))->get();
|
->where('end_date', $end->format('Y-m-d'))->get();
|
||||||
/** @var AvailableBudget $availableBudget */
|
/** @var AvailableBudget $availableBudget */
|
||||||
foreach ($availableBudgets as $availableBudget) {
|
foreach ($availableBudgets as $availableBudget) {
|
||||||
$return[$availableBudget->transaction_currency_id] = $availableBudget->amount;
|
$return[$availableBudget->transaction_currency_id] = $availableBudget->amount;
|
||||||
@ -162,10 +162,10 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
$query = $this->user->availableBudgets();
|
$query = $this->user->availableBudgets();
|
||||||
|
|
||||||
if (null !== $start) {
|
if (null !== $start) {
|
||||||
$query->where('start_date', '>=', $start->format('Y-m-d 00:00:00'));
|
$query->where('start_date', '>=', $start->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
if (null !== $end) {
|
if (null !== $end) {
|
||||||
$query->where('end_date', '<=', $end->format('Y-m-d 23:59:59'));
|
$query->where('end_date', '<=', $end->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query->get();
|
return $query->get();
|
||||||
@ -184,14 +184,14 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
{
|
{
|
||||||
$availableBudget = $this->user->availableBudgets()
|
$availableBudget = $this->user->availableBudgets()
|
||||||
->where('transaction_currency_id', $currency->id)
|
->where('transaction_currency_id', $currency->id)
|
||||||
->where('start_date', $start->format('Y-m-d 00:00:00'))
|
->where('start_date', $start->format('Y-m-d'))
|
||||||
->where('end_date', $end->format('Y-m-d 23:59:59'))->first();
|
->where('end_date', $end->format('Y-m-d'))->first();
|
||||||
if (null === $availableBudget) {
|
if (null === $availableBudget) {
|
||||||
$availableBudget = new AvailableBudget;
|
$availableBudget = new AvailableBudget;
|
||||||
$availableBudget->user()->associate($this->user);
|
$availableBudget->user()->associate($this->user);
|
||||||
$availableBudget->transactionCurrency()->associate($currency);
|
$availableBudget->transactionCurrency()->associate($currency);
|
||||||
$availableBudget->start_date = $start->format('Y-m-d 00:00:00');
|
$availableBudget->start_date = $start->format('Y-m-d');
|
||||||
$availableBudget->end_date = $end->format('Y-m-d 23:59:59');
|
$availableBudget->end_date = $end->format('Y-m-d');
|
||||||
}
|
}
|
||||||
$availableBudget->amount = $amount;
|
$availableBudget->amount = $amount;
|
||||||
$availableBudget->save();
|
$availableBudget->save();
|
||||||
@ -261,8 +261,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
{
|
{
|
||||||
$existing = $this->user->availableBudgets()
|
$existing = $this->user->availableBudgets()
|
||||||
->where('transaction_currency_id', $data['currency_id'])
|
->where('transaction_currency_id', $data['currency_id'])
|
||||||
->where('start_date', $data['start']->format('Y-m-d 00:00:00'))
|
->where('start_date', $data['start']->format('Y-m-d'))
|
||||||
->where('end_date', $data['end']->format('Y-m-d 23:59:59'))
|
->where('end_date', $data['end']->format('Y-m-d'))
|
||||||
->where('id', '!=', $availableBudget->id)
|
->where('id', '!=', $availableBudget->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
return $this->user
|
return $this->user
|
||||||
->availableBudgets()
|
->availableBudgets()
|
||||||
->where('transaction_currency_id', $currency->id)
|
->where('transaction_currency_id', $currency->id)
|
||||||
->where('start_date', $start->format('Y-m-d 00:00:00'))
|
->where('start_date', $start->format('Y-m-d'))
|
||||||
->where('end_date', $end->format('Y-m-d 23:59:59'))->first();
|
->where('end_date', $end->format('Y-m-d'))->first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user