Index: branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php =================================================================== diff -u -r5573 -r5587 --- branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5573) +++ branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5587) @@ -1694,6 +1694,33 @@ /* === RELATED TO IMPORT/EXPORT: END === */ + /** + * Stores item's owner login into separate field together with id + * + * @param kEvent $event + * @param string $id_field + * @param string $cached_field + */ + function cacheItemOwner(&$event, $id_field, $cached_field) + { + $object =& $event->getObject(); + + $user_id = $object->GetDBField($id_field); + $options = $object->GetFieldOptions($id_field); + if (isset($options['options'][$user_id])) { + $object->SetDBField($cached_field, $options['options'][$user_id]); + } + else { + $id_field = $this->Application->getUnitOption('u', 'IDField'); + $table_name = $this->Application->getUnitOption('u', 'TableName'); + + $sql = 'SELECT Login + FROM '.$table_name.' + WHERE '.$id_field.' = '.$user_id; + $object->SetDBField($cached_field, $this->Conn->GetOne($sql)); + } + } + } ?> \ No newline at end of file