From: Tim Otten Date: Tue, 8 Sep 2015 02:21:03 +0000 (-0700) Subject: CRM-16373 - CRM_Admin_Form_Setting_Search - Don't save through ConfigSetting::add() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dc378d98dc7015237e22684d5d5ea69ef1c35bd7;p=civicrm-core.git CRM-16373 - CRM_Admin_Form_Setting_Search - Don't save through ConfigSetting::add() --- diff --git a/CRM/Admin/Form/Setting/Search.php b/CRM/Admin/Form/Setting/Search.php index b783ed0590..47fc581a0a 100644 --- a/CRM/Admin/Form/Setting/Search.php +++ b/CRM/Admin/Form/Setting/Search.php @@ -40,6 +40,13 @@ class CRM_Admin_Form_Setting_Search extends CRM_Admin_Form_Setting { protected $_settings = array( 'search_autocomplete_count' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'enable_innodb_fts' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'includeWildCardInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'includeEmailInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'includeNickNameInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'includeAlphabeticalPager' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'includeOrderByClause' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'smartGroupCacheTimeout' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'defaultSearchProfileID' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, ); /** @@ -49,23 +56,6 @@ class CRM_Admin_Form_Setting_Search extends CRM_Admin_Form_Setting { CRM_Utils_System::setTitle(ts('Settings - Search Preferences')); // @todo remove the following adds in favour of setting via the settings array (above). - $this->addYesNo('includeWildCardInName', ts('Automatic Wildcard')); - $this->addYesNo('includeEmailInName', ts('Include Email')); - $this->addYesNo('includeNickNameInName', ts('Include Nickname')); - - $this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager')); - $this->addYesNo('includeOrderByClause', ts('Include Order By Clause')); - - $this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), - array('size' => 3, 'maxlength' => 5) - ); - - $types = array('Contact', 'Individual', 'Organization', 'Household'); - $profiles = CRM_Core_BAO_UFGroup::getProfiles($types); - - $this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), - array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge') - ); // Autocomplete for Contact Search (quick search etc.) $options = array( @@ -94,4 +84,16 @@ class CRM_Admin_Form_Setting_Search extends CRM_Admin_Form_Setting { parent::buildQuickForm(); } + /** + * @return array + */ + public static function getAvailableProfiles() { + return array('' => ts('- none -')) + CRM_Core_BAO_UFGroup::getProfiles(array( + 'Contact', + 'Individual', + 'Organization', + 'Household', + )); + } + } diff --git a/settings/Search.setting.php b/settings/Search.setting.php index 1b349da628..7cb0d454df 100644 --- a/settings/Search.setting.php +++ b/settings/Search.setting.php @@ -100,8 +100,6 @@ return array( 'name' => 'includeOrderByClause', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Boolean', 'quick_form_type' => 'YesNo', 'default' => 1, @@ -118,8 +116,6 @@ return array( 'name' => 'includeWildCardInName', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Boolean', 'quick_form_type' => 'YesNo', 'default' => 1, @@ -136,8 +132,6 @@ return array( 'name' => 'includeEmailInName', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Boolean', 'quick_form_type' => 'YesNo', 'default' => 1, @@ -154,11 +148,9 @@ return array( 'name' => 'includeNickNameInName', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Boolean', 'quick_form_type' => 'YesNo', - 'default' => 1, + 'default' => 0, 'add' => '4.6', 'title' => 'Include Nickname', 'is_domain' => 1, @@ -172,8 +164,6 @@ return array( 'name' => 'includeAlphabeticalPager', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Boolean', 'quick_form_type' => 'YesNo', 'default' => 1, @@ -190,11 +180,10 @@ return array( 'name' => 'smartGroupCacheTimeout', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Integer', - 'quick_form_type' => 'Text', - 'default' => 1, + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'default' => 5, 'add' => '4.6', 'title' => 'Smart group cache timeout', 'is_domain' => 1, @@ -208,11 +197,16 @@ return array( 'name' => 'defaultSearchProfileID', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Integer', - 'quick_form_type' => 'Text', - 'default' => 1, + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => array( + 'class' => 'crm-select2', + ), + 'pseudoconstant' => array( + 'callback' => 'CRM_Admin_Form_Setting_Search::getAvailableProfiles', + ), + 'default' => NULL, 'add' => '4.6', 'title' => 'Default Contact Search Profile', 'is_domain' => 1,