X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FNumber.php;h=ff254735958b65660c0c0ffb404c9fdb3b7385f7;hb=c77f9b14576dbe8314a82b2e4f19a170d3cc1695;hp=26a3bf79a216fc2e9b3651b79d4b906c1496acb0;hpb=d2118be269bed42c1398dd8c4da996caeaed6006;p=civicrm-core.git diff --git a/CRM/Utils/Number.php b/CRM/Utils/Number.php index 26a3bf79a2..ff25473595 100644 --- a/CRM/Utils/Number.php +++ b/CRM/Utils/Number.php @@ -1,39 +1,24 @@ 123456 - $val = substr($val, 0, $sigFigs); // ex: 123456 => 1234 + // ex: -123.456 ==> 123456 + $val = str_replace('.', '', abs($keyValue)); + // ex: 123456 => 1234 + $val = substr($val, 0, $sigFigs); // Move any extra digits after decimal $extraFigs = strlen($val) - ($sigFigs - $decFigs); if ($extraFigs > 0) { - return $sign * $val / pow(10, $extraFigs); // ex: 1234 => 1.234 + // ex: 1234 => 1.234 + return $sign * $val / pow(10, $extraFigs); } else { return $sign * $val; @@ -109,7 +97,7 @@ class CRM_Utils_Number { // respect php.ini upload_max_filesize if ($size > $maxImportFileSize && $size !== $postMaxSize) { $size = $maxImportFileSize; - CRM_Core_Session::setStatus(ts("Note: Please verify your configuration for Maximum File Size (in MB) Administrator >> System Settings >> Misc. It should support 'upload_max_size' as defined in PHP.ini.Please check with your system administrator.", array(1 => CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1'))), ts("Warning"), "alert"); + CRM_Core_Session::setStatus(ts("Note: Please verify your configuration for Maximum File Size (in MB) Administrator >> System Settings >> Misc. It should support 'upload_max_size' as defined in PHP.ini.Please check with your system administrator.", [1 => CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1')]), ts("Warning"), "alert"); } } return $size;