From 9c3257955e2730176af23bec55f150767b139574 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 17 Sep 2015 21:34:12 -0700 Subject: [PATCH] CRM-14232, CRM-16373 - Fix saving of contact_default_language --- CRM/Admin/Form/Setting/Localization.php | 19 ++++++++++++++----- CRM/Core/Config/MagicMerge.php | 1 + settings/Localization.setting.php | 8 ++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CRM/Admin/Form/Setting/Localization.php b/CRM/Admin/Form/Setting/Localization.php index ead6d55efc..0dc24f4531 100644 --- a/CRM/Admin/Form/Setting/Localization.php +++ b/CRM/Admin/Form/Setting/Localization.php @@ -37,6 +37,7 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { protected $_settings = array( + 'contact_default_language' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'countryLimit' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'customTranslateFunction' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'defaultContactCountry' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, @@ -94,11 +95,8 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { ); } } - $this->addElement('select', 'contact_default_language', ts('Default Language for users'), array( - '*default*' => ts('Use default site language'), - 'undefined' => ts('Leave undefined'), - 'current_site_language' => ts('Use language in use at the time'), - )); + $this->addElement('select', 'contact_default_language', ts('Default Language for users'), + CRM_Admin_Form_Setting_Localization::getDefaultLanguageOptions()); $includeCurrency = &$this->addElement('advmultiselect', 'currencyLimit', ts('Available Currencies') . ' ', self::getCurrencySymbols(), @@ -338,4 +336,15 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { } } + /** + * @return array + */ + public static function getDefaultLanguageOptions() { + return array( + '*default*' => ts('Use default site language'), + 'undefined' => ts('Leave undefined'), + 'current_site_language' => ts('Use language in use at the time'), + ); + } + } diff --git a/CRM/Core/Config/MagicMerge.php b/CRM/Core/Config/MagicMerge.php index 4268abd1c9..30931d19cf 100644 --- a/CRM/Core/Config/MagicMerge.php +++ b/CRM/Core/Config/MagicMerge.php @@ -83,6 +83,7 @@ class CRM_Core_Config_MagicMerge { // Other parameters may be specified, depending on the type. return array( 'backtrace' => array('setting'), + 'contact_default_language' => array('contact_default_language'), 'countryLimit' => array('setting'), 'dashboardCacheTimeout' => array('setting'), 'dateInputFormat' => array('setting'), diff --git a/settings/Localization.setting.php b/settings/Localization.setting.php index f8aca26282..01be58efc0 100644 --- a/settings/Localization.setting.php +++ b/settings/Localization.setting.php @@ -485,6 +485,14 @@ return array( 'group' => 'localization', 'name' => 'contact_default_language', 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => array( + 'class' => 'crm-select2', + ), + 'pseudoconstant' => array( + 'callback' => 'CRM_Admin_Form_Setting_Localization::getDefaultLanguageOptions', + ), 'default' => '*default*', 'add' => '4.7', 'title' => 'Default Language for contacts', -- 2.25.1