From: Pradeep Nayak Date: Tue, 12 Jan 2016 12:54:25 +0000 (+0530) Subject: CRM-16259, Updated working of Payment update API X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ebfaa5442f147a6b22158886d131c7f359b8243f;p=civicrm-core.git CRM-16259, Updated working of Payment update API ---------------------------------------- * 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 e44de0544d..432585681b 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3647,7 +3647,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac * * @return null|object */ - public static function recordAdditionalPayment($contributionId, $trxnsData, $paymentType = 'owed', $participantId = NULL) { + public static function recordAdditionalPayment($contributionId, $trxnsData, $paymentType = 'owed', $participantId = NULL, $updateStatus = TRUE) { $statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name'); $getInfoOf['id'] = $contributionId; $defaults = array(); @@ -3761,8 +3761,9 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) // the reason because it performs 'status change' related code execution for financial records // which in 'Pending Refund' => 'Completed' is not useful, instead specific financial record updates // are coded below i.e. just updating financial_item status to 'Paid' - $contributionDetails = CRM_Core_DAO::setFieldValue('CRM_Contribute_BAO_Contribution', $contributionId, 'contribution_status_id', $statusId); - + if ($updateStatus) { + $contributionDetails = CRM_Core_DAO::setFieldValue('CRM_Contribute_BAO_Contribution', $contributionId, 'contribution_status_id', $statusId); + } // add financial item entry $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id'); $getLine['entity_id'] = $contributionDAO->id;