TRUE
);
$this->addRule("email-{$this->_bltID}", ts('Email is not valid.'), 'email');
- $this->_paymentProcessors = $this->get('paymentProcessors');
$pps = array();
if (!empty($this->_paymentProcessors)) {
$pps = $this->_paymentProcessors;
* Handle Payment Processor switching
* For contribution and event registration forms
*/
- static function preProcessPaymentOptions(&$form) {
+ static function preProcessPaymentOptions(&$form, $noFees = FALSE) {
$form->_snippet = CRM_Utils_Array::value('snippet', $_GET);
$form->assign('snippet', $form->_snippet);
- $paymentProcessors = $form->get('paymentProcessors');
+ $form->_paymentProcessors = $noFees ? array() : $form->get('paymentProcessors');
$form->_ppType = NULL;
- if ($paymentProcessors) {
+ if ($form->_paymentProcessors) {
// Fetch type during ajax request
if (isset($_GET['type']) && $form->_snippet) {
$form->_ppType = $_GET['type'];
// Remember type during form post
elseif (!empty($form->_submitValues)) {
$form->_ppType = CRM_Utils_Array::value('payment_processor', $form->_submitValues);
- $form->_paymentProcessor = CRM_Utils_Array::value($form->_ppType, $paymentProcessors);
+ $form->_paymentProcessor = CRM_Utils_Array::value($form->_ppType, $form->_paymentProcessors);
$form->set('type', $form->_ppType);
$form->set('mode', $form->_mode);
$form->set('paymentProcessor', $form->_paymentProcessor);
}
// Set default payment processor
else {
- foreach ($paymentProcessors as $values) {
- if (!empty($values['is_default']) || count($paymentProcessors) == 1) {
+ foreach ($form->_paymentProcessors as $values) {
+ if (!empty($values['is_default']) || count($form->_paymentProcessors) == 1) {
$form->_ppType = $values['id'];
break;
}
}
//get payPal express id and make it available to template
- foreach ($paymentProcessors as $ppId => $values) {
+ foreach ($form->_paymentProcessors as $ppId => $values) {
$payPalExpressId = ($values['payment_processor_type'] == 'PayPal_Express') ? $values['id'] : 0;
$form->assign('payPalExpressId', $payPalExpressId);
if ($payPalExpressId) {
function preProcess() {
parent::preProcess();
- CRM_Contribute_Form_Contribution_Main::preProcessPaymentOptions($this);
- if ($this->_snippet) {
- return;
- }
-
//CRM-4320.
//here we can't use parent $this->_allowWaitlist as user might
//walk back and we maight set this value in this postProcess.
//(we set when spaces < group count and want to allow become part of waiting )
-
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $this->_values['event']));
+ // Get payment processors if appropriate for this event
+ // We hide the payment fields if the event is full or requires approval,
+ // and the current user has not yet been approved CRM-12279
+ $noFees = (($eventFull || $this->_requireApproval) && !$this->_allowConfirmation);
+ CRM_Contribute_Form_Contribution_Main::preProcessPaymentOptions($this, $noFees);
+ if ($this->_snippet) {
+ return;
+ }
+
$this->_allowWaitlist = FALSE;
if ($eventFull && !$this->_allowConfirmation &&
CRM_Utils_Array::value('has_waitlist', $this->_values['event'])
}
$pps = NULL;
- $this->_paymentProcessors = $this->get('paymentProcessors');
if (!empty($this->_paymentProcessors)) {
$pps = $this->_paymentProcessors;
foreach ($pps as $key => & $name) {