Index: branches/5.3.x/core/units/helpers/language_import_helper.php =================================================================== diff -u -N -r15677 -r15698 --- branches/5.3.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 15677) +++ branches/5.3.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 15698) @@ -1,6 +1,6 @@ Application->getUnitOption('lang','TableName') . ' + FROM ' . $this->Application->getUnitConfig('lang')->getTableName() . ' WHERE LanguageId IN (' . implode(',', $language_ids) . ')'; $languages = $this->Conn->Query($sql, 'LanguageId'); @@ -288,7 +288,7 @@ } $sql = 'SELECT * - FROM ' . $this->Application->getUnitOption('phrases','TableName') . ' + FROM ' . $this->Application->getUnitConfig('phrases')->getTableName() . ' WHERE PhraseType IN (' . implode(',', $phrase_types) . ') AND Module IN (' . implode(',', $phrase_modules) . ') AND ' . $limit_where . ' ORDER BY Phrase'; $phrases = $this->Conn->Query($sql, 'PhraseId'); @@ -306,7 +306,7 @@ } $sql = 'SELECT * - FROM ' . $this->Application->getUnitOption('email-template', 'TableName') . ' + FROM ' . $this->Application->getUnitConfig('email-template')->getTableName() . ' WHERE `Type` IN (' . implode(',', $phrase_types) . ') AND (' . substr($module_sql, 0, -4) . ') AND ' . $limit_where . ' ORDER BY TemplateName, `Type`'; $email_templates = $this->Conn->Query($sql, 'TemplateId'); @@ -320,7 +320,7 @@ $limit_where = 'TRUE'; } - $country_table = $this->Application->getUnitOption('country-state', 'TableName'); + $country_table = $this->Application->getUnitConfig('country-state')->getTableName(); // countries $sql = 'SELECT * @@ -531,9 +531,11 @@ $key_field = $prefix == 'phrases' ? 'Phrase' : 'TemplateName'; $ids = $this->getExportIDs($prefix); + $config = $this->Application->getUnitConfig($prefix); + $sql = 'SELECT ' . $key_field . ' - FROM ' . $this->Application->getUnitOption($prefix, 'TableName') . ' - WHERE ' . $this->Application->getUnitOption($prefix, 'IDField') . ' IN (' . $ids . ')'; + FROM ' . $config->getTableName() . ' + WHERE ' . $config->getIDField() . ' IN (' . $ids . ')'; $rows = $this->Conn->GetIterator($sql); if ( count($rows) ) { @@ -575,12 +577,13 @@ } // perform insert for records, that are missing in live table + $config = $this->Application->getUnitConfig($prefix); $to_insert = array_diff($temp_records, $live_records); if ( $to_insert ) { $to_insert = $this->Conn->qstrArray($to_insert); - $sql = 'INSERT INTO ' . $this->Application->getUnitOption($prefix, 'TableName') . ' + $sql = 'INSERT INTO ' . $config->getTableName() . ' SELECT * FROM ' . $this->_tables[$prefix] . ' WHERE ' . $unique_field . ' IN (' . implode(',', $to_insert) . ')'; @@ -596,7 +599,7 @@ if ( $to_update ) { $to_update = $this->Conn->qstrArray($to_update); - $sql = 'UPDATE ' . $this->Application->getUnitOption($prefix, 'TableName') . ' live + $sql = 'UPDATE ' . $config->getTableName() . ' live SET '; foreach ($data_fields as $index => $data_field) { @@ -648,7 +651,7 @@ function _getTableData($language_id, $prefix, $unique_field, $data_field, $temp_mode = false) { $data_field = sprintf($data_field, $language_id); - $table_name = $this->Application->getUnitOption($prefix, 'TableName'); + $table_name = $this->Application->getUnitConfig($prefix)->getTableName(); if ($temp_mode) { // for temp table get only records, that have contents on given language (not empty and isset) @@ -714,8 +717,9 @@ */ protected function _prepareTempTable($prefix, $drop_only = false) { - $id_field = $this->Application->getUnitOption($prefix, 'IDField'); - $table = $this->Application->getUnitOption($prefix,'TableName'); + $config = $this->Application->getUnitConfig($prefix); + $id_field = $config->getIDField(); + $table = $config->getTableName(); $temp_table = $this->Application->GetTempName($table); $sql = 'DROP TABLE IF EXISTS %s'; @@ -760,7 +764,8 @@ function _updateEventsCache() { $sql = 'SELECT TemplateId, CONCAT(TemplateName,"_",Type) AS EventMix - FROM ' . $this->Application->getUnitOption('email-template', 'TableName'); + FROM ' . $this->Application->getUnitConfig('email-template')->getTableName(); + $this->events_hash = $this->Conn->GetCol($sql, 'EventMix'); }