From: kurund Date: Fri, 14 Mar 2014 07:23:51 +0000 (+0530) Subject: waiting list signup fixes, CRM-14225 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=16d1c8e23a1045919839c8d52999cde4fbd2f4bb;p=civicrm-core.git waiting list signup fixes, CRM-14225 ---------------------------------------- * CRM-14225: Waitlist signup not working for full paid events http://issues.civicrm.org/jira/browse/CRM-14225 --- diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 306a5bee07..a20c29aeca 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -71,6 +71,11 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { public $_ppType; public $_snippet; + /** + * @var boolean determines if fee block should be shown or hidden + */ + public $_noFees; + /** * Function to set variables up before form is built * @@ -89,8 +94,8 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // 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); + $this->_noFees = (($eventFull || $this->_requireApproval) && !$this->_allowConfirmation); + CRM_Contribute_Form_Contribution_Main::preProcessPaymentOptions($this, $this->_noFees); if ($this->_snippet) { return; } @@ -542,6 +547,12 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { * @static */ static public function buildAmount(&$form, $required = TRUE, $discountId = NULL) { + // build amount only when needed, skip incase of event full and waitlisting is enabled + // and few other conditions check preProcess() + if ($form->_noFees) { + return; + } + //if payment done, no need to build the fee block. if (!empty($form->_paymentId)) { //fix to diaplay line item in update mode. @@ -840,7 +851,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } if ($self->_values['event']['is_monetary']) { - if (empty($self->_requireApproval) && $fields['amount'] > 0 && !isset($fields['payment_processor'])) { + if (empty($self->_requireApproval) && !empty($fields['amount']) && $fields['amount'] > 0 && !isset($fields['payment_processor'])) { $errors['payment_processor'] = ts('Please select a Payment Method'); } if (is_array($self->_paymentProcessor)) { @@ -1038,8 +1049,13 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $params['amount'] = $this->_values['discount'][$discountId][$params['amount']]['value']; } elseif (empty($params['priceSetId'])) { - $params['amount_level'] = $this->_values['fee'][$params['amount']]['label']; - $params['amount'] = $this->_values['fee'][$params['amount']]['value']; + if (!empty($params['amount'])) { + $params['amount_level'] = $this->_values['fee'][$params['amount']]['label']; + $params['amount'] = $this->_values['fee'][$params['amount']]['value']; + } + else { + $params['amount_level'] = $params['amount'] = ''; + } } else { $lineItem = array();