Fix upgrade for multilingual and have strings as string rather than array
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 7 Sep 2016 11:24:04 +0000 (21:24 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sat, 10 Sep 2016 21:58:23 +0000 (07:58 +1000)
CRM/Upgrade/Incremental/php/FourSeven.php
CRM/Utils/Check/Component/OptionGroups.php

index e8619563012634f444b28e16770986384468bfb4..fcf6cd7313506c1c4fab5ddd00e2bc3a494e30c7 100644 (file)
@@ -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;
index 077e551e96375af5706cb685d71c1025a66bf5fe..5d272848e6843c96729d66731f1b47c99fb7fd81 100644 (file)
@@ -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('<tr><td> "%1" </td><td> "%2" </td></tr>', array(
+        $strings .= ts('<tr><td> "%1" </td><td> "%2" </td></tr>', 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</p>
         <p><table><tbody><th>Option Group</th><th>Option Value</th></tbody><tbody>') .
-        implode('\n', $strings) . ts('</tbody></table></p>'),
+        $strings . ts('</tbody></table></p>'),
         ts('Option Values with problematic Values'),
         \Psr\Log\LogLevel::NOTICE,
         'fa-server'