From a9ee07b19a10686bf7449d956963fa4aa402b223 Mon Sep 17 00:00:00 2001 From: Julien Cassagne Date: Mon, 6 Dec 2021 20:38:20 -0500 Subject: [PATCH] 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. --- app/Http/Controllers/Budget/EditController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index 4e382046a9..58af558d23 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -103,7 +103,7 @@ class EditController extends Controller ]; if ($autoBudget) { $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").