$form->add('select', 'custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), $mainProfiles);
$form->add('select', 'additional_custom_pre_id', ts('Profile for Additional Participants') . '<br />' . ts('(top of page)'), $addtProfiles);
- $form->add('select', 'additional_custom_post_id', ts('Profile for Additional Participants') . '<br />' . ts('(bottom of page)'), $addtProfiles);
+ // Allow user to NOT provide a bottom profile for Additional Participant registration
+ $form->add('select', 'additional_custom_post_id', ts('Profile for Additional Participants') . '<br />' . ts('(bottom of page)'), array('none' => ts('- no profile -')) + $addtProfiles);
}
function buildMultipleProfileBottom(&$form, $count, $prefix = '', $name = 'Include Profile') {
if ($prefix == 'additional_') {
$mainProfiles = array(
- '' => ts('- same as for main contact -')) + $profiles;
+ '' => ts('- same as for main contact -'), 'none' => ts('- no profile -')) + $profiles;
}
else {
$mainProfiles = array(
else {
$isPreError = FALSE;
}
- //check for additional custom post profile
- $additionalCustomPostId = CRM_Utils_Array::value('additional_custom_post_id', $values);
- if (!empty($additionalCustomPostId)) {
- if (!($additionalCustomPostId == 'none')) {
- $customPostId = $additionalCustomPostId;
+
+ // We don't have required Individual fields in the pre-custom profile, so now check the post-custom profile
+ if ($isPreError) {
+ $additionalCustomPostId = CRM_Utils_Array::value('additional_custom_post_id', $values);
+ if (!empty($additionalCustomPostId)) {
+ if (!($additionalCustomPostId == 'none')) {
+ $customPostId = $additionalCustomPostId;
+ }
+ else {
+ $isPostError = FALSE;
+ }
}
else {
- $isPostError = FALSE;
+ $customPostId = CRM_Utils_Array::value('custom_post_id', $values) ? $values['custom_post_id'] : NULL;
}
- }
- else {
- $customPostId = CRM_Utils_Array::value('custom_post_id', $values) ? $values['custom_post_id'] : NULL;
- }
- //check whether the additional custom post profile is of type 'Individual' and its subtypes
- if (!empty($customPostId)) {
- $profileTypes = CRM_Core_BAO_UFGroup::profileGroups($customPostId);
- foreach ($types as $individualTypes) {
- if (in_array($individualTypes, $profileTypes)) {
- $isPostError = FALSE;
- break;
+ //check whether the additional custom post profile is of type 'Individual' and its subtypes
+ if (!empty($customPostId)) {
+ $profileTypes = CRM_Core_BAO_UFGroup::profileGroups($customPostId);
+ foreach ($types as $individualTypes) {
+ if (in_array($individualTypes, $profileTypes)) {
+ $isPostError = FALSE;
+ break;
+ }
}
}
- }
- else {
- $isPostError = FALSE;
- }
- if ($isPreError || (empty($customPreId) && empty($customPostId))) {
- $errorMsg['additional_custom_pre_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'");
- }
- if ($isPostError) {
- $errorMsg['additional_custom_post_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'");
+ else {
+ $isPostError = FALSE;
+ }
+
+ if (empty($customPreId) && empty($customPostId)) {
+ $errorMsg['additional_custom_pre_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'");
+ }
+ if ($isPostError) {
+ $errorMsg['additional_custom_post_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'");
+ }
}
}
if (!$isProfileComplete) {