From ea8f914c40bd2b1df65e5ce176c10dadb9c246cf Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Mon, 29 Jan 2018 10:43:03 +0530 Subject: [PATCH] CRM-21721, fixed notice error for Division by zero ---------------------------------------- * CRM-21721: Notice : Division by zero https://issues.civicrm.org/jira/browse/CRM-21721 --- CRM/Contribute/BAO/Contribution.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index b4fe8f809a..b7fdedacbb 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -5692,7 +5692,10 @@ LIMIT 1;"; * */ public static function createProportionalEntry($entityParams, $eftParams) { - $paid = $entityParams['line_item_amount'] * ($entityParams['trxn_total_amount'] / $entityParams['contribution_total_amount']); + $paid = 0; + if ($entityParams['contribution_total_amount'] != 0) { + $paid = $entityParams['line_item_amount'] * ($entityParams['trxn_total_amount'] / $entityParams['contribution_total_amount']); + } // Record Entity Financial Trxn; CRM-20145 $eftParams['amount'] = CRM_Contribute_BAO_Contribution_Utils::formatAmount($paid); civicrm_api3('EntityFinancialTrxn', 'create', $eftParams); -- 2.25.1