From 0fdb3ba37b8fd48faafc08ca89e4537d24f0a5c0 Mon Sep 17 00:00:00 2001 From: Ollama Date: Sun, 8 Mar 2026 21:28:50 +0000 Subject: [PATCH] Fix payment type becoming null when editing sales When localization uses dot (.) as thousands separator (e.g., it_IT, es_ES, pt_PT), the payment_amount value was displayed as raw float (e.g., '10.50') but parsed using parse_decimals() which expects locale-formatted numbers. In these locales, '.' is thousands separator and ',' is decimal separator. parse_decimals('10.50') would return false, causing the condition != 0 to evaluate incorrectly (false == 0 in PHP), resulting in the payment being deleted instead of updated. Fix: Use to_currency_no_money() to format payment_amount and cash_refund values according to locale before displaying in the form, so parse_decimals() can correctly parse them on submission. --- app/Views/sales/form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Views/sales/form.php b/app/Views/sales/form.php index e35fd79cf..e59484da0 100644 --- a/app/Views/sales/form.php +++ b/app/Views/sales/form.php @@ -89,7 +89,7 @@ - "payment_amount_$i", 'value' => $row->payment_amount, 'id' => "payment_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) // TODO: add type attribute ?> + "payment_amount_$i", 'value' => to_currency_no_money($row->payment_amount), 'id' => "payment_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) // TODO: add type attribute ?> @@ -112,7 +112,7 @@ - "refund_amount_$i", 'value' => $row->cash_refund, 'id' => "refund_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?> + "refund_amount_$i", 'value' => to_currency_no_money($row->cash_refund), 'id' => "refund_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?>