Index: branches/RC/core/units/general/cat_dbitem.php =================================================================== diff -u -N -r9824 -r11368 --- branches/RC/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 9824) +++ branches/RC/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 11368) @@ -42,13 +42,16 @@ $this->usePendingEditing = $this->Application->getUnitOption($this->Prefix, 'UsePendingEditing'); } - function Create($force_id=false, $system_create=false) + function Create($force_id = false, $system_create = false) { - if (!$this->Validate()) return false; + // TODO: move to OnBeforeItemCreate method + if ($this->Validate()) { + // TODO: such approach will not respect changes from OnBeforeItemCreate event + $this->SetDBField('ResourceId', $this->Application->NextResourceId()); + } - $this->SetDBField('ResourceId', $this->Application->NextResourceId()); - $this->SetDBField('Modified', adodb_mktime() ); - $this->UpdateFormattersSubFields(array('Modified')); + $this->SetDBField('Modified_date', adodb_mktime() ); + $this->SetDBField('Modified_time', adodb_mktime() ); if ($this->mode != 't' && !$this->Application->IsAdmin()) { $owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField'); @@ -63,8 +66,10 @@ $this->generateFilename(); } - $ret = parent::Create(); + $ret = parent::Create($force_id, $system_create); + if ($ret) { + // TODO: move to OnAfterItemCreate method $this->assignPrimaryCategory(); } return $ret;