3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
20 * This class generates form components for processing Event.
22 class CRM_Event_Form_Registration_AdditionalParticipant
extends CRM_Event_Form_Registration
{
25 * Pre-registered additional participant id.
28 public $additionalParticipantId = NULL;
31 * Get the active UFGroups (profiles) on this form
32 * Many forms load one or more UFGroups (profiles).
33 * This provides a standard function to retrieve the IDs of those profiles from the form
34 * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
36 * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
40 public function getUFGroupIDs() {
42 foreach (['pre', 'post'] as $keys) {
43 if (isset($this->_values
['additional_custom_' . $keys . '_id'])) {
44 $ufGroupIDs[] = $this->_values
['additional_custom_' . $keys . '_id'];
51 * Set variables up before form is built.
55 public function preProcess() {
58 $participantNo = substr($this->_name
, 12);
60 //lets process in-queue participants.
61 if ($this->_participantId
&& $this->_additionalParticipantIds
) {
62 $this->_additionalParticipantId
= $this->_additionalParticipantIds
[$participantNo] ??
NULL;
65 $participantCnt = $participantNo +
1;
66 $this->assign('formId', $participantNo);
68 $this->_params
= $this->get('params');
70 $participantTot = $this->_params
[0]['additional_participants'] +
1;
71 $skipCount = count(array_keys($this->_params
, "skip"));
73 $this->assign('skipCount', $skipCount);
75 $this->setTitle(ts('Register Participant %1 of %2', [1 => $participantCnt, 2 => $participantTot]));
77 //CRM-4320, hack to check last participant.
78 $this->_lastParticipant
= FALSE;
79 if ($participantTot == $participantCnt) {
80 $this->_lastParticipant
= TRUE;
82 $this->assign('lastParticipant', $this->_lastParticipant
);
86 * Set default values for the form. For edit/view mode
87 * the default values are retrieved from the database
92 public function setDefaultValues() {
93 $defaults = $unsetSubmittedOptions = [];
95 //fix for CRM-3088, default value for discount set.
96 if (!empty($this->_values
['discount'])) {
97 $discountId = CRM_Core_BAO_Discount
::findSet($this->_eventId
, 'civicrm_event');
98 if ($discountId && !empty($this->_values
['event']['default_discount_fee_id'])) {
99 $discountKey = CRM_Core_DAO
::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values
['event']['default_discount_fee_id'], 'weight', 'id'
101 $defaults['amount'] = key(array_slice($this->_values
['discount'][$discountId], $discountKey - 1, $discountKey, TRUE));
104 if ($this->_priceSetId
) {
105 foreach ($this->_feeBlock
as $key => $val) {
106 if (empty($val['options'])) {
110 $optionsFull = CRM_Utils_Array
::value('option_full_ids', $val, []);
111 foreach ($val['options'] as $keys => $values) {
112 if ($values['is_default'] && !in_array($keys, $optionsFull)) {
113 if ($val['html_type'] == 'CheckBox') {
114 $defaults["price_{$key}"][$keys] = 1;
117 $defaults["price_{$key}"] = $keys;
121 if (!empty($optionsFull)) {
122 $unsetSubmittedOptions[$val['id']] = $optionsFull;
127 //CRM-4320, setdefault additional participant values.
128 if ($this->_allowConfirmation
&& $this->_additionalParticipantId
) {
129 //hack to get set default from eventFees.php
130 $this->_discountId
= $discountId;
131 $this->_pId
= $this->_additionalParticipantId
;
132 $this->_contactId
= CRM_Core_DAO
::getFieldValue('CRM_Event_DAO_Participant', $this->_additionalParticipantId
, 'contact_id');
134 CRM_Event_BAO_Participant
::formatFieldsAndSetProfileDefaults($this->_contactId
, $this);
135 $participantDefaults = CRM_Event_Form_EventFees
::setDefaultValues($this);
136 $participantDefaults = array_merge($this->_defaults
, $participantDefaults);
137 // use primary email address if billing email address is empty
138 if (empty($this->_defaults
["email-{$this->_bltID}"]) &&
139 !empty($this->_defaults
["email-Primary"])
141 $participantDefaults["email-{$this->_bltID}"] = $this->_defaults
["email-Primary"];
143 $defaults = array_merge($defaults, $participantDefaults);
146 $defaults = array_merge($this->_defaults
, $defaults);
148 //reset values for all options those are full.
149 CRM_Event_Form_Registration
::resetElementValue($unsetSubmittedOptions, $this);
151 //load default campaign from page.
152 if (array_key_exists('participant_campaign_id', $this->_fields
)) {
153 $defaults['participant_campaign_id'] = $this->_values
['event']['campaign_id'] ??
NULL;
156 //CRM-17865 set custom field defaults
157 if (!empty($this->_fields
)) {
158 foreach ($this->_fields
as $name => $field) {
159 if ($customFieldID = CRM_Core_BAO_CustomField
::getKeyID($name)) {
160 if (!isset($defaults[$name])) {
161 CRM_Core_BAO_CustomField
::setProfileDefaults($customFieldID, $name, $defaults,
162 NULL, CRM_Profile_Form
::MODE_REGISTER
173 * Build the form object.
177 public function buildQuickForm() {
179 $button = substr($this->controller
->getButtonName(), -4);
181 if ($this->_values
['event']['is_monetary']) {
182 CRM_Event_Form_Registration_Register
::buildAmount($this);
185 //Add pre and post profiles on the form.
186 foreach (['pre', 'post'] as $keys) {
187 if (isset($this->_values
['additional_custom_' . $keys . '_id'])) {
188 $this->buildCustom($this->_values
['additional_custom_' . $keys . '_id'], 'additionalCustom' . ucfirst($keys));
193 if ($this->isLastParticipant(TRUE) && empty($this->_values
['event']['is_monetary'])) {
194 $this->submitOnce
= TRUE;
197 //handle case where user might sart with waiting by group
198 //registration and skip some people and now group fit to
199 //become registered so need to take payment from user.
200 //this case only occurs at dynamic waiting status, CRM-4320
201 $statusMessage = NULL;
202 $allowToProceed = TRUE;
203 $includeSkipButton = TRUE;
204 $this->_resetAllowWaitlist
= FALSE;
206 $pricesetFieldsCount = CRM_Price_BAO_PriceSet
::getPricesetCount($this->_priceSetId
);
208 if ($this->_lastParticipant ||
$pricesetFieldsCount) {
209 //get the participant total.
210 $processedCnt = self
::getParticipantCount($this, $this->_params
, TRUE);
213 if (!$this->_allowConfirmation
&& !empty($this->_params
[0]['bypass_payment']) &&
214 $this->_lastParticipant
217 //get the event spaces.
218 $spaces = $this->_availableRegistrations
;
220 $currentPageMaxCount = 1;
221 if ($pricesetFieldsCount) {
222 $currentPageMaxCount = $pricesetFieldsCount;
225 //we might did reset allow waiting in case of dynamic calculation
226 // @TODO - does this bypass_payment still exist?
227 if (!empty($this->_params
[0]['bypass_payment']) &&
228 is_numeric($spaces) &&
229 $processedCnt > $spaces
231 $this->_allowWaitlist
= TRUE;
232 $this->set('allowWaitlist', TRUE);
235 //lets allow to become a part of runtime waiting list, if primary selected pay later.
236 $realPayLater = FALSE;
237 if (!empty($this->_values
['event']['is_monetary']) && !empty($this->_values
['event']['is_pay_later'])) {
238 $realPayLater = $this->_params
[0]['is_pay_later'] ??
NULL;
241 //truly spaces are greater than required.
242 if (is_numeric($spaces) && $spaces >= ($processedCnt +
$currentPageMaxCount)) {
243 if (CRM_Utils_Array
::value('amount', $this->_params
[0], 0) == 0 ||
$this->_requireApproval
) {
244 $this->_allowWaitlist
= FALSE;
245 $this->set('allowWaitlist', $this->_allowWaitlist
);
246 if ($this->_requireApproval
) {
247 $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", [
248 1 => ++
$processedCnt,
253 $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", [
254 1 => ++
$processedCnt,
260 $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", [
261 1 => ++
$processedCnt,
264 $allowToProceed = FALSE;
266 CRM_Core_Session
::setStatus($statusMessage, ts('Registration Error'), 'error');
268 elseif ($processedCnt == $spaces) {
269 if (CRM_Utils_Array
::value('amount', $this->_params
[0], 0) == 0
270 ||
$realPayLater ||
$this->_requireApproval
272 $this->_resetAllowWaitlist
= TRUE;
273 if ($this->_requireApproval
) {
274 $statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.");
277 $statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed).");
281 //hey there is enough space and we require payment.
282 $statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.");
283 $includeSkipButton = FALSE;
288 // for priceset with count
289 if ($pricesetFieldsCount && !empty($this->_values
['event']['has_waitlist']) &&
290 !$this->_allowConfirmation
293 if ($this->_isEventFull
) {
294 $statusMessage = ts('This event is currently full. You are registering for the waiting list. You will be notified if spaces become available.');
296 elseif ($this->_allowWaitlist ||
297 (!$this->_allowWaitlist
&& ($processedCnt +
$pricesetFieldsCount) > $this->_availableRegistrations
)
300 $waitingMsg = ts('It looks like you are registering more participants then there are spaces available. All participants will be added to the waiting list. You will be notified if spaces become available.');
301 $confirmedMsg = ts('It looks like there are enough spaces in this event for your group (you will not be wait listed).');
302 if ($this->_requireApproval
) {
303 $waitingMsg = ts('It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.');
304 $confirmedMsg = ts('It looks there are enough spaces in this event for your group (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.');
307 $this->assign('waitingMsg', $waitingMsg);
308 $this->assign('confirmedMsg', $confirmedMsg);
310 $this->assign('availableRegistrations', $this->_availableRegistrations
);
311 $this->assign('currentParticipantCount', $processedCnt);
312 $this->assign('allowGroupOnWaitlist', TRUE);
314 $paymentBypassed = NULL;
315 if (!empty($this->_params
[0]['bypass_payment']) &&
316 !$this->_allowWaitlist
&&
318 !$this->_requireApproval
&&
319 !(CRM_Utils_Array
::value('amount', $this->_params
[0], 0) == 0)
321 $paymentBypassed = ts('Please go back to the main registration page, to complete payment information.');
323 $this->assign('paymentBypassed', $paymentBypassed);
327 $this->assign('statusMessage', $statusMessage);
332 'name' => ts('Go Back'),
333 'spacing' => '  ',
338 if ($allowToProceed) {
339 $buttons = array_merge($buttons, [
342 'name' => ts('Continue'),
343 'spacing' => ' ',
347 if ($includeSkipButton) {
348 $buttons = array_merge($buttons, [
351 'name' => ts('Skip Participant'),
353 'icon' => 'fa-fast-forward',
358 $this->addButtons($buttons);
359 $this->addFormRule(['CRM_Event_Form_Registration_AdditionalParticipant', 'formRule'], $this);
360 $this->unsavedChangesWarn
= TRUE;
366 * @param array $fields
367 * The input form values.
368 * @param array $files
369 * The uploaded files if any.
374 * true if no errors, else array of errors
376 public static function formRule($fields, $files, $self) {
378 //get the button name.
379 $button = substr($self->controller
->getButtonName(), -4);
381 $realPayLater = FALSE;
382 if (!empty($self->_values
['event']['is_monetary']) && !empty($self->_values
['event']['is_pay_later'])) {
383 $realPayLater = $self->_params
[0]['is_pay_later'] ??
NULL;
386 if ($button != 'skip') {
387 //Check that either an email or firstname+lastname is included in the form(CRM-9587)
388 CRM_Event_Form_Registration_Register
::checkProfileComplete($fields, $errors, $self->_eventId
);
390 //Additional Participant can also register for an event only once
391 $isRegistered = CRM_Event_Form_Registration_Register
::checkRegistration($fields, $self, TRUE);
393 if ($self->_values
['event']['allow_same_participant_emails']) {
394 $errors['_qf_default'] = ts('A person is already registered for this event.');
397 $errors["email-{$self->_bltID}"] = ts('A person with this email address is already registered for this event.');
401 //get the complete params.
402 $params = $self->get('params');
404 //take the participant instance.
405 $addParticipantNum = substr($self->_name
, 12);
407 if (is_array($params)) {
408 foreach ($params as $key => $value) {
409 if ($key != $addParticipantNum) {
410 if (!$self->_values
['event']['allow_same_participant_emails']) {
411 //collect all email fields
412 $existingEmails = [];
413 $additionalParticipantEmails = [];
414 if (is_array($value)) {
415 foreach ($value as $key => $val) {
416 if (substr($key, 0, 6) == 'email-' && $val) {
417 $existingEmails[] = $val;
421 foreach ($fields as $key => $val) {
422 if (substr($key, 0, 6) == 'email-' && $val) {
423 $additionalParticipantEmails[] = $val;
427 //check if any emails are common to both arrays
428 if (count(array_intersect($existingEmails, $additionalParticipantEmails))) {
429 $errors[$mailKey] = ts('The email address must be unique for each participant.');
434 // check with first_name and last_name for additional participants
435 if (!empty($value['first_name']) && ($value['first_name'] == CRM_Utils_Array
::value('first_name', $fields)) &&
436 (CRM_Utils_Array
::value('last_name', $value) == CRM_Utils_Array
::value('last_name', $fields))
438 $errors['first_name'] = ts('The first name and last name must be unique for each participant.');
446 //check for atleast one pricefields should be selected
447 if (!empty($fields['priceSetId'])) {
448 $allParticipantParams = $params;
450 //format current participant params.
451 $allParticipantParams[$addParticipantNum] = self
::formatPriceSetParams($self, $fields);
452 $totalParticipants = self
::getParticipantCount($self, $allParticipantParams);
454 //validate price field params.
455 $priceSetErrors = self
::validatePriceSet($self, $allParticipantParams);
456 $errors = array_merge($errors, CRM_Utils_Array
::value($addParticipantNum, $priceSetErrors, []));
458 if (!$self->_allowConfirmation
&&
459 is_numeric($self->_availableRegistrations
)
461 if (!empty($self->_params
[0]['bypass_payment']) &&
462 !$self->_allowWaitlist
&&
464 !$self->_requireApproval
&&
465 !(CRM_Utils_Array
::value('amount', $self->_params
[0], 0) == 0) &&
466 $totalParticipants < $self->_availableRegistrations
468 $errors['_qf_default'] = ts("Your event registration will be confirmed. Please go back to the main registration page, to complete payment information.");
470 //check for availability of registrations.
471 if (!$self->_allowConfirmation
&& empty($self->_values
['event']['has_waitlist']) &&
472 $totalParticipants > $self->_availableRegistrations
474 $errors['_qf_default'] = ts('Sorry, it looks like this event only has %2 spaces available, and you are trying to register %1 participants. Please change your selections accordingly.', [
475 1 => $totalParticipants,
476 2 => $self->_availableRegistrations
,
483 if ($button == 'skip' && $self->_lastParticipant
&& !empty($fields['priceSetId'])) {
484 $pricesetFieldsCount = CRM_Price_BAO_PriceSet
::getPricesetCount($fields['priceSetId']);
485 if (($pricesetFieldsCount < 1) ||
$self->_allowConfirmation
) {
489 if (!empty($self->_values
['event']['has_waitlist']) && !empty($self->_params
[0]['bypass_payment']) &&
490 !$self->_allowWaitlist
&&
492 !$self->_requireApproval
&&
493 !(CRM_Utils_Array
::value('amount', $self->_params
[0], 0) == 0)
495 $errors['_qf_default'] = ts("You are going to skip the last participant, your event registration will be confirmed. Please go back to the main registration page, to complete payment information.");
499 if ($button != 'skip' &&
500 $self->_values
['event']['is_monetary'] &&
501 !isset($errors['_qf_default']) &&
502 !$self->validatePaymentValues($self, $fields)
504 $errors['_qf_default'] = ts("Your payment information looks incomplete. Please go back to the main registration page, to complete payment information.");
505 $self->set('forcePayement', TRUE);
507 elseif ($button == 'skip') {
508 $self->set('forcePayement', TRUE);
520 public function validatePaymentValues($self, $fields) {
522 if (!empty($self->_params
[0]['bypass_payment']) ||
523 $self->_allowWaitlist ||
524 empty($self->_fields
) ||
525 CRM_Utils_Array
::value('amount', $self->_params
[0]) > 0
530 $validatePayement = FALSE;
531 if (!empty($fields['priceSetId'])) {
533 CRM_Price_BAO_PriceSet
::processAmount($self->_values
['fee'], $fields, $lineItem);
534 if ($fields['amount'] > 0) {
535 $validatePayement = TRUE;
539 elseif (!empty($fields['amount']) &&
540 (CRM_Utils_Array
::value('value', $self->_values
['fee'][$fields['amount']]) > 0)
542 $validatePayement = TRUE;
545 if (!$validatePayement) {
551 CRM_Core_Form
::validateMandatoryFields($self->_fields
, $fields, $errors);
553 if (isset($self->_params
[0]['payment_processor'])) {
554 // validate supplied payment instrument values (e.g. credit card number and cvv)
555 $payment_processor_id = $self->_params
[0]['payment_processor'];
556 CRM_Core_Payment_Form
::validatePaymentInstrument($payment_processor_id, $self->_params
[0], $errors, (!$self->_isBillingAddressRequiredForPayLater ?
NULL : 'billing'));
558 if (!empty($errors)) {
562 foreach (CRM_Contact_BAO_Contact
::$_greetingTypes as $greeting) {
563 if ($greetingType = CRM_Utils_Array
::value($greeting, $self->_params
[0])) {
564 $customizedValue = CRM_Core_PseudoConstant
::getKey('CRM_Contact_BAO_Contact', $greeting . '_id', 'Customized');
565 if ($customizedValue == $greetingType && empty($self->_params
[0][$greeting . '_custom'])) {
574 * Process the form submission.
579 public function postProcess() {
580 //get the button name.
581 $button = substr($this->controller
->getButtonName(), -4);
583 //take the participant instance.
584 $addParticipantNum = substr($this->_name
, 12);
586 //user submitted params.
587 $params = $this->controller
->exportValues($this->_name
);
589 if (!$this->_allowConfirmation
) {
590 // check if the participant is already registered
591 $params['contact_id'] = CRM_Event_Form_Registration_Register
::getRegistrationContactID($params, $this, TRUE);
594 if (!empty($params['image_URL'])) {
595 CRM_Contact_BAO_Contact
::processImageParams($params);
597 //carry campaign to partcipants.
598 if (array_key_exists('participant_campaign_id', $params)) {
599 $params['campaign_id'] = $params['participant_campaign_id'];
602 $params['campaign_id'] = $this->_values
['event']['campaign_id'] ??
NULL;
605 // if waiting is enabled
606 if (!$this->_allowConfirmation
&&
607 is_numeric($this->_availableRegistrations
)
609 $this->_allowWaitlist
= FALSE;
610 //get the current page count.
611 $currentCount = self
::getParticipantCount($this, $params);
612 if ($button == 'skip') {
613 $currentCount = 'skip';
616 //get the total count.
617 $previousCount = self
::getParticipantCount($this, $this->_params
, TRUE);
618 $totalParticipants = $previousCount;
619 if (is_numeric($currentCount)) {
620 $totalParticipants +
= $currentCount;
622 if (!empty($this->_values
['event']['has_waitlist']) &&
623 $totalParticipants > $this->_availableRegistrations
625 $this->_allowWaitlist
= TRUE;
627 $this->set('allowWaitlist', $this->_allowWaitlist
);
628 $this->_lineItemParticipantsCount
[$addParticipantNum] = $currentCount;
631 if ($button == 'skip') {
632 //hack for free/zero amount event.
633 if ($this->_resetAllowWaitlist
) {
634 $this->_allowWaitlist
= FALSE;
635 $this->set('allowWaitlist', FALSE);
636 if ($this->_requireApproval
) {
637 $status = ts("You have skipped last participant and which result into event having enough spaces, but your registration require approval, Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.");
640 $status = ts("You have skipped last participant and which result into event having enough spaces, hence your group become as register participants though you selected on wait list.");
642 CRM_Core_Session
::setStatus($status);
645 $this->_params
[$addParticipantNum] = 'skip';
646 if (isset($this->_lineItem
)) {
647 $this->_lineItem
[$addParticipantNum] = 'skip';
648 $this->_lineItemParticipantsCount
[$addParticipantNum] = 'skip';
653 $config = CRM_Core_Config
::singleton();
654 $params['currencyID'] = $config->defaultCurrency
;
656 if ($this->_values
['event']['is_monetary']) {
659 $discountId = CRM_Core_BAO_Discount
::findSet($this->_eventId
, 'civicrm_event');
660 $params['amount_level'] = $this->getAmountLevel($params, $discountId);
661 if (!empty($this->_values
['discount'][$discountId])) {
662 $params['discount_id'] = $discountId;
663 $params['amount'] = $this->_values
['discount'][$discountId][$params['amount']]['value'];
665 elseif (empty($params['priceSetId'])) {
666 $params['amount'] = $this->_values
['fee'][$params['amount']]['value'];
670 CRM_Price_BAO_PriceSet
::processAmount($this->_values
['fee'], $params, $lineItem);
672 //build line item array..
673 //if requireApproval/waitlist is enabled we hide fees for primary participant
674 // (and not for additional participant which might be is a bug)
675 //lineItem are not correctly build for primary participant
676 //this results in redundancy since now lineItems for additional participant will be build against primary participantNum
677 //therefore lineItems must always be build against current participant No
678 $this->_lineItem
[$addParticipantNum] = $lineItem;
682 if (array_key_exists('participant_role', $params)) {
683 $params['participant_role_id'] = $params['participant_role'];
686 if (empty($params['participant_role_id']) && $this->_values
['event']['default_role_id']) {
687 $params['participant_role_id'] = $this->_values
['event']['default_role_id'];
690 if (!empty($this->_params
[0]['is_pay_later'])) {
691 $params['is_pay_later'] = 1;
694 //carry additional participant id, contact id if pre-registered.
695 if ($this->_allowConfirmation
&& $this->_additionalParticipantId
) {
696 $params['contact_id'] = $this->_contactId
;
697 $params['participant_id'] = $this->_additionalParticipantId
;
700 //build the params array.
701 $this->_params
[$addParticipantNum] = $params;
704 //finally set the params.
705 $this->set('params', $this->_params
);
707 if ($this->_lineItem
) {
708 $this->set('lineItem', $this->_lineItem
);
709 $this->set('lineItemParticipantsCount', $this->_lineItemParticipantsCount
);
712 $participantNo = count($this->_params
);
713 if ($button != 'skip') {
714 $statusMsg = ts('Registration information for participant %1 has been saved.', [1 => $participantNo]);
715 CRM_Core_Session
::setStatus($statusMsg, ts('Registration Saved'), 'success');
718 // Check whether to process the registration now, calling processRegistration()
720 // CRM-11182 - Optional confirmation screen
721 !$this->_values
['event']['is_confirm_enabled']
722 && !$this->_values
['event']['is_monetary']
723 && !empty($this->_params
[0]['additional_participants'])
724 && $this->isLastParticipant()
726 $this->processRegistration($this->_params
);
731 * @param $additionalParticipant
735 public static function &getPages($additionalParticipant) {
737 for ($i = 1; $i <= $additionalParticipant; $i++
) {
738 $details["Participant_{$i}"] = [
739 'className' => 'CRM_Event_Form_Registration_AdditionalParticipant',
740 'title' => "Register Additional Participant {$i}",
747 * Check whether call current participant is last one.
749 * @param bool $isButtonJs
754 public function isLastParticipant($isButtonJs = FALSE) {
755 $participant = $isButtonJs ?
$this->_params
[0]['additional_participants'] : $this->_params
[0]['additional_participants'] +
1;
756 if (count($this->_params
) == $participant) {