mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed a bug where the target date and start date could not be null [skip ci]
This commit is contained in:
parent
e4f04583a3
commit
372189a107
@ -129,6 +129,9 @@ class EloquentPiggybankRepository implements PiggybankRepositoryInterface
|
||||
if ($data['reminder'] == 'none') {
|
||||
unset($data['reminder']);
|
||||
}
|
||||
if($data['startdate'] == '') {
|
||||
unset($data['startdate']);
|
||||
}
|
||||
|
||||
/** @var \Firefly\Storage\Account\AccountRepositoryInterface $accounts */
|
||||
$accounts = \App::make('Firefly\Storage\Account\AccountRepositoryInterface');
|
||||
|
@ -53,12 +53,18 @@ class EloquentPiggybankTrigger
|
||||
/** @var \PiggybankRepetition $rep */
|
||||
foreach ($reps as $rep) {
|
||||
if ($rep->currentamount == 0) {
|
||||
$sum = \Transaction::where('piggybank_id', $piggy->id)->leftJoin(
|
||||
$query = \Transaction::where('piggybank_id', $piggy->id)->leftJoin(
|
||||
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
|
||||
)->where('transaction_journals.date', '>=', $rep->startdate->format('Y-m-d'))->where(
|
||||
);
|
||||
if (!is_null($rep->startdate)) {
|
||||
$query->where('transaction_journals.date', '>=', $rep->startdate->format('Y-m-d'));
|
||||
}
|
||||
if (!is_null($rep->targetdate)) {
|
||||
$query->where(
|
||||
'transaction_journals.date', '<=', $rep->targetdate->format('Y-m-d')
|
||||
)->sum('transactions.amount');
|
||||
|
||||
);
|
||||
}
|
||||
$sum = $query->sum('transactions.amount');
|
||||
$rep->currentamount = floatval($sum);
|
||||
}
|
||||
$rep->save();
|
||||
|
Loading…
Reference in New Issue
Block a user