diff --git a/CRM/Admin/Form/Preferences/Display.php b/CRM/Admin/Form/Preferences/Display.php index 1a23425e274de2af9dec60e7e5c37dbf5f31425d..e67401d1f18012c98a5e10eeae5ad6ff1f239fda 100644 --- a/CRM/Admin/Form/Preferences/Display.php +++ b/CRM/Admin/Form/Preferences/Display.php @@ -40,6 +40,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { 'contact_view_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_smart_group_display' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'advanced_search_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'preserve_activity_tab_filter' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, ); public function preProcess() { @@ -63,11 +64,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { 'title' => ts('Include ICal Invite to Activity Assignees'), 'weight' => 6, ), - 'preserve_activity_tab_filter' => array( - 'html_type' => 'checkbox', - 'title' => ts('Preserve activity filters as a user preference'), - 'weight' => 7, - ), 'contact_ajax_check_similar' => array( 'title' => ts('Check for Similar Contacts'), 'weight' => 8, diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index 6a9f7e5f799a2dccd4e983f3d1f4024067a0700a..5b5364d1e1d324e485fd8931e61ddc1821593e21 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -118,14 +118,16 @@ trait CRM_Admin_Form_SettingTrait { foreach ($settingMetaData as $setting => $props) { $quickFormType = $this->getQuickFormType($props); if (isset($quickFormType)) { + $options = NULL; if (isset($props['pseudoconstant'])) { $options = civicrm_api3('Setting', 'getoptions', [ 'field' => $setting, - ]); + ])['values']; } - else { - $options = NULL; + if ($props['type'] === 'Boolean') { + $options = [$props['title'] => $props['name']]; } + //Load input as readonly whose values are overridden in civicrm.settings.php. if (Civi::settings()->getMandatory($setting)) { $props['html_attributes']['readonly'] = TRUE; @@ -138,18 +140,18 @@ trait CRM_Admin_Form_SettingTrait { $props['html_type'], $setting, ts($props['title']), - ($options !== NULL) ? $options['values'] : CRM_Utils_Array::value('html_attributes', $props, []), + ($options !== NULL) ? $options : CRM_Utils_Array::value('html_attributes', $props, []), ($options !== NULL) ? CRM_Utils_Array::value('html_attributes', $props, []) : NULL ); } elseif ($add == 'addSelect') { - $this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_Array::value('html_attributes', $props)); + $this->addElement('select', $setting, ts($props['title']), $options, CRM_Utils_Array::value('html_attributes', $props)); } elseif ($add == 'addCheckBox') { - $this->addCheckBox($setting, ts($props['title']), $options['values'], NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, [' ']); + $this->addCheckBox($setting, ts($props['title']), $options, NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, [' ']); } elseif ($add == 'addCheckBoxes') { - $options = array_flip($options['values']); + $options = array_flip($options); $newOptions = []; foreach ($options as $key => $val) { $newOptions[$key] = $val; @@ -170,7 +172,7 @@ trait CRM_Admin_Form_SettingTrait { $this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d')); } else { - $this->$add($setting, ts($props['title']), $options['values']); + $this->$add($setting, ts($props['title']), $options); } // Migrate to using an array as easier in smart... $descriptions[$setting] = ts($props['description']); @@ -204,6 +206,7 @@ trait CRM_Admin_Form_SettingTrait { } $mapping = [ 'checkboxes' => 'CheckBoxes', + 'checkbox' => 'CheckBox', 'radio' => 'Radio', ]; return $mapping[$spec['html_type']]; diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 5c279417f75151f20edcef328614c6e6619fa0d2..8e33206275dee5bdd1ef46bb0a2f2d21033656ba 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -966,28 +966,28 @@ return array( 'group' => 'core', 'name' => 'syncCMSEmail', 'type' => 'Boolean', + 'html_type' => 'YesNo', 'quick_form_type' => 'YesNo', 'default' => 1, 'add' => '4.7', - 'title' => 'Sync CMS Email', + 'title' => ts('Sync CMS Email'), 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If enabled, then CMS email id will be syncronised with CiviCRM contacts\'s primary email.', + 'description' => ts('If enabled, then CMS email id will be synchronised with CiviCRM contacts\'s primary email.'), 'help_text' => NULL, ), 'preserve_activity_tab_filter' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'preserve_activity_tab_filter', - 'type' => 'String', - 'html_type' => 'Text', + 'type' => 'Boolean', + 'html_type' => 'checkbox', 'default' => '0', 'add' => '4.7', - 'title' => 'Preserve activity filters as a user preference', + 'title' => ts('Preserve activity filters as a user preference'), 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts', - 'help_text' => NULL, + 'description' => ts('When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts.'), ), 'do_not_notify_assignees_for' => array( 'group_name' => 'CiviCRM Preferences', diff --git a/templates/CRM/Admin/Form/Preferences/Display.tpl b/templates/CRM/Admin/Form/Preferences/Display.tpl index 38ea0f0576ef4fc3027fdf76e8a7cd6fd1a1d409..8a89f8b626db5bb4fdfa1e4650171df8db2c4086 100644 --- a/templates/CRM/Admin/Form/Preferences/Display.tpl +++ b/templates/CRM/Admin/Form/Preferences/Display.tpl @@ -155,12 +155,11 @@