* @var int
* @const
*/
- CONST LOCATION_BLOCKS = 1;
+ const LOCATION_BLOCKS = 1;
/**
* The id of the event we are proceessing
*
* @var int
- * @protected
*/
public $_eventId;
* The array of ids of all the participant we are proceessing
*
* @var int
- * @protected
*/
protected $_participantIDS = NULL;
* The id of the participant we are proceessing
*
* @var int
- * @protected
*/
protected $_participantId;
* Is participant able to walk registration wizard.
*
* @var Boolean
- * @protected
*/
public $_allowConfirmation;
* Is participant requires approval
*
* @var Boolean
- * @public
*/
public $_requireApproval;
* Is event configured for waitlist.
*
* @var Boolean
- * @public
*/
public $_allowWaitlist;
* when there are pre-registered.
*
* @var array
- * @public
*/
public $_additionalParticipantIds;
* The values for the contribution db object
*
* @var array
- * @protected
*/
public $_values;
* The paymentProcessor attributes for this page
*
* @var array
- * @protected
*/
public $_paymentProcessor;
* The params submitted by the form and computed by the app
*
* @var array
- * @protected
*/
protected $_params;
* The fields involved in this contribution page
*
* @var array
- * @protected
*/
public $_fields;
* The billing location id for this contribiution page
*
* @var int
- * @protected
*/
public $_bltID;
* Price Set ID, if the new price set method is used
*
* @var int
- * @protected
*/
public $_priceSetId = NULL;
* Array of fields for the price set
*
* @var array
- * @protected
*/
public $_priceSet;
/* Is event already full.
*
* @var boolean
- * @protected
*/
public $_isEventFull;
* Set variables up before form is built
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
);
list($this->_values['custom_pre_id'],
$this->_values['custom_post_id']
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
// set profiles for additional participants
if ($this->_values['event']['is_multiple_registrations']) {
list($this->_values['additional_custom_pre_id'],
$this->_values['additional_custom_post_id'], $preActive, $postActive
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
// CRM-4377: we need to maintain backward compatibility, hence if there is profile for main contact
// set same profile for additional contacts.
// Handle PCP
$pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this);
if ($pcpId) {
- $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'event', $this->_values['event']);
- $this->_pcpId = $pcp['pcpId'];
+ $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'event', $this->_values['event']);
+ $this->_pcpId = $pcp['pcpId'];
$this->_values['event']['intro_text'] = CRM_Utils_Array::value('intro_text', $pcp['pcpInfo']);
}
* Assign the minimal set of variables to the template
*
* @return void
- * @access public
*/
- function assignToTemplate() {
+ public function assignToTemplate() {
//process only primary participant params
$this->_params = $this->get('params');
if (isset($this->_params[0])) {
$this->set('name', $name);
$vars = array(
- 'amount', 'currencyID', 'credit_card_type',
- 'trxn_id', 'amount_level', 'receive_date',
+ 'amount',
+ 'currencyID',
+ 'credit_card_type',
+ 'trxn_id',
+ 'amount_level',
+ 'receive_date',
);
foreach ($vars as $v) {
* @param bool $viewOnly
*
* @return void
- * @access public
*/
- function buildCustom($id, $name, $viewOnly = FALSE) {
+ public function buildCustom($id, $name, $viewOnly = FALSE) {
if ($id) {
- $button = substr($this->controller->getButtonName(), -4);
- $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
- $session = CRM_Core_Session::singleton();
+ $button = substr($this->controller->getButtonName(), -4);
+ $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
+ $session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
// we don't allow conflicting fields to be
$field['is_required'] = FALSE;
}
// CRM-11316 Is ReCAPTCHA enabled for this profile AND is this an anonymous visitor
- elseif ($field['add_captcha'] && !$contactID) {
+ elseif ($field['add_captcha'] && !$contactID) {
// only add captcha for first page
$addCaptcha = TRUE;
}
*
* @throws Exception
*/
- static function initEventFee(&$form, $eventID) {
+ public static function initEventFee(&$form, $eventID) {
// get price info
// retrive all active price set fields.
}
if (property_exists($form, '_context') && ($form->_context == 'standalone'
- || $form->_context == 'participant')) {
+ || $form->_context == 'participant')
+ ) {
$discountedEvent = CRM_Core_BAO_Discount::getOptionGroup($eventID, 'civicrm_event');
- if (is_array( $discountedEvent)) {
+ if (is_array($discountedEvent)) {
foreach ($discountedEvent as $key => $priceSetId) {
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId);
$priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
* @param null $payment
*
* @return void
- * @access public
*/
- function confirmPostProcess($contactID = NULL, $contribution = NULL, $payment = NULL) {
+ public function confirmPostProcess($contactID = NULL, $contribution = NULL, $payment = NULL) {
// add/update contact information
$fields = array();
unset($this->_params['note']);
$this->_params['contactID'] = $contactID;
if (array_key_exists('email-5', $this->_params)) {
- $mail = 'email-5';
- } else {
+ $mail = 'email-5';
+ }
+ else {
foreach ($this->_params as $name => $dontCare) {
if (substr($name, 0, 5) == 'email') {
$mail = $name;
// 3. waiting list participant.
// 4. require approval participant.
if (!empty($this->_params['is_pay_later']) ||
- $this->_allowWaitlist || $this->_requireApproval || empty($this->_values['event']['is_monetary'])) {
+ $this->_allowWaitlist || $this->_requireApproval || empty($this->_values['event']['is_monetary'])
+ ) {
$mail = 'email-Primary';
}
/**
* Process the participant
*
- * @param array $params
+ * @param CRM_Core_Form $form
* @param int $contactID
- *
- * @return void
- * @access public
+ * @return \CRM_Event_BAO_Participant
*/
public static function addParticipant(&$form, $contactID) {
if (empty($form->_params)) {
}
$participantFields = CRM_Event_DAO_Participant::fields();
- $participantParams = array('id' => CRM_Utils_Array::value('participant_id', $params),
+ $participantParams = array(
+ 'id' => CRM_Utils_Array::value('participant_id', $params),
'contact_id' => $contactID,
'event_id' => $form->_eventId ? $form->_eventId : $params['event_id'],
'status_id' => CRM_Utils_Array::value('participant_status',
/* Calculate the total participant count as per params.
*
- * @param array $params user params.
+ * @param array $params
+ * User params.
*
* @return $totalCount total participant count.
- * @access public
*/
/**
* @param CRM_Core_Form $form
return $totalCount;
}
- $priceSetId = $form->get('priceSetId');
- $addParticipantNum = substr($form->_name, 12);
- $priceSetFields = $priceSetDetails = array();
+ $priceSetId = $form->get('priceSetId');
+ $addParticipantNum = substr($form->_name, 12);
+ $priceSetFields = $priceSetDetails = array();
$hasPriceFieldsCount = FALSE;
if ($priceSetId) {
$priceSetDetails = $form->get('priceSet');
/* Format user submitted price set params.
* Convert price set each param as an array.
*
- * @param $params an array of user submitted params.
+ * @param array $params
+ * An array of user submitted params.
*
*
- * @return array $formatted, formatted price set params.
- * @access public
+ * @return array
+ * , formatted price set params.
*/
/**
* @param CRM_Core_Form $form
/* Calculate total count for each price set options.
* those are currently selected by user.
*
- * @param $form form object.
+ * @param $form
+ * Form object.
*
*
- * @return array $optionsCount, array of each option w/ count total.
- * @access public
+ * @return array
+ * , array of each option w/ count total.
*/
/**
* @param $form
* @return array
*/
public static function getPriceSetOptionCount(&$form) {
- $params = $form->get('params');
- $priceSet = $form->get('priceSet');
+ $params = $form->get('params');
+ $priceSet = $form->get('priceSet');
$priceSetId = $form->get('priceSetId');
$optionsCount = array();
$addParticipantNum = substr($form->_name, 12);
foreach ($params as $pCnt => $values) {
if ($values == 'skip' ||
- $pCnt == $addParticipantNum
+ $pCnt === $addParticipantNum
) {
continue;
}
*
* @return null|string
*/
- function checkTemplateFileExists($suffix = '') {
+ public function checkTemplateFileExists($suffix = '') {
if ($this->_eventId) {
$templateName = $this->_name;
if (substr($templateName, 0, 12) == 'Participant_') {
/**
* @return null|string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
return $fileName ? $fileName : parent::getTemplateFileName();
}
/**
* @return null|string
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
/**
* Validate price set submitted params for price option limit,
* as well as user should select at least one price field option.
- * @param unknown_type $form
- * @param unknown_type $params
- * @return multitype:|Ambigous <multitype:, string, string>
+ *
+ * @param CRM_Core_Form $form
+ * @param array $params
+ *
+ * @return array
*/
- static function validatePriceSet(&$form, $params) {
+ public static function validatePriceSet(&$form, $params) {
$errors = array();
$hasOptMaxValue = FALSE;
if (!is_array($params) || empty($params)) {
$opDbCount = CRM_Utils_Array::value('db_total_count', $options[$optId], 0);
$total += $opDbCount;
if ($optMax && $total > $optMax) {
+ $errors['soldOutOptions'][] = ts('Option %1 has sold out.', array(1 => $feeBlock[$fieldId]['options'][$optId]['label']));
if ($opDbCount && ($opDbCount >= $optMax)) {
$errors[$currentParticipantNum]["price_{$fieldId}"] =
ts('Sorry, this option is currently sold out.');
return $errors;
}
- // set the first participant ID if not set, CRM-10032
/**
+ * set the first participant ID if not set, CRM-10032
+ *
* @param int $participantID
*/
- function processFirstParticipant($participantID) {
+ public function processFirstParticipant($participantID) {
$this->_participantId = $participantID;
$this->set('participantId', $this->_participantId);
// also set the allow confirmation stuff
if (array_key_exists(
- $this->_values['participant']['status_id'],
- CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'")
- )) {
+ $this->_values['participant']['status_id'],
+ CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'")
+ )) {
$this->_allowConfirmation = TRUE;
$this->set('allowConfirmation', TRUE);
}
*
* @param string $redirect
*/
- function checkValidEvent($redirect = NULL) {
+ public function checkValidEvent($redirect = NULL) {
// is the event active (enabled)?
if (!$this->_values['event']['is_active']) {
// form is inactive, die a fatal death
$now = date('YmdHis');
$startDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('registration_start_date',
- $this->_values['event']
- ));
+ $this->_values['event']
+ ));
if (
$startDate &&
}
$endDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('registration_end_date',
- $this->_values['event']
- ));
+ $this->_values['event']
+ ));
$eventEndDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('event_end_date', $this->_values['event']));
if (
$endDate &&
}
}
}
-