From f1b7204159f4f541995605656532bdad26da7427 Mon Sep 17 00:00:00 2001 From: Chamil Wijesooriya Date: Thu, 20 Aug 2020 16:15:56 +0100 Subject: [PATCH] dev/core#1959 Brick\Math\Exception\RoundingNecessaryException --- CRM/Utils/Money.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(); } } -- 2.25.1