From 5da9acdede16c653aaae959f9b27896c48af4cf0 Mon Sep 17 00:00:00 2001 From: Christopher Gervais <chris@ergonlogic.com> Date: Thu, 26 Jan 2017 14:45:19 +0000 Subject: [PATCH] Ensure a local is set prior to altering database table names in multilingual sites. --- CRM/Core/BAO/ConfigSetting.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 0e0d838d66de..5897579fdf2d 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -196,7 +196,8 @@ public static function applyLocale($settings, $activatedLocales) { // try to inherit the language from the hosting CMS if ($settings->get('inheritLocale')) { // FIXME: On multilanguage installs, CRM_Utils_System::getUFLocale() in many cases returns nothing if $dbLocale is not set - $dbLocale = $multiLang ? ("_" . $settings->get('lcMessages')) : ''; + $lcMessages = $settings->get('lcMessages'); + $dbLocale = $multiLang && $lcMessages ? "_{$lcMessages}" : ''; $chosenLocale = CRM_Utils_System::getUFLocale(); if ($activatedLocales and !in_array($chosenLocale, explode(CRM_Core_DAO::VALUE_SEPARATOR, $activatedLocales))) { $chosenLocale = NULL; @@ -209,7 +210,7 @@ public static function applyLocale($settings, $activatedLocales) { } // set suffix for table names - use views if more than one language - $dbLocale = $multiLang ? "_{$chosenLocale}" : ''; + $dbLocale = $multiLang && $chosenLocale ? "_{$chosenLocale}" : ''; // FIXME: an ugly hack to fix CRM-4041 global $tsLocale;