From: Matthew Wire Date: Mon, 4 May 2020 11:47:14 +0000 (+0100) Subject: Update enabled currencies AFTER switching multilingual on or off X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fb7d2ea13c1dcaed058e8b3f0651baf2fe1a9e8c;p=civicrm-core.git Update enabled currencies AFTER switching multilingual on or off --- diff --git a/CRM/Admin/Form/Setting/Localization.php b/CRM/Admin/Form/Setting/Localization.php index d495b09eb4..55bb965cf4 100644 --- a/CRM/Admin/Form/Setting/Localization.php +++ b/CRM/Admin/Form/Setting/Localization.php @@ -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']);