Skip to content

Commit

Permalink
Fix upgrade for multilingual and have strings as string rather than a…
Browse files Browse the repository at this point in the history
…rray
  • Loading branch information
seamuslee001 committed Sep 10, 2016
1 parent d3b018e commit a37e4e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion CRM/Upgrade/Incremental/php/FourSeven.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,16 @@ public static function alterIndexAndTypeForImageURL() {
*/
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;
Expand Down
6 changes: 3 additions & 3 deletions CRM/Utils/Check/Component/OptionGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public function checkOptionGroupValues() {
}
}
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'],
));
Expand All @@ -74,7 +74,7 @@ public function checkOptionGroupValues() {
__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'
Expand Down

0 comments on commit a37e4e6

Please sign in to comment.