Index: branches/5.0.x/core/kernel/db/dbitem.php =================================================================== diff -u -N -r13598 -r13603 --- branches/5.0.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 13598) +++ branches/5.0.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 13603) @@ -1,6 +1,6 @@ mode != 't') { $this->Application->resetCounters($this->TableName); } + + if ($this->IsTempTable() && ($this->Application->GetTopmostPrefix($this->Prefix) != $this->Prefix)) { + // temp table + subitem = set negative id + $this->setTempID(); + } + $this->raiseEvent('OnAfterItemCreate'); $this->Loaded = true; @@ -1288,15 +1294,7 @@ $cdata->SetDBField($ml_formatter->LangFieldName('cust_'.$custom_id, $force_primary), $this->GetDBField('cust_'.$custom_name)); } - if ($cdata->isLoaded()) { - $ret = $cdata->Update(); - } - else { - $ret = $cdata->Create(); - if ($cdata->mode == 't') $cdata->setTempID(); - } - - return $ret; + return $cdata->isLoaded() ? $cdata->Update() : $cdata->Create(); } /**