From: Seamus Lee Date: Thu, 15 Apr 2021 22:01:23 +0000 (+1000) Subject: REF Ensure that getAmount includes 0s in decimal places up to 2 places X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=78b338e07464becd1555a2c7d2d04ac0e4e9180c;p=civicrm-core.git REF Ensure that getAmount includes 0s in decimal places up to 2 places --- diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index e19da90c3a..72b407bf2f 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -1166,9 +1166,9 @@ abstract class CRM_Core_Payment { protected function getAmount($params = []) { if (!CRM_Utils_Rule::numeric($params['amount'])) { CRM_Core_Error::deprecatedWarning('Passing Amount value that is not numeric is deprecated please report this in gitlab'); - return filter_var($params['amount'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); + return CRM_Utils_Money::formatLocaleNumericRoundedByPrecision(filter_var($params['amount'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 2); } - return $params['amount']; + return CRM_Utils_Money::formatLocaleNumericRoundedByPrecision($params['amount'], 2); } /**