Index: branches/5.2.x/core/kernel/db/dbitem.php =================================================================== diff -u -N -r14608 -r14653 --- branches/5.2.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 14608) +++ branches/5.2.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 14653) @@ -1,6 +1,6 @@ Prefix . '-cdata.' . $this->Special, '.'); - $cdata =& $this->Application->recallObject($cdata_key, null, Array ('skip_autoload' => true, 'populate_ml_fields' => true)); + $cdata =& $this->Application->recallObject($cdata_key, null, Array ('skip_autoload' => true)); /* @var $cdata kDBItem */ $resource_id = $this->GetDBField('ResourceId'); @@ -1375,9 +1375,22 @@ $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + + $languages = $ml_helper->getLanguages(); + foreach ($this->customFields as $custom_id => $custom_name) { $force_primary = $cdata->GetFieldOption('cust_' . $custom_id, 'force_primary'); - $cdata->SetDBField($ml_formatter->LangFieldName('cust_' . $custom_id, $force_primary), $this->GetDBField('cust_' . $custom_name)); + + if ( $force_primary ) { + $cdata->SetDBField($ml_formatter->LangFieldName('cust_' . $custom_id, true), $this->GetDBField('cust_' . $custom_name)); + } + else { + foreach ($languages as $language_id) { + $cdata->SetDBField('l' . $language_id . '_cust_' . $custom_id, $this->GetDBField('l' . $language_id . '_cust_' . $custom_name)); + } + } } return $cdata->isLoaded() ? $cdata->Update() : $cdata->Create();