Created
January 24, 2020 19:12
-
-
Save mlutfy/85a4c4ae90c6a4e021d5832ef970aaeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CRM/Core/I18n/Schema.php b/CRM/Core/I18n/Schema.php | |
index 64cb94b0..19dd15f7 100644 | |
--- a/CRM/Core/I18n/Schema.php | |
+++ b/CRM/Core/I18n/Schema.php | |
@@ -342,9 +342,15 @@ class CRM_Core_I18n_Schema { | |
} | |
// rebuild views | |
+ $config = CRM_Core_Config::singleton(); | |
+ | |
foreach ($locales as $locale) { | |
foreach ($tables as $table) { | |
$queries[] = self::createViewQuery($locale, $table, $dao, $class, $isUpgradeMode); | |
+ | |
+ if ($config->logging) { | |
+ $queries[] = self::createViewQuery($locale, 'log_' . $table, $dao, $class, $isUpgradeMode); | |
+ } | |
} | |
} | |
@@ -498,9 +504,16 @@ class CRM_Core_I18n_Schema { | |
$cols = []; | |
$tableCols = []; | |
$dao->query("DESCRIBE {$table}", FALSE); | |
+ | |
+ $lookup_table = $table; | |
+ | |
+ if (substr($table, 0, 4) == 'log_') { | |
+ $lookup_table = substr($table, 4); | |
+ } | |
+ | |
while ($dao->fetch()) { | |
// view non-internationalized columns directly | |
- if (!in_array($dao->Field, array_keys($columns[$table])) and | |
+ if (!in_array($dao->Field, array_keys($columns[$lookup_table])) and | |
!preg_match('/_[a-z][a-z]_[A-Z][A-Z]$/', $dao->Field) | |
) { | |
$cols[] = $dao->Field; | |
@@ -508,7 +521,7 @@ class CRM_Core_I18n_Schema { | |
$tableCols[] = $dao->Field; | |
} | |
// view intrernationalized columns through an alias | |
- foreach ($columns[$table] as $column => $_) { | |
+ foreach ($columns[$lookup_table] as $column => $_) { | |
if (!$isUpgradeMode) { | |
$cols[] = "{$column}_{$locale} {$column}"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment