mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-27 16:57:38 +01:00
Fix #328 (finale)
This commit is contained in:
parent
b9365cd8f3
commit
34417053dd
@ -148,26 +148,13 @@ class Formatter
|
|||||||
*/
|
*/
|
||||||
public function parseNumber($value)
|
public function parseNumber($value)
|
||||||
{
|
{
|
||||||
$sign = null;
|
|
||||||
if ($value[0] == '+' || $value[0] == '-') {
|
|
||||||
$sign = $value[0];
|
|
||||||
$value = substr($value, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Controllo sull'effettiva natura del numero
|
// Controllo sull'effettiva natura del numero
|
||||||
$number = str_replace(array_values($this->getNumberSeparators()), '', $value);
|
if (is_numeric($value)) {
|
||||||
|
|
||||||
$pieces = explode($this->getNumberSeparators()['decimals'], $value);
|
|
||||||
$integer = str_replace(array_values($this->getNumberSeparators()), '', $pieces[0]);
|
|
||||||
|
|
||||||
if (!ctype_digit($number) || (strlen($integer) != strlen((int) $integer))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $sign.$value;
|
|
||||||
|
|
||||||
if (is_object($this->numberFormatter)) {
|
if (is_object($this->numberFormatter)) {
|
||||||
$result = $this->numberFormatter->parse($value, NumberFormatter::PATTERN_DECIMAL);
|
$result = $this->numberFormatter->parse($value);
|
||||||
} else {
|
} else {
|
||||||
$result = $this->customNumber($value, $this->getNumberSeparators(), self::getStandardFormats()['number']);
|
$result = $this->customNumber($value, $this->getNumberSeparators(), self::getStandardFormats()['number']);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user