----------------------------------------
* CRM-21721: Notice : Division by zero
https://issues.civicrm.org/jira/browse/CRM-21721
*
*/
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);