3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
32 * @copyright CiviCRM LLC (c) 2004-2015
38 * This class generates form components for processing Event
41 class CRM_Event_Form_Registration_AdditionalParticipant
extends CRM_Event_Form_Registration
{
44 * The defaults involved in this page.
46 public $_defaults = array();
49 * Pre-registered additional participant id.
51 public $additionalParticipantId = NULL;
54 * Set variables up before form is built.
58 public function preProcess() {
61 $participantNo = substr($this->_name
, 12);
63 //lets process in-queue participants.
64 if ($this->_participantId
&& $this->_additionalParticipantIds
) {
65 $this->_additionalParticipantId
= CRM_Utils_Array
::value($participantNo, $this->_additionalParticipantIds
);
68 $participantCnt = $participantNo +
1;
69 $this->assign('formId', $participantNo);
70 $this->_params
= array();
71 $this->_params
= $this->get('params');
73 $participantTot = $this->_params
[0]['additional_participants'] +
1;
74 $skipCount = count(array_keys($this->_params
, "skip"));
76 $this->assign('skipCount', $skipCount);
78 CRM_Utils_System
::setTitle(ts('Register Participant %1 of %2', array(1 => $participantCnt, 2 => $participantTot)));
80 //CRM-4320, hack to check last participant.
81 $this->_lastParticipant
= FALSE;
82 if ($participantTot == $participantCnt) {
83 $this->_lastParticipant
= TRUE;
85 $this->assign('lastParticipant', $this->_lastParticipant
);
89 * Set default values for the form. For edit/view mode
90 * the default values are retrieved from the database
95 public function setDefaultValues() {
96 $defaults = $unsetSubmittedOptions = array();
98 //fix for CRM-3088, default value for discount set.
99 if (!empty($this->_values
['discount'])) {
100 $discountId = CRM_Core_BAO_Discount
::findSet($this->_eventId
, 'civicrm_event');
101 if ($discountId && !empty($this->_values
['event']['default_discount_fee_id'])) {
102 $discountKey = CRM_Core_DAO
::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values
['event']['default_discount_fee_id'], 'weight', 'id'
104 $defaults['amount'] = key(array_slice($this->_values
['discount'][$discountId], $discountKey - 1, $discountKey, TRUE));
107 if ($this->_priceSetId
) {
108 foreach ($this->_feeBlock
as $key => $val) {
109 if (empty($val['options'])) {
113 $optionsFull = CRM_Utils_Array
::value('option_full_ids', $val, array());
114 foreach ($val['options'] as $keys => $values) {
115 if ($values['is_default'] && !in_array($keys, $optionsFull)) {
116 if ($val['html_type'] == 'CheckBox') {
117 $defaults["price_{$key}"][$keys] = 1;
120 $defaults["price_{$key}"] = $keys;
124 if (!empty($optionsFull)) {
125 $unsetSubmittedOptions[$val['id']] = $optionsFull;
130 //CRM-4320, setdefault additional participant values.
131 if ($this->_allowConfirmation
&& $this->_additionalParticipantId
) {
132 //hack to get set default from eventFees.php
133 $this->_discountId
= $discountId;
134 $this->_pId
= $this->_additionalParticipantId
;
135 $this->_contactId
= CRM_Core_DAO
::getFieldValue('CRM_Event_DAO_Participant', $this->_additionalParticipantId
, 'contact_id');
136 $participantDefaults = CRM_Event_Form_EventFees
::setDefaultValues($this);
137 $participantDefaults = array_merge($this->_defaults
, $participantDefaults);
138 // use primary email address if billing email address is empty
139 if (empty($this->_defaults
["email-{$this->_bltID}"]) &&
140 !empty($this->_defaults
["email-Primary"])
142 $participantDefaults["email-{$this->_bltID}"] = $this->_defaults
["email-Primary"];
144 $defaults = array_merge($defaults, $participantDefaults);
147 $defaults = array_merge($this->_defaults
, $defaults);
149 //reset values for all options those are full.
150 CRM_Event_Form_Registration
::resetElementValue($unsetSubmittedOptions, $this);
152 //load default campaign from page.
153 if (array_key_exists('participant_campaign_id', $this->_fields
)) {
154 $defaults['participant_campaign_id'] = CRM_Utils_Array
::value('campaign_id', $this->_values
['event']);
161 * Build the form object.
165 public function buildQuickForm() {
166 $config = CRM_Core_Config
::singleton();
167 $button = substr($this->controller
->getButtonName(), -4);
169 $this->add('hidden', 'scriptFee', NULL);
170 $this->add('hidden', 'scriptArray', NULL);
172 if ($this->_values
['event']['is_monetary']) {
173 CRM_Event_Form_Registration_Register
::buildAmount($this);
175 $first_name = $last_name = NULL;
176 $pre = $post = array();
181 if (isset($this->_values
['additional_custom_' . $keys . '_id'])) {
182 $this->buildCustom($this->_values
['additional_custom_' . $keys . '_id'], 'additionalCustom' . ucfirst($keys), TRUE);
183 $
$keys = CRM_Core_BAO_UFGroup
::getFields($this->_values
['additional_custom_' . $keys . '_id']);
189 if (array_key_exists($name, $
$keys) &&
190 CRM_Utils_Array
::value('is_required', CRM_Utils_Array
::value($name, $
$keys))
197 $required = ($button == 'skip' ||
198 $this->_values
['event']['allow_same_participant_emails'] == 1 &&
199 ($first_name && $last_name)
204 if ($this->isLastParticipant(TRUE) && empty($this->_values
['event']['is_monetary'])) {
205 $js = array('onclick' => "return submitOnce(this,'" . $this->_name
. "','" . ts('Processing') . "');");
208 //handle case where user might sart with waiting by group
209 //registration and skip some people and now group fit to
210 //become registered so need to take payment from user.
211 //this case only occurs at dynamic waiting status, CRM-4320
212 $statusMessage = NULL;
213 $allowToProceed = TRUE;
214 $includeSkipButton = TRUE;
215 $this->_resetAllowWaitlist
= FALSE;
217 $pricesetFieldsCount = CRM_Price_BAO_PriceSet
::getPricesetCount($this->_priceSetId
);
219 if ($this->_lastParticipant ||
$pricesetFieldsCount) {
220 //get the participant total.
221 $processedCnt = self
::getParticipantCount($this, $this->_params
, TRUE);
224 if (!$this->_allowConfirmation
&& !empty($this->_params
[0]['bypass_payment']) &&
225 $this->_lastParticipant
228 //get the event spaces.
229 $spaces = $this->_availableRegistrations
;
231 $currentPageMaxCount = 1;
232 if ($pricesetFieldsCount) {
233 $currentPageMaxCount = $pricesetFieldsCount;
236 //we might did reset allow waiting in case of dynamic calculation
237 if (!empty($this->_params
[0]['bypass_payment']) &&
238 is_numeric($spaces) &&
239 $processedCnt > $spaces
241 $this->_allowWaitlist
= TRUE;
242 $this->set('allowWaitlist', TRUE);
245 //lets allow to become a part of runtime waiting list, if primary selected pay later.
246 $realPayLater = FALSE;
247 if (!empty($this->_values
['event']['is_monetary']) && !empty($this->_values
['event']['is_pay_later'])) {
248 $realPayLater = CRM_Utils_Array
::value('is_pay_later', $this->_params
[0]);
251 //truly spaces are greater than required.
252 if (is_numeric($spaces) && $spaces >= ($processedCnt +
$currentPageMaxCount)) {
253 if (CRM_Utils_Array
::value('amount', $this->_params
[0], 0) == 0 ||
$this->_requireApproval
) {
254 $this->_allowWaitlist
= FALSE;
255 $this->set('allowWaitlist', $this->_allowWaitlist
);
256 if ($this->_requireApproval
) {
257 $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.", array(
258 1 => ++
$processedCnt,
263 $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).", array(
264 1 => ++
$processedCnt,
270 $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.", array(
271 1 => ++
$processedCnt,
274 $allowToProceed = FALSE;
276 CRM_Core_Session
::setStatus($statusMessage, ts('Registration Error'), 'error');
278 elseif ($processedCnt == $spaces) {
279 if (CRM_Utils_Array
::value('amount', $this->_params
[0], 0) == 0
280 ||
$realPayLater ||
$this->_requireApproval
282 $this->_resetAllowWaitlist
= TRUE;
283 if ($this->_requireApproval
) {
284 $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.");
287 $statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed).");
291 //hey there is enough space and we require payment.
292 $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.");
293 $includeSkipButton = FALSE;
298 // for priceset with count
299 if ($pricesetFieldsCount && !empty($this->_values
['event']['has_waitlist']) &&
300 !$this->_allowConfirmation
303 if ($this->_isEventFull
) {
304 $statusMessage = ts('This event is currently full. You are registering for the waiting list. You will be notified if spaces become available.');
306 elseif ($this->_allowWaitlist ||
307 (!$this->_allowWaitlist
&& ($processedCnt +
$pricesetFieldsCount) > $this->_availableRegistrations
)
310 $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.');
311 $confirmedMsg = ts('It looks like there are enough spaces in this event for your group (you will not be wait listed).');
312 if ($this->_requireApproval
) {
313 $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.');
314 $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.');
317 $this->assign('waitingMsg', $waitingMsg);
318 $this->assign('confirmedMsg', $confirmedMsg);
320 $this->assign('availableRegistrations', $this->_availableRegistrations
);
321 $this->assign('currentParticipantCount', $processedCnt);
322 $this->assign('allowGroupOnWaitlist', TRUE);
324 $paymentBypassed = NULL;
325 if (!empty($this->_params
[0]['bypass_payment']) &&
326 !$this->_allowWaitlist
&&
328 !$this->_requireApproval
&&
329 !(CRM_Utils_Array
::value('amount', $this->_params
[0], 0) == 0)
331 $paymentBypassed = ts('Please go back to the main registration page, to complete payment information.');
333 $this->assign('paymentBypassed', $paymentBypassed);
337 $this->assign('statusMessage', $statusMessage);
342 'name' => ts('Go Back'),
343 'spacing' => '  ',
348 if ($allowToProceed) {
349 $buttons = array_merge($buttons, array(
352 'name' => ts('Continue'),
353 'spacing' => ' ',
359 if ($includeSkipButton) {
360 $buttons = array_merge($buttons, array(
363 'name' => ts('Skip Participant'),
365 'icon' => 'seek-next',
371 $this->addButtons($buttons);
372 $this->addFormRule(array('CRM_Event_Form_Registration_AdditionalParticipant', 'formRule'), $this);
373 $this->unsavedChangesWarn
= TRUE;
379 * @param array $fields
380 * The input form values.
381 * @param array $files
382 * The uploaded files if any.
387 * true if no errors, else array of errors
389 public static function formRule($fields, $files, $self) {
391 //get the button name.
392 $button = substr($self->controller
->getButtonName(), -4);
394 $realPayLater = FALSE;
395 if (!empty($self->_values
['event']['is_monetary']) && !empty($self->_values
['event']['is_pay_later'])) {
396 $realPayLater = CRM_Utils_Array
::value('is_pay_later', $self->_params
[0]);
399 if ($button != 'skip') {
400 //Check that either an email or firstname+lastname is included in the form(CRM-9587)
401 CRM_Event_Form_Registration_Register
::checkProfileComplete($fields, $errors, $self->_eventId
);
403 //Additional Participant can also register for an event only once
404 $isRegistered = CRM_Event_Form_Registration_Register
::checkRegistration($fields, $self, TRUE);
406 if ($self->_values
['event']['allow_same_participant_emails']) {
407 $errors['_qf_default'] = ts('A person is already registered for this event.');
410 $errors["email-{$self->_bltID}"] = ts('A person with this email address is already registered for this event.');
414 //get the complete params.
415 $params = $self->get('params');
417 //take the participant instance.
418 $addParticipantNum = substr($self->_name
, 12);
420 if (is_array($params)) {
421 foreach ($params as $key => $value) {
422 if ($key != $addParticipantNum) {
423 if (!$self->_values
['event']['allow_same_participant_emails']) {
424 //collect all email fields
425 $existingEmails = array();
426 $additionalParticipantEmails = array();
427 if (is_array($value)) {
428 foreach ($value as $key => $val) {
429 if (substr($key, 0, 6) == 'email-' && $val) {
430 $existingEmails[] = $val;
434 foreach ($fields as $key => $val) {
435 if (substr($key, 0, 6) == 'email-' && $val) {
436 $additionalParticipantEmails[] = $val;
440 //check if any emails are common to both arrays
441 if (count(array_intersect($existingEmails, $additionalParticipantEmails))) {
442 $errors[$mailKey] = ts('The email address must be unique for each participant.');
447 // check with first_name and last_name for additional participants
448 if (!empty($value['first_name']) && ($value['first_name'] == CRM_Utils_Array
::value('first_name', $fields)) &&
449 (CRM_Utils_Array
::value('last_name', $value) == CRM_Utils_Array
::value('last_name', $fields))
451 $errors['first_name'] = ts('The first name and last name must be unique for each participant.');
459 //check for atleast one pricefields should be selected
460 if (!empty($fields['priceSetId'])) {
461 $allParticipantParams = $params;
463 //format current participant params.
464 $allParticipantParams[$addParticipantNum] = self
::formatPriceSetParams($self, $fields);
465 $totalParticipants = self
::getParticipantCount($self, $allParticipantParams);
467 //validate price field params.
468 $priceSetErrors = self
::validatePriceSet($self, $allParticipantParams);
469 $errors = array_merge($errors, CRM_Utils_Array
::value($addParticipantNum, $priceSetErrors, array()));
471 if (!$self->_allowConfirmation
&&
472 is_numeric($self->_availableRegistrations
)
474 if (!empty($self->_params
[0]['bypass_payment']) &&
475 !$self->_allowWaitlist
&&
477 !$self->_requireApproval
&&
478 !(CRM_Utils_Array
::value('amount', $self->_params
[0], 0) == 0) &&
479 $totalParticipants < $self->_availableRegistrations
481 $errors['_qf_default'] = ts("Your event registration will be confirmed. Please go back to the main registration page, to complete payment information.");
483 //check for availability of registrations.
484 if (!$self->_allowConfirmation
&& empty($self->_values
['event']['has_waitlist']) &&
485 $totalParticipants > $self->_availableRegistrations
487 $errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(
488 1 => $totalParticipants,
489 2 => $self->_availableRegistrations
,
496 if ($button == 'skip' && $self->_lastParticipant
&& !empty($fields['priceSetId'])) {
497 $pricesetFieldsCount = CRM_Price_BAO_PriceSet
::getPricesetCount($fields['priceSetId']);
498 if (($pricesetFieldsCount < 1) ||
$self->_allowConfirmation
) {
502 if (!empty($self->_values
['event']['has_waitlist']) && !empty($self->_params
[0]['bypass_payment']) &&
503 !$self->_allowWaitlist
&&
505 !$self->_requireApproval
&&
506 !(CRM_Utils_Array
::value('amount', $self->_params
[0], 0) == 0)
508 $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.");
512 if ($button != 'skip' &&
513 $self->_values
['event']['is_monetary'] &&
514 !isset($errors['_qf_default']) &&
515 !$self->validatePaymentValues($self, $fields)
517 $errors['_qf_default'] = ts("Your payment information looks incomplete. Please go back to the main registration page, to complete payment information.");
518 $self->set('forcePayement', TRUE);
520 elseif ($button == 'skip') {
521 $self->set('forcePayement', TRUE);
533 public function validatePaymentValues($self, $fields) {
535 if (!empty($self->_params
[0]['bypass_payment']) ||
536 $self->_allowWaitlist ||
537 empty($self->_fields
) ||
538 CRM_Utils_Array
::value('amount', $self->_params
[0]) > 0
543 $validatePayement = FALSE;
544 if (!empty($fields['priceSetId'])) {
546 CRM_Price_BAO_PriceSet
::processAmount($self->_values
['fee'], $fields, $lineItem);
547 if ($fields['amount'] > 0) {
548 $validatePayement = TRUE;
549 // $self->_forcePayement = true;
553 elseif (!empty($fields['amount']) &&
554 (CRM_Utils_Array
::value('value', $self->_values
['fee'][$fields['amount']]) > 0)
556 $validatePayement = TRUE;
559 if (!$validatePayement) {
565 CRM_Core_Form
::validateMandatoryFields($self->_fields
, $fields, $errors);
567 // validate supplied payment instrument values (e.g. credit card number and cvv)
568 $payment_processor_id = $self->_params
[0]['payment_processor'];
569 CRM_Core_Payment_Form
::validatePaymentInstrument($payment_processor_id, $self->_params
[0], $errors, $self);
571 if (!empty($errors)) {
575 foreach (CRM_Contact_BAO_Contact
::$_greetingTypes as $greeting) {
576 if ($greetingType = CRM_Utils_Array
::value($greeting, $self->_params
[0])) {
577 $customizedValue = CRM_Core_OptionGroup
::getValue($greeting, 'Customized', 'name');
578 if ($customizedValue == $greetingType && empty($self->_params
[0][$greeting . '_custom'])) {
587 * Process the form submission.
592 public function postProcess() {
593 //get the button name.
594 $button = substr($this->controller
->getButtonName(), -4);
596 //take the participant instance.
597 $addParticipantNum = substr($this->_name
, 12);
599 //user submitted params.
600 $params = $this->controller
->exportValues($this->_name
);
602 if (!$this->_allowConfirmation
) {
603 // check if the participant is already registered
604 $params['contact_id'] = CRM_Event_Form_Registration_Register
::checkRegistration($params, $this, TRUE, TRUE);
607 //carry campaign to partcipants.
608 if (array_key_exists('participant_campaign_id', $params)) {
609 $params['campaign_id'] = $params['participant_campaign_id'];
612 $params['campaign_id'] = CRM_Utils_Array
::value('campaign_id', $this->_values
['event']);
615 // if waiting is enabled
616 if (!$this->_allowConfirmation
&&
617 is_numeric($this->_availableRegistrations
)
619 $this->_allowWaitlist
= FALSE;
620 //get the current page count.
621 $currentCount = self
::getParticipantCount($this, $params);
622 if ($button == 'skip') {
623 $currentCount = 'skip';
626 //get the total count.
627 $previousCount = self
::getParticipantCount($this, $this->_params
, TRUE);
628 $totalParticipants = $previousCount;
629 if (is_numeric($currentCount)) {
630 $totalParticipants +
= $currentCount;
632 if (!empty($this->_values
['event']['has_waitlist']) &&
633 $totalParticipants > $this->_availableRegistrations
635 $this->_allowWaitlist
= TRUE;
637 $this->set('allowWaitlist', $this->_allowWaitlist
);
638 $this->_lineItemParticipantsCount
[$addParticipantNum] = $currentCount;
641 if ($button == 'skip') {
642 //hack for free/zero amount event.
643 if ($this->_resetAllowWaitlist
) {
644 $this->_allowWaitlist
= FALSE;
645 $this->set('allowWaitlist', FALSE);
646 if ($this->_requireApproval
) {
647 $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.");
650 $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.");
652 CRM_Core_Session
::setStatus($status);
655 $this->_params
[$addParticipantNum] = 'skip';
656 if (isset($this->_lineItem
)) {
657 $this->_lineItem
[$addParticipantNum] = 'skip';
658 $this->_lineItemParticipantsCount
[$addParticipantNum] = 'skip';
663 $config = CRM_Core_Config
::singleton();
664 $params['currencyID'] = $config->defaultCurrency
;
666 if ($this->_values
['event']['is_monetary']) {
669 $discountId = CRM_Core_BAO_Discount
::findSet($this->_eventId
, 'civicrm_event');
671 if (!empty($this->_values
['discount'][$discountId])) {
672 $params['discount_id'] = $discountId;
673 $params['amount_level'] = $this->_values
['discount'][$discountId][$params['amount']]['label'];
674 $params['amount'] = $this->_values
['discount'][$discountId][$params['amount']]['value'];
676 elseif (empty($params['priceSetId'])) {
677 $params['amount_level'] = $this->_values
['fee'][$params['amount']]['label'];
678 $params['amount'] = $this->_values
['fee'][$params['amount']]['value'];
682 CRM_Price_BAO_PriceSet
::processAmount($this->_values
['fee'], $params, $lineItem);
684 //build line item array..
685 //if requireApproval/waitlist is enabled we hide fees for primary participant
686 // (and not for additional participant which might be is a bug)
687 //lineItem are not correctly build for primary participant
688 //this results in redundancy since now lineItems for additional participant will be build against primary participantNum
689 //therefore lineItems must always be build against current participant No
690 $this->_lineItem
[$addParticipantNum] = $lineItem;
694 if (array_key_exists('participant_role', $params)) {
695 $params['participant_role_id'] = $params['participant_role'];
698 if (empty($params['participant_role_id']) && $this->_values
['event']['default_role_id']) {
699 $params['participant_role_id'] = $this->_values
['event']['default_role_id'];
702 if (!empty($this->_params
[0]['is_pay_later'])) {
703 $params['is_pay_later'] = 1;
706 //carry additional participant id, contact id if pre-registered.
707 if ($this->_allowConfirmation
&& $this->_additionalParticipantId
) {
708 $params['contact_id'] = $this->_contactId
;
709 $params['participant_id'] = $this->_additionalParticipantId
;
712 //build the params array.
713 $this->_params
[$addParticipantNum] = $params;
716 //finally set the params.
717 $this->set('params', $this->_params
);
719 if ($this->_lineItem
) {
720 $this->set('lineItem', $this->_lineItem
);
721 $this->set('lineItemParticipantsCount', $this->_lineItemParticipantsCount
);
724 $participantNo = count($this->_params
);
725 if ($button != 'skip') {
726 $statusMsg = ts('Registration information for participant %1 has been saved.', array(1 => $participantNo));
727 CRM_Core_Session
::setStatus($statusMsg, ts('Registration Saved'), 'success');
730 // Check whether to process the registration now, calling processRegistration()
732 !$this->_values
['event']['is_confirm_enabled'] // CRM-11182 - Optional confirmation screen
733 && !$this->_values
['event']['is_monetary']
734 && CRM_Utils_Array
::value('additional_participants', $this->_params
[0])
735 && $this->isLastParticipant()
737 CRM_Event_Form_Registration_Register
::processRegistration($this->_params
, NULL);
742 * @param $additionalParticipant
746 public static function &getPages($additionalParticipant) {
748 for ($i = 1; $i <= $additionalParticipant; $i++
) {
749 $details["Participant_{$i}"] = array(
750 'className' => 'CRM_Event_Form_Registration_AdditionalParticipant',
751 'title' => "Register Additional Participant {$i}",
758 * Check whether call current participant is last one.
760 * @param bool $isButtonJs
765 public function isLastParticipant($isButtonJs = FALSE) {
766 $participant = $isButtonJs ?
$this->_params
[0]['additional_participants'] : $this->_params
[0]['additional_participants'] +
1;
767 if (count($this->_params
) == $participant) {