Index: branches/5.2.x/core/kernel/db/cat_event_handler.php =================================================================== diff -u -N -r14685 -r14719 --- branches/5.2.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 14685) +++ branches/5.2.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 14719) @@ -1,6 +1,6 @@ CallSubEvent('OnAfterItemDelete'); } } + + if ( $object->GetChangedFields() ) { + $now = adodb_mktime(); + $object->SetDBField('Modified_date', $now); + $object->SetDBField('Modified_time', $now); + $object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id')); + } } /** @@ -1012,14 +1019,16 @@ { parent::OnAfterItemCreate($event); + $object =& $event->getObject(); + /* @var $object kCatDBItem */ + if ( substr($event->Special, -6) == 'import' ) { $this->setCustomExportColumns($event); } - if ( !$this->Application->isAdmin ) { - $object =& $event->getObject(); - /* @var $object kCatDBItem */ + $object->assignPrimaryCategory(); + if ( !$this->Application->isAdmin ) { $image_helper =& $this->Application->recallObject('ImageHelper'); /* @var $image_helper ImageHelper */ @@ -2303,10 +2312,6 @@ $object->SetDBField($owner_field, $this->Application->RecallVar('user_id')); } - if ( $object->Validate() ) { - $object->SetDBField('ResourceId', $this->Application->NextResourceId()); - } - if ( !$this->Application->isAdmin ) { $this->setItemStatusByPermission($event); } @@ -2865,4 +2870,23 @@ $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones); } } + + /** + * Set's new unique resource id to user + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnAfterItemValidate(kEvent &$event) + { + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $resource_id = $object->GetDBField('ResourceId'); + + if ( !$resource_id ) { + $object->SetDBField('ResourceId', $this->Application->NextResourceId()); + } + } } \ No newline at end of file