Bugfix: Empty pre-filled value in auto-budgets

The auto-budget pre-filled is empty when the set amount is above
1000 (view /budgets/edit/X).

The root cause was the function 'number_format' returning a string that
cannot be casted to a float when the amount is above 1000, because of the
thousands separator.
This commit is contained in:
Julien Cassagne 2021-12-06 20:38:20 -05:00
parent e316d9ce6d
commit a9ee07b19a
No known key found for this signature in database
GPG Key ID: D73078D6541F1940

View File

@ -103,7 +103,7 @@ class EditController extends Controller
]; ];
if ($autoBudget) { if ($autoBudget) {
$amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount; $amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;
$preFilled['auto_budget_amount'] = number_format((float)$amount, $autoBudget->transactionCurrency->decimal_places); $preFilled['auto_budget_amount'] = number_format((float)$amount, $autoBudget->transactionCurrency->decimal_places, '.', '');
} }
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").