From 036c63158654f84d0dab573bd3f944e117679268 Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Thu, 17 Mar 2016 23:01:45 +0530 Subject: [PATCH] CRM-18071 fix minor fix style fix style fix --- CRM/Contribute/Form/Contribution/Confirm.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 8a6db269bb..96cee5ea16 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1592,6 +1592,18 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // This feels like a bizarre hack as the variable name doesn't seem to be directly connected to it's use in the template. $emailValues['useForMember'] = 0; $emailValues['amount'] = 0; + + //CRM-18071, where on selecting $0 free membership payment section got hidden and + // also it reset any payment processor selection result into pending free membership + // so its a kind of hack to complete free membership at this point since there is no $form->_paymentProcessor info + if (empty($form->_params['is_pay_later']) && !empty($membershipContribution) && !is_a($membershipContribution, 'CRM_Core_Error')) { + $paymentProcessorIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('payment_processor', $this->_values)); + if (empty($form->_paymentProcessor) && !empty($paymentProcessorIDs)) { + $this->_paymentProcessor['id'] = $paymentProcessorIDs[0]; + } + $result = array('payment_status_id' => 1, 'contribution' => $membershipContribution); + $this->completeTransaction($result, $result['contribution']->id); + } } CRM_Contribute_BAO_ContributionPage::sendMail($contactID, @@ -1910,7 +1922,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // (note it might make sense to make this a row in the processor table in the db). $this->_params['payment_processor_id'] = 0; } - if (isset($this->_params['payment_processor_id']) && $this->_params['payment_processor_id'] == 0) { + if (isset($this->_params['payment_processor_id']) && $this->_params['payment_processor_id'] === 0) { $this->_params['is_pay_later'] = $isPayLater = TRUE; } // add a description field at the very beginning -- 2.25.1