mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:34:35 -04:00
FIxes for parsing string floats
This commit is contained in:
parent
df5754a4c7
commit
7bc23e68b1
@ -61,12 +61,12 @@ class Number
|
|||||||
// convert "," to "."
|
// convert "," to "."
|
||||||
$s = str_replace(',', '.', $value);
|
$s = str_replace(',', '.', $value);
|
||||||
|
|
||||||
if($value < 1)
|
|
||||||
return (float)$s;
|
|
||||||
|
|
||||||
// remove everything except numbers and dot "."
|
// remove everything except numbers and dot "."
|
||||||
$s = preg_replace("/[^0-9\.]/", '', $s);
|
$s = preg_replace("/[^0-9\.]/", '', $s);
|
||||||
|
|
||||||
|
if($s < 1)
|
||||||
|
return (float)$s;
|
||||||
|
|
||||||
// remove all seperators from first part and keep the end
|
// remove all seperators from first part and keep the end
|
||||||
$s = str_replace('.', '', substr($s, 0, -3)).substr($s, -3);
|
$s = str_replace('.', '', substr($s, 0, -3)).substr($s, -3);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user