/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::UPDATE) { $bookingStatus = CRM_Booking_BAO_Booking::buildOptions('status_id', 'create'); if ($this->_values['status_id'] == $this->_cancelStatusId) { $this->assign('cancel_status_id', $this->_cancelStatusId); $this->add('hidden', 'booking_status', $this->_values['status_id']); } else { unset($bookingStatus[$this->_cancelStatusId]); //remove cancelled option $this->add('select', 'booking_status', ts('Booking status'), array('' => ts('- select -')) + $bookingStatus, TRUE, array()); } } $this->addFormRule(array('CRM_Booking_Form_Booking_Update', 'formRule'), $this); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { parent::buildQuickForm(); $this->addDate('cancellation_date', ts('Date of Cancellation'), TRUE, array('formatType' => 'activityDate')); $this->add('hidden', 'booking_total', ts('Booking Amount'), array('disabled' => 'disabled')); $result = civicrm_api('OptionValue', 'get', array('version' => 3, 'option_group_name' => 'booking_cancellation_charges')); $cancellationCharges = array(); foreach ($result['values'] as $key => $ov) { $cancellationCharges[$ov['value']] = $ov['label']; } $this->add('select', 'cancellations', ts('Cancellation %'), array('' => ts('- select -')) + $cancellationCharges, TRUE, array()); $this->add('hidden', 'cancellation_charge', ts('Cancellation Charge'), array('disabled' => 'disabled')); $this->add('text', 'adjustment', ts('Additional Charges')); $this->add('textarea', 'comment', ts('Charge Comment')); $this->add('text', 'charge_amount', ts('Amount to Pay'), array('disabled' => 'disabled')); $this->addFormRule(array('CRM_Booking_Form_Booking_Cancel', 'formRule'), $this); }
function buildQuickForm() { parent::buildQuickForm(); $this->addEntityRef("primary_contact_id", ts('Primary contact'), array('create' => TRUE), TRUE); $this->addEntityRef("secondary_contact_id", ts('Secondary contact'), array('create' => TRUE)); $this->add('text', 'po_no', ts('Purchase order number')); $bookingStatus = CRM_Booking_BAO_Booking::buildOptions('status_id', 'create'); $result = civicrm_api3('OptionValue', 'get', array('option_group_name' => CRM_Booking_Utils_Constants::OPTION_BOOKING_STATUS, 'name' => CRM_Booking_Utils_Constants::OPTION_VALUE_CANCELLED)); $this->_cancelStatusId = CRM_Utils_Array::value('value', CRM_Utils_Array::value($result['id'], $result['values'])); unset($bookingStatus[$this->_cancelStatusId]); $this->add('select', 'booking_status', ts('Booking status'), array('' => ts('- select -')) + $bookingStatus, TRUE, array()); $this->add('text', 'title', ts('Title'), array('size' => 80, 'maxlength' => 255), TRUE); $this->addDate('event_start_date', ts('Date booking made'), TRUE, array('formatType' => 'activityDateTime')); $this->add('textarea', 'description', ts('Description')); $this->add('textarea', 'note', ts('Note')); $this->add('text', 'enp', ts('Estimate number of participants')); $this->add('text', 'fnp', ts('Final number of participants')); $this->addElement('hidden', "resources"); $buttons = array(array('type' => 'back', 'name' => ts('<< Back')), array('type' => 'submit', 'name' => ts('Complete and Save'))); $this->addButtons($buttons); $this->addFormRule(array('CRM_Booking_Form_Booking_Info', 'formRule'), $this); }