2
0
forked from Wavyzz/dolibarr

pricetonum() - preg-replace() delete "-" negativ number

This commit is contained in:
atm-lena
2020-12-04 16:06:10 +01:00
parent 589da1d4b9
commit d22646e6ae

View File

@@ -4724,7 +4724,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