Step to reproduce
1: Select european format (1.000.000,00) for numbers in setting page
2: Set amount with dot as comma (on the numeric keypad, the comma is a dot)
3: save the invoice
Screenshots
Actually

Expected

Note: All values are hand filled before, when darkens become == click on save and when lightens it's the saved values returned by server.
Possible solution
Change standardize_amount function in helpers/number_helper.php with that
function standardize_amount($amount)
{
if ($amount && ! is_numeric($amount))
{
$CI = & get_instance();
$thousands_separator = $CI->mdl_settings->setting('thousands_separator');
$decimal_point = $CI->mdl_settings->setting('decimal_point');
if ($thousands_separator == '.' && ! substr_count($amount, ',') && substr_count($amount, '.') > 1)
{
$amount[ strrpos($amount, '.') ] = ','; // Replace last position of dot to comma
}
$amount = strtr($amount, [$thousands_separator => '', $decimal_point => '.']);
}
return $amount;
}
Note
This fix improve the function
- Applied only on not numeric
str_replace to strtr
- Replace last position of dot to comma if don't have a comma
- And work with all number format chosen by user
This not solve all problems of typos like 1.00.0 > 100,00 but just trust on human intellect after all.
Step to reproduce
1: Select
european format(1.000.000,00) for numbers in setting page2: Set amount with dot as comma (on the numeric keypad, the comma is a dot)
3: save the invoice
Screenshots
Actually
Expected
Note: All values are hand filled before, when darkens become == click on
saveand when lightens it's the saved values returned by server.Possible solution
Change
standardize_amountfunction inhelpers/number_helper.phpwith thatNote
This fix improve the function
str_replacetostrtrThis not solve all problems of typos like
1.00.0>100,00but just trust on human intellect after all.