// 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,
// (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