From: Chamil Wijesooriya Date: Thu, 20 Aug 2020 15:15:56 +0000 (+0100) Subject: dev/core#1959 Brick\Math\Exception\RoundingNecessaryException X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f1b7204159f4f541995605656532bdad26da7427;p=civicrm-core.git dev/core#1959 Brick\Math\Exception\RoundingNecessaryException --- diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index f5fb16244e..9da7a98fe9 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -139,8 +139,9 @@ class CRM_Utils_Money { */ public static function subtractCurrencies($leftOp, $rightOp, $currency) { if (is_numeric($leftOp) && is_numeric($rightOp)) { - $money = Money::of($leftOp, $currency, new DefaultContext(), RoundingMode::CEILING); - return $money->minus($rightOp)->getAmount()->toFloat(); + $leftMoney = Money::of($leftOp, $currency, new DefaultContext(), RoundingMode::CEILING); + $rightMoney = Money::of($rightOp, $currency, new DefaultContext(), RoundingMode::CEILING); + return $leftMoney->minus($rightMoney)->getAmount()->toFloat(); } }