From: Pradeep Nayak Date: Mon, 29 Jan 2018 05:13:03 +0000 (+0530) Subject: CRM-21721, fixed notice error for Division by zero X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ea8f914c40bd2b1df65e5ce176c10dadb9c246cf;p=civicrm-core.git CRM-21721, fixed notice error for Division by zero ---------------------------------------- * CRM-21721: Notice : Division by zero https://issues.civicrm.org/jira/browse/CRM-21721 --- 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);