From f039cc58b5f3ed01ef46ba52fda47faf53330c58 Mon Sep 17 00:00:00 2001 From: Muhammad Shahrukh <> Date: Mon, 8 Apr 2024 12:37:17 +0500 Subject: [PATCH] BTHAMM-7: Fix participant role assignment --- CRM/EventsExtras/Hook/BuildForm/BaseEvent.php | 1 + CRM/EventsExtras/Hook/BuildForm/EventInfo.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CRM/EventsExtras/Hook/BuildForm/BaseEvent.php b/CRM/EventsExtras/Hook/BuildForm/BaseEvent.php index 61b71a1..b31edd9 100644 --- a/CRM/EventsExtras/Hook/BuildForm/BaseEvent.php +++ b/CRM/EventsExtras/Hook/BuildForm/BaseEvent.php @@ -84,6 +84,7 @@ protected function hideElementBySelector($selector) { CRM_Core_Resources::singleton()->addScript( "CRM.$(function($) { $('{$selector}').hide(); + $('{$selector} .required').removeClass('required'); }); "); } diff --git a/CRM/EventsExtras/Hook/BuildForm/EventInfo.php b/CRM/EventsExtras/Hook/BuildForm/EventInfo.php index d74f15b..8dec03f 100644 --- a/CRM/EventsExtras/Hook/BuildForm/EventInfo.php +++ b/CRM/EventsExtras/Hook/BuildForm/EventInfo.php @@ -48,6 +48,7 @@ private function setDefaults(&$form) { if ($settingValues[$showRoles] == 0) { $defaults['default_role_id'] = $settingValues[$roleDefault]; $fieldIdsToHide[] = 'default_role_id'; + $form->getElement('default_role_id')->setSelected($settingValues[$roleDefault]); } $showParticipantListing = SettingsManager::SETTING_FIELDS['PARTICIPANT_LISTING']; @@ -57,6 +58,7 @@ private function setDefaults(&$form) { if ($settingValues[$showParticipantListing] == 0) { $defaults['participant_listing_id'] = $settingValues[$participantListingDefault]; $fieldIdsToHide[] = 'participant_listing_id'; + $form->getElement('participant_listing_id')->setSelected($settingValues[$participantListingDefault]); } $showIncludeMap = SettingsManager::SETTING_FIELDS['INCLUDE_MAP_LOCATION_EVENT'];