From ee080cf8cb9c4b5f9bf06c45be06be2eb828f3a7 Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 27 Oct 2019 10:43:56 +1300 Subject: [PATCH] Cast result of getContributionBalance to float to match comment block. Without this it is possible for it to return 'null' which is not useful / in keeping. I did a bit of an audit & did not find places where this would cause an === comparison to fail --- CRM/Contribute/BAO/Contribution.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index e68194d40512..98cc46830d8c 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4166,7 +4166,7 @@ public static function getContributionBalance($contributionId, $contributionTota $contributionTotal = CRM_Price_BAO_LineItem::getLineTotal($contributionId); } - return CRM_Utils_Money::subtractCurrencies( + return (float) CRM_Utils_Money::subtractCurrencies( $contributionTotal, CRM_Core_BAO_FinancialTrxn::getTotalPayments($contributionId, TRUE) ?: 0, CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'currency')