$this->assign('profilePostMultiple', CRM_Utils_Array::value('custom_post', $defaults));
+ // CRM-17745: Make max additional participants configurable
+ if (empty($defaults['max_additional_participants'])) {
+ $defaults['max_additional_participants'] = 9;
+ }
+
if (!empty($defaults['is_multiple_registrations'])) {
// CRM-4377: set additional participants’ profiles – set to ‘none’ if explicitly unset (non-active)
ts('Register multiple participants?')
);
+ // CRM-17745: Make maximum additional participants configurable
+ $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 9);
+ $this->add('select', 'max_additional_participants', ts('Maximum additional participants'), $numericOptions, FALSE, array('class' => 'required'));
+
$this->addElement('checkbox',
'allow_same_participant_emails',
ts('Same email address?')
if ($this->_values['event']['is_multiple_registrations']) {
// don't allow to add additional during confirmation if not preregistered.
if (!$this->_allowConfirmation || $this->_additionalParticipantIds) {
- // Hardcode maximum number of additional participants here for now. May need to make this configurable per event.
+ // CRM-17745: Make maximum additional participants configurable
// Label is value + 1, since the code sees this is ADDITIONAL participants (in addition to "self")
- $additionalOptions = array(
- '' => '1',
- 1 => '2',
- 2 => '3',
- 3 => '4',
- 4 => '5',
- 5 => '6',
- 6 => '7',
- 7 => '8',
- 8 => '9',
- 9 => '10',
- );
+ $additionalOptions = array();
+ $additionalOptions[''] = 1;
+ for ($i=1; $i <= $this->_values['event']['max_additional_participants']; $i++) {
+ $additionalOptions[$i] = $i + 1;
+ }
$this->add('select', 'additional_participants',
ts('How many people are you registering?'),
$additionalOptions,
--- /dev/null
+{* file to handle db changes in 4.8.alpha1 during upgrade *}
+
+-- CRM-17745: Make maximum additional participants configurable
+ALTER TABLE civicrm_event
+ ADD COLUMN max_additional_participants int(10) unsigned
+ DEFAULT 0
+ COMMENT 'Maximum number of additional participants that can be registered on a single booking'
+ AFTER is_multiple_registrations;
+UPDATE civicrm_event
+ SET max_additional_participants = 9
+ WHERE is_multiple_registrations = 1;
\ No newline at end of file
<p>{ts}You can use different profile for the person who is registering than for "Additional Participants". For example, you may want to require an email address from the person entering the registration while not requiring (or even requesting) emails for additional participants (i.e. their "guests").{/ts}</p>
{/htxt}
+{htxt id="id-max_additional-title"}
+ {ts}Maximum Additional Participants{/ts}
+{/htxt}
+{htxt id="id-max_additional"}
+ <p>{ts}Limit the number of additional participants that can be registered in a single booking.{/ts}</p>
+ <p>{ts}Eg: if you choose '2' then the lead booker can bring 2 guests; there would be a limit of 3 participants in total per booking.{/ts}</p>
+{/htxt}
+
{htxt id="id-allow_same_email-title"}
{ts}Allow Shared Email{/ts}
{/htxt}
<td scope="row" class="label" width="20%">{$form.is_multiple_registrations.label}</td>
<td>{$form.is_multiple_registrations.html} {help id="id-allow_multiple"}</td>
</tr>
+ <tr class="crm-event-manage-registration-form-block-maximum_additional_participants" id="id-max-additional-participants">
+ <td scope="row" class="label" width="20%">{$form.max_additional_participants.label}</td>
+ <td>{$form.max_additional_participants.html} {help id="id-max_additional"}</td>
+ </tr>
<tr class="crm-event-manage-registration-form-block-allow_same_participant_emails">
<td scope="row" class="label" width="20%">{$form.allow_same_participant_emails.label}</td>
<td>{$form.allow_same_participant_emails.html} {help id="id-allow_same_email"}</td>
field_type ="radio"
invert = 0
}
-{include file="CRM/common/showHideByFieldValue.tpl"
-trigger_field_id ="is_multiple_registrations"
-trigger_value =""
-target_element_id ="additional_profile_pre|additional_profile_post"
-target_element_type ="table-row"
-field_type ="radio"
-invert = 0
-}
{if $form.requires_approval}
{include file="CRM/common/showHideByFieldValue.tpl"
trigger_field_id ="requires_approval"
var allow_multiple = $("#is_multiple_registrations");
if ( !allow_multiple.prop('checked') ) {
- $('#additional_profile_pre,#additional_profile_post').hide();
+ $('#additional_profile_pre,#additional_profile_post,#id-max-additional-participants').hide();
}
allow_multiple.change( function( ) {
if ( !$(this).prop('checked') ) {
$("#additional_custom_pre_id,#additional_custom_post_id").val('');
$(".crm-event-manage-registration-form-block-additional_custom_post_multiple").hide();
- $('#additional_profile_pre,#additional_profile_post').hide();
+ $('#additional_profile_pre,#additional_profile_post,#id-max-additional-participants').hide();
} else {
$(".crm-event-manage-registration-form-block-additional_custom_post_multiple").show();
- $('#additional_profile_pre,#additional_profile_post').show();
+ $('#additional_profile_pre,#additional_profile_post,#id-max-additional-participants').show();
}
-
});
var allow_selfCancel = $("#allow_selfcancelxfer");
<type>CheckBox</type>
</html>
</field>
+ <field>
+ <name>max_additional_participants</name>
+ <type>int unsigned</type>
+ <title>Maximum number of additional participants per registration</title>
+ <default>0</default>
+ <comment>Maximum number of additional participants that can be registered on a single booking</comment>
+ <add>4.8</add>
+ </field>
<field>
<name>allow_same_participant_emails</name>
<type>boolean</type>