X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FNumber.php;h=02e31ad96a5790c7167dcf24829eb911d1036b6a;hb=ead0c08f09f10fc2b62a655c08bbe69a1249f55c;hp=856233316b9204e961bd229b75cc3b7bc125158b;hpb=412f2d1627d0a075f872064df40968b7adfcf51f;p=civicrm-core.git
diff --git a/CRM/Utils/Number.php b/CRM/Utils/Number.php
index 856233316b..02e31ad96a 100644
--- a/CRM/Utils/Number.php
+++ b/CRM/Utils/Number.php
@@ -3,7 +3,7 @@
+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@ -27,13 +27,14 @@
/**
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
/**
* Class CRM_Utils_Number
*/
class CRM_Utils_Number {
+
/**
* Create a random number with a given precision.
*
@@ -64,13 +65,16 @@ class CRM_Utils_Number {
public static function createTruncatedDecimal($keyValue, $precision) {
list ($sigFigs, $decFigs) = $precision;
$sign = ($keyValue < 0) ? '-1' : 1;
- $val = str_replace('.', '', abs($keyValue)); // ex: -123.456 ==> 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 +113,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;