From a37e4e6c80ccd3f0c828969830066230646b6db3 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 7 Sep 2016 21:24:04 +1000 Subject: [PATCH] Fix upgrade for multilingual and have strings as string rather than array --- CRM/Upgrade/Incremental/php/FourSeven.php | 10 +++++++++- CRM/Utils/Check/Component/OptionGroups.php | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index e861956301..fcf6cd7313 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -844,8 +844,16 @@ FROM `civicrm_dashboard_contact` JOIN `civicrm_contact` WHERE civicrm_dashboard_ */ public static function addDataTypeColumnToOptionGroupTable() { if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_option_group', 'data_type')) { - CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_group` ADD COLUMN `data_type` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL comment 'Data Type of Option Group.'"); + CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_group` ADD COLUMN `data_type` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL comment 'Data Type of Option Group.'", + array(), TRUE, NULL, FALSE, FALSE); + } + $domain = new CRM_Core_DAO_Domain(); + $domain->find(TRUE); + if ($domain->locales) { + $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales); + CRM_Core_I18n_Schema::rebuildMultilingualSchema($locales, NULL); } + CRM_Core_DAO::executeQuery("UPDATE `civicrm_option_group` SET `data_type` = 'Integer' WHERE name IN ('activity_type', 'gender', 'payment_instrument', 'participant_role', 'event_type')"); return TRUE; diff --git a/CRM/Utils/Check/Component/OptionGroups.php b/CRM/Utils/Check/Component/OptionGroups.php index 077e551e96..5d272848e6 100644 --- a/CRM/Utils/Check/Component/OptionGroups.php +++ b/CRM/Utils/Check/Component/OptionGroups.php @@ -62,9 +62,9 @@ class CRM_Utils_Check_Component_OptionGroups extends CRM_Utils_Check_Component { } } if (!empty($problemValues)) { - $strings = array(); + $strings = ''; foreach ($problemValues as $problemValue) { - $strings[] = ts(' "%1" "%2" ', array( + $strings .= ts(' "%1" "%2" ', array( 1 => $problemValue['group_name'], 2 => $problemValue['value_name'], )); @@ -74,7 +74,7 @@ class CRM_Utils_Check_Component_OptionGroups extends CRM_Utils_Check_Component { __FUNCTION__, ts('The Following Option Values contain value fields that do not match the Data Type of the Option Group

') . - implode('\n', $strings) . ts('
Option GroupOption Value

'), + $strings . ts('

'), ts('Option Values with problematic Values'), \Psr\Log\LogLevel::NOTICE, 'fa-server' -- 2.25.1