mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 20:38:57 +00:00
Now with the added capability of adding money to a piggy bank from a transfer. Also various fixes (see issue #6). [skip ci]
This commit is contained in:
@@ -163,20 +163,15 @@ class EloquentPiggybankRepository implements PiggybankRepositoryInterface
|
||||
$piggy->startdate
|
||||
= isset($data['startdate']) && strlen($data['startdate']) > 0 ? new Carbon($data['startdate']) : null;
|
||||
|
||||
// everything we can update for NON repeating piggy banks:
|
||||
if ($piggy->repeats == 0) {
|
||||
// if non-repeating there is only one PiggyBank instance and we can delete it safely.
|
||||
// it will be recreated.
|
||||
$piggy->piggybankrepetitions()->first()->delete();
|
||||
} else {
|
||||
// we can delete all of them, because reasons
|
||||
foreach ($piggy->piggybankrepetitions()->get() as $rep) {
|
||||
$rep->delete();
|
||||
}
|
||||
foreach ($piggy->piggybankrepetitions()->get() as $rep) {
|
||||
$rep->delete();
|
||||
}
|
||||
|
||||
if ($piggy->repeats == 1) {
|
||||
$piggy->rep_every = intval($data['rep_every']);
|
||||
$piggy->rep_length = $data['rep_length'];
|
||||
}
|
||||
|
||||
if ($piggy->validate()) {
|
||||
// check the things we check for new piggies
|
||||
$piggy->save();
|
||||
|
||||
Reference in New Issue
Block a user