CRM-16259, used api calling instead save()
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 12 Jan 2016 11:03:45 +0000 (16:33 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Wed, 20 Jan 2016 21:31:40 +0000 (03:01 +0530)
----------------------------------------
* CRM-16259: Create Payment API
  https://issues.civicrm.org/jira/browse/CRM-16259

CRM/Contribute/BAO/Contribution.php

index 614caeddac36db5f2fba6ab02b371d033396b4ab..363da165855f06a731b7f5d4e1c39b457485e91f 100644 (file)
@@ -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);
       }
     }
   }