mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Fix #4894
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Repositories\PiggyBank;
|
namespace FireflyIII\Repositories\PiggyBank;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -90,7 +91,7 @@ trait ModifiesPiggyBanks
|
|||||||
$leftOnAccount = $this->leftOnAccount($piggyBank, today(config('app.timezone')));
|
$leftOnAccount = $this->leftOnAccount($piggyBank, today(config('app.timezone')));
|
||||||
$savedSoFar = (string)$this->getRepetition($piggyBank)->currentamount;
|
$savedSoFar = (string)$this->getRepetition($piggyBank)->currentamount;
|
||||||
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
|
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
|
||||||
$maxAmount = (string)min(round((float)$leftOnAccount, 12), round((float)$leftToSave, 12));
|
$maxAmount = 1 === bccomp($leftOnAccount, $leftToSave) ? $leftToSave : $leftOnAccount;
|
||||||
$compare = bccomp($amount, $maxAmount);
|
$compare = bccomp($amount, $maxAmount);
|
||||||
$result = $compare <= 0;
|
$result = $compare <= 0;
|
||||||
|
|
||||||
@@ -304,7 +305,7 @@ trait ModifiesPiggyBanks
|
|||||||
$piggyBank = PiggyBank::create($piggyData);
|
$piggyBank = PiggyBank::create($piggyData);
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not store piggy bank: %s', $e->getMessage()), $piggyData);
|
Log::error(sprintf('Could not store piggy bank: %s', $e->getMessage()), $piggyData);
|
||||||
throw new FireflyException('400005: Could not store new piggy bank.',0,$e);
|
throw new FireflyException('400005: Could not store new piggy bank.', 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset order then set order:
|
// reset order then set order:
|
||||||
@@ -315,7 +316,7 @@ trait ModifiesPiggyBanks
|
|||||||
|
|
||||||
// repetition is auto created.
|
// repetition is auto created.
|
||||||
$repetition = $this->getRepetition($piggyBank);
|
$repetition = $this->getRepetition($piggyBank);
|
||||||
if (null !== $repetition && array_key_exists('current_amount',$data) && '' !== $data['current_amount']) {
|
if (null !== $repetition && array_key_exists('current_amount', $data) && '' !== $data['current_amount']) {
|
||||||
$repetition->currentamount = $data['current_amount'];
|
$repetition->currentamount = $data['current_amount'];
|
||||||
$repetition->save();
|
$repetition->save();
|
||||||
}
|
}
|
||||||
|
@@ -58,9 +58,9 @@ class ExpandedForm
|
|||||||
unset($options['currency'], $options['placeholder']);
|
unset($options['currency'], $options['placeholder']);
|
||||||
|
|
||||||
// make sure value is formatted nicely:
|
// make sure value is formatted nicely:
|
||||||
if (null !== $value && '' !== $value) {
|
//if (null !== $value && '' !== $value) {
|
||||||
$value = round((float)$value, 8);
|
//$value = round((float)$value, 8);
|
||||||
}
|
//}
|
||||||
try {
|
try {
|
||||||
$html = prefixView('form.amount-no-currency', compact('classes', 'name', 'label', 'value', 'options'))->render();
|
$html = prefixView('form.amount-no-currency', compact('classes', 'name', 'label', 'value', 'options'))->render();
|
||||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||||
@@ -224,6 +224,7 @@ class ExpandedForm
|
|||||||
}
|
}
|
||||||
$selectList[$entryId] = $title;
|
$selectList[$entryId] = $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $selectList;
|
return $selectList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ class ExpandedForm
|
|||||||
|
|
||||||
// make sure value is formatted nicely:
|
// make sure value is formatted nicely:
|
||||||
if (null !== $value && '' !== $value) {
|
if (null !== $value && '' !== $value) {
|
||||||
$value = round((float)$value, $selectedCurrency->decimal_places);
|
// $value = round((float)$value, $selectedCurrency->decimal_places);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$html = prefixView('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();
|
$html = prefixView('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||||
|
@@ -130,8 +130,8 @@ trait ModelInformation
|
|||||||
$billTriggers = ['currency_is', 'amount_more', 'amount_less', 'description_contains'];
|
$billTriggers = ['currency_is', 'amount_more', 'amount_less', 'description_contains'];
|
||||||
$values = [
|
$values = [
|
||||||
$bill->transactionCurrency()->first()->name,
|
$bill->transactionCurrency()->first()->name,
|
||||||
round((float)$bill->amount_min, 12),
|
round((float)$bill->amount_min, 24),
|
||||||
round((float)$bill->amount_max, 12),
|
round((float)$bill->amount_max, 24),
|
||||||
$bill->name,
|
$bill->name,
|
||||||
];
|
];
|
||||||
foreach ($billTriggers as $index => $trigger) {
|
foreach ($billTriggers as $index => $trigger) {
|
||||||
|
13
changelog.md
13
changelog.md
@@ -8,7 +8,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
- A few new pages for the new v2 layout. Thanks @alex6480!
|
- A few new pages for the new v2 layout. Thanks @alex6480!
|
||||||
- Feature to be able to rebuild Docker images and show security warnings in new builds.
|
|
||||||
- Added a new currency yay!
|
- Added a new currency yay!
|
||||||
- You can now manage loans and debts a little better.
|
- You can now manage loans and debts a little better.
|
||||||
|
|
||||||
@@ -16,10 +15,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- A better cache routine for layout v2 pages.
|
- A better cache routine for layout v2 pages.
|
||||||
- All LDAP libraries have been upgrade.
|
- All LDAP libraries have been upgrade.
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
- Initial release.
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- All telemetry options have been removed.
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- #4894 Bad number comparison
|
||||||
- Various Sonarqube issues, thanks @hazma-fadil!
|
- Various Sonarqube issues, thanks @hazma-fadil!
|
||||||
- Correct menu display, thanks @vonsogt!
|
- Correct menu display, thanks @vonsogt!
|
||||||
|
|
||||||
|
|
||||||
|
### Security
|
||||||
|
- Feature to be able to rebuild Docker images and show security warnings in new builds.
|
||||||
|
|
||||||
### API
|
### API
|
||||||
- You can disable webhooks with an extra field in API submissions.
|
- You can disable webhooks with an extra field in API submissions.
|
||||||
- There is a static cron token (see `.env.example`) which is useful for Docker.
|
- There is a static cron token (see `.env.example`) which is useful for Docker.
|
||||||
|
Reference in New Issue
Block a user