Default status translation to english if it doesn't exist
This commit is contained in:
parent
af5ba09d38
commit
318462164d
@ -17,10 +17,26 @@ class InsertTextToStatusXrefValues extends \AbstractMigration {
|
||||
$oldSetting = $hesk_settings['can_sel_lang'];
|
||||
$hesk_settings['can_sel_lang'] = 1;
|
||||
while ($row = hesk_dbFetchAssoc($statusesRs)) {
|
||||
$englishText = '';
|
||||
foreach ($languages as $language => $languageCode) {
|
||||
hesk_setLanguage($language);
|
||||
|
||||
if ($language === 'English') {
|
||||
if (key_exists($row['Key'], $hesklang)) {
|
||||
$englishText = $hesklang[$row['Key']];
|
||||
} else {
|
||||
$englishText = $row['Key'];
|
||||
}
|
||||
}
|
||||
|
||||
if (key_exists($row['Key'], $hesklang)) {
|
||||
$textToInsert = $hesklang[$row['Key']];
|
||||
} else {
|
||||
$textToInsert = $englishText;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (`language`, `text`, `status_id`)
|
||||
VALUES ('" . hesk_dbEscape($language) . "', '" . hesk_dbEscape($hesklang[$row['Key']]) . "', " . intval($row['ID']) . ")";
|
||||
VALUES ('" . hesk_dbEscape($language) . "', '" . hesk_dbEscape($textToInsert) . "', " . intval($row['ID']) . ")";
|
||||
$this->executeQuery($sql);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user