From dea99e05a97d1637b4676585848c04155eec7da3 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Mon, 11 Jan 2016 15:56:32 +0530 Subject: [PATCH] CRM-16259, used api calling instead save() ---------------------------------------- * CRM-16259: Create Payment API https://issues.civicrm.org/jira/browse/CRM-16259 --- CRM/Contribute/BAO/Contribution.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 2f1d68e2ee..2b2cd77dbc 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4751,18 +4751,18 @@ LIMIT 1;"; while ($dao->fetch()) { $ftIds[$dao->price_field_value_id] = $dao->id; } + + $params = array( + 'entity_table' => 'civicrm_financial_item', + 'financial_trxn_id' => $ftId, + ); foreach ($lineItems as $key => $value) { $paid = $value['line_total'] * ($contribution->net_amount / $contribution->total_amount); // Record Entity Financial Trxn - $params = array( - 'entity_table' => 'civicrm_financial_item', - 'financial_trxn_id' => $ftId, - 'amount' => $paid, - 'entity_id' => $ftIds[$value['price_field_value_id']], - ); - $entityTrxn = new CRM_Financial_DAO_EntityFinancialTrxn(); - $entityTrxn->copyValues($params); - $entityTrxn->save(); + $params['amount'] = $paid; + $params['entity_id'] = $ftIds[$value['price_field_value_id']]; + + civicrm_api3('EntityFinancialTrxn', 'create', $params); } } } -- 2.25.1