Update functions.lib.php
Fix #15820 function price2num add underscore and - in the pattern in instruction $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount); as this: $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount); in order to cover some constantes cases as 20% (TX_NORMAL) or 10% (TX_REDUIT) for example where underscore or - can be used. I don't know if other characters have to be added to this pattern.
This commit is contained in:
parent
aaddda9a6e
commit
dd9031432a
@ -4863,7 +4863,7 @@ function price2num($amount, $rounding = '', $option = 0)
|
||||
if ($option != 1) { // If not a PHP number or unknown, we change or clean format
|
||||
//print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>';
|
||||
if (!is_numeric($amount)) {
|
||||
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount);
|
||||
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount);
|
||||
}
|
||||
|
||||
if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123
|
||||
|
||||
Loading…
Reference in New Issue
Block a user