From: monishdeb Date: Tue, 16 Jun 2015 07:19:39 +0000 (+0530) Subject: CRM-16611 fix - Fatal error on batch processing membership when Payment status =... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=14b74ca63305b13e0f53c85f6011e3bdd32c9988;p=civicrm-core.git CRM-16611 fix - Fatal error on batch processing membership when Payment status = Pending https://issues.civicrm.org/jira/browse/CRM-16611 --- diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 062d8ab24f..a4ab84a2a4 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2736,7 +2736,7 @@ WHERE contribution_id = %1 "; if (!empty($params['payment_processor'])) { $balanceTrxnParams['payment_processor_id'] = $params['payment_processor']; } - CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams); + $financialTxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams); } } @@ -2927,8 +2927,9 @@ WHERE contribution_id = %1 "; CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $update); } - // create batch entry if batch_id is passed - if (!empty($params['batch_id'])) { + // create batch entry if batch_id is passed and + // ensure no batch entry is been made on 'Pending' or 'Failed' contribution, CRM-16611 + if (!empty($params['batch_id']) && !empty($financialTxn)) { $entityParams = array( 'batch_id' => $params['batch_id'], 'entity_table' => 'civicrm_financial_trxn',