View Issue Details

IDProjectCategoryView StatusLast Update
0002700OXID eShop (all versions)4.06. Language and translationspublic2011-04-09 14:38
ReporterHelmut L. 
PriorityhighSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.5.0_beta4 
Target VersionFixed in Version4.5.0 revision 34568 
Summary0002700: oxDbMetaDataHandler can not add multiple languages at once to the database
DescriptionIf you call addNewLangToDb from oxDbMetaDataHandler multiple times only one language is added to the database.
The getCurrentMaxLangId method caches the current maximum language and thus at the second call tries to add the fields from the first call again.

To correct this the cached maximum language id should be updated at the end of the addNewLangToDb method.
Steps To ReproduceCall the addNewLangToDb method multiple times and in the database only the language fields for one language get added.

$oDbMeta = oxNew( "oxDbMetaDataHandler" );
$oDbMeta->addNewLangToDb();
$oDbMeta->addNewLangToDb();
Additional InformationEnterprise Edition
/core/oxdbmetadatahandler.php, line 409

this line should be added:
$this->_iCurrentMaxLangId = $this->getNextLangId();
TagsNo tags attached.
Theme
BrowserAll
PHP Versionany
Database Versionany

Relationships

related to 0002699 resolvedalfonsas_cirtautas max lang id in database is only retrieved from main table 
related to 0002471 resolvedalfonsas_cirtautas Not possible to create more than 8 languages 

Activities

Helmut L.

2011-04-06 12:00

reporter   ~0004322

If you create a new instances of oxDbMetaDataHandler for every language to add, the mentioned solution does not work.
Every instance has its own cache and would correctly try to determine the current max lang id. But the fields are retrieved by oxDb::getInstance()->getTableDescription which has a cache for the table descriptions and thus the old list of fields is used to get the max lang id.

The solution would be to either have the same max lang id cache in oxDbMetaDataHandler for every instance or to clear the oxDb cache after changes on the database have been made.

Helmut L.

2011-04-07 17:30

reporter   ~0004334

During the creation of the views the field list from oxDb::getInstance()->getTableDescription is also used and thus only the view for the first added language uses the correct fields. The views for the other languages use the fields for the first language, because according to getTableDescription the other fields do not exist.

alfonsas_cirtautas

2011-04-09 14:38

reporter   ~0004348

Fixed by adding cached value reset in oxDbMetaDataHandler::addNewLangToDb()