mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Merge branch 'develop' into 5.8-dev
# Conflicts: # app/Api/V1/Controllers/Chart/AccountController.php # app/Api/V1/Controllers/Insight/Expense/AccountController.php # app/Api/V1/Controllers/Insight/Expense/BillController.php # app/Api/V1/Controllers/Insight/Expense/BudgetController.php # app/Api/V1/Controllers/Insight/Expense/CategoryController.php # app/Api/V1/Controllers/Insight/Expense/PeriodController.php # app/Console/Commands/Upgrade/MigrateToGroups.php # app/Http/Controllers/Account/IndexController.php # app/Http/Controllers/Budget/AvailableBudgetController.php # app/Http/Controllers/Budget/BudgetLimitController.php # app/Http/Controllers/Budget/EditController.php # app/Http/Controllers/Chart/AccountController.php # app/Http/Controllers/Json/FrontpageController.php # app/Http/Controllers/PiggyBank/EditController.php
This commit is contained in:
@@ -96,7 +96,7 @@ trait ModifiesPiggyBanks
|
||||
$savedSoFar = (string)$this->getRepetition($piggyBank)->currentamount;
|
||||
$maxAmount = $leftOnAccount;
|
||||
$leftToSave = null;
|
||||
if (0.0 !== (float)$piggyBank->targetamount) {
|
||||
if (0 !== bccomp($piggyBank->targetamount, '0')) {
|
||||
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
|
||||
$maxAmount = 1 === bccomp($leftOnAccount, $leftToSave) ? $leftToSave : $leftOnAccount;
|
||||
}
|
||||
@@ -383,7 +383,7 @@ trait ModifiesPiggyBanks
|
||||
// if the piggy bank is now smaller than the current relevant rep,
|
||||
// remove money from the rep.
|
||||
$repetition = $this->getRepetition($piggyBank);
|
||||
if (null !== $repetition && $repetition->currentamount > $piggyBank->targetamount && 0.0 !== (float)$piggyBank->targetamount) {
|
||||
if (null !== $repetition && $repetition->currentamount > $piggyBank->targetamount && 0 !== bccomp($piggyBank->targetamount, '0')) {
|
||||
$difference = bcsub($piggyBank->targetamount, $repetition->currentamount);
|
||||
|
||||
// an amount will be removed, create "negative" event:
|
||||
@@ -446,6 +446,9 @@ trait ModifiesPiggyBanks
|
||||
if (array_key_exists('targetamount', $data) && '' !== $data['targetamount']) {
|
||||
$piggyBank->targetamount = $data['targetamount'];
|
||||
}
|
||||
if (array_key_exists('targetamount', $data) && '' === $data['targetamount']) {
|
||||
$piggyBank->targetamount = '0';
|
||||
}
|
||||
if (array_key_exists('targetdate', $data) && '' !== $data['targetdate']) {
|
||||
$piggyBank->targetdate = $data['targetdate'];
|
||||
}
|
||||
|
Reference in New Issue
Block a user