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
*
// 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;
}
* @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.
}
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)) {
$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();