mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-03-11 19:50:25 -04:00
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.
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
<?php if (!is_right_side_currency_symbol()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?= form_input(['name' => "payment_amount_$i", 'value' => $row->payment_amount, 'id' => "payment_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) // TODO: add type attribute ?>
|
||||
<?= form_input(['name' => "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 ?>
|
||||
<?php if (is_right_side_currency_symbol()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
@@ -112,7 +112,7 @@
|
||||
<?php if (!is_right_side_currency_symbol()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?= form_input(['name' => "refund_amount_$i", 'value' => $row->cash_refund, 'id' => "refund_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?>
|
||||
<?= form_input(['name' => "refund_amount_$i", 'value' => to_currency_no_money($row->cash_refund), 'id' => "refund_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?>
|
||||
<?php if (is_right_side_currency_symbol()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user