From: Pradeep Nayak Date: Tue, 12 Jan 2016 11:03:45 +0000 (+0530) Subject: CRM-16259, used api calling instead save() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3e00a301f16732dc4f2f9df46107c7e696ba2b6a;p=civicrm-core.git CRM-16259, used api calling instead save() ---------------------------------------- * CRM-16259: Create Payment API https://issues.civicrm.org/jira/browse/CRM-16259 --- diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 614caeddac..363da16585 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4799,18 +4799,17 @@ LIMIT 1;"; while ($dao->fetch()) { $ftIds[$dao->price_field_value_id] = $dao->id; } + $eftParams = array( + 'entity_table' => 'civicrm_financial_item', + 'financial_trxn_id' => $trxn->id, + ); foreach ($lineItems as $key => $value) { $paid = $value['line_total'] * ($params['total_amount'] / $contribution['total_amount']); // Record Entity Financial Trxn - $eftParams = array( - 'entity_table' => 'civicrm_financial_item', - 'financial_trxn_id' => $trxn->id, - 'amount' => $paid, - 'entity_id' => $ftIds[$value['price_field_value_id']], - ); - $entityTrxn = new CRM_Financial_DAO_EntityFinancialTrxn(); - $entityTrxn->copyValues($eftParams); - $entityTrxn->save(); + $eftParams['amount'] = $paid; + $eftParams['entity_id'] = $ftIds[$value['price_field_value_id']]; + + civicrm_api3('EntityFinancialTrxn', 'create', $eftParams); } } }