CRM-14232, CRM-16373 - Fix saving of contact_default_language
authorTim Otten <totten@civicrm.org>
Fri, 18 Sep 2015 04:34:12 +0000 (21:34 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 18 Sep 2015 04:34:12 +0000 (21:34 -0700)
CRM/Admin/Form/Setting/Localization.php
CRM/Core/Config/MagicMerge.php
settings/Localization.setting.php

index ead6d55efcf64c45fecd1cf2988a7b8bf667337a..0dc24f4531ef01338c35339ac0072b936095e2e3 100644 (file)
@@ -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'),
+    );
+  }
+
 }
index 4268abd1c936d76ffc64d9d44c9fb1f658f862c3..30931d19cf15f72618cc7c61e1a9d3b01db77652 100644 (file)
@@ -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'),
index f8aca262828bd59ae527cc8e0fb9caed4f038d7b..01be58efc09a01bd035e0ee3925704c94b868825 100644 (file)
@@ -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',