mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix #251
This commit is contained in:
@@ -169,6 +169,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
|
||||
$piggyBank->save();
|
||||
|
||||
// if the piggy bank is now smaller than the current relevant rep,
|
||||
// remove money from the rep.
|
||||
$repetition = $piggyBank->currentRelevantRep();
|
||||
if ($repetition->currentamount > $piggyBank->targetamount) {
|
||||
$repetition->currentamount = $piggyBank->targetamount;
|
||||
$repetition->save();
|
||||
}
|
||||
|
||||
return $piggyBank;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user