Update enabled currencies AFTER switching multilingual on or off
authorMatthew Wire <mjw@mjwconsult.co.uk>
Mon, 4 May 2020 11:47:14 +0000 (12:47 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Mon, 4 May 2020 11:47:14 +0000 (12:47 +0100)
CRM/Admin/Form/Setting/Localization.php

index d495b09eb4d63f384bdd763be3eb2ec8a5541e64..55bb965cf45d990934807d83a7c441e9aee92ae0 100644 (file)
@@ -168,23 +168,6 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting {
     // reset ACL and System caches
     CRM_Core_BAO_Cache::resetCaches();
 
-    // we do this only to initialize monetary decimal point and thousand separator
-    $config = CRM_Core_Config::singleton();
-
-    // save enabled currencies and default currency in option group 'currencies_enabled'
-    // CRM-1496
-    if (empty($values['currencyLimit'])) {
-      $values['currencyLimit'] = [$values['defaultCurrency']];
-    }
-    elseif (!in_array($values['defaultCurrency'], $values['currencyLimit'])) {
-      $values['currencyLimit'][] = $values['defaultCurrency'];
-    }
-
-    self::updateEnabledCurrencies($values['currencyLimit'], $values['defaultCurrency']);
-
-    // unset currencyLimit so we dont store there
-    unset($values['currencyLimit']);
-
     // make the site multi-lang if requested
     if (!empty($values['makeMultilingual'])) {
       CRM_Core_I18n_Schema::makeMultilingual($values['lcMessages']);
@@ -214,6 +197,21 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting {
     // if we manipulated the language list, return to the localization admin screen
     $return = (bool) (CRM_Utils_Array::value('makeMultilingual', $values) or CRM_Utils_Array::value('addLanguage', $values));
 
+    // Update enabled currencies
+    // we do this only to initialize monetary decimal point and thousand separator
+    $config = CRM_Core_Config::singleton();
+    // save enabled currencies and default currency in option group 'currencies_enabled'
+    // CRM-1496
+    if (empty($values['currencyLimit'])) {
+      $values['currencyLimit'] = [$values['defaultCurrency']];
+    }
+    elseif (!in_array($values['defaultCurrency'], $values['currencyLimit'])) {
+      $values['currencyLimit'][] = $values['defaultCurrency'];
+    }
+    self::updateEnabledCurrencies($values['currencyLimit'], $values['defaultCurrency']);
+    // unset currencyLimit so we dont store there
+    unset($values['currencyLimit']);
+
     $filteredValues = $values;
     unset($filteredValues['makeMultilingual']);
     unset($filteredValues['makeSinglelingual']);