Index: branches/unlabeled/unlabeled-1.25.2/core/units/categories/categories_event_handler.php =================================================================== diff -u -r7036 -r7048 --- branches/unlabeled/unlabeled-1.25.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 7036) +++ branches/unlabeled/unlabeled-1.25.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 7048) @@ -40,14 +40,26 @@ } $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); - $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); - $sql = 'SELECT '.$id_field.', CreatedById - FROM '.$table_name.' item_table - WHERE '.$id_field.' IN ('.$selected_ids.')'; - $items = $this->Conn->Query($sql, $id_field); - + + if (strlen($selected_ids) > 0) { + $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $sql = 'SELECT '.$id_field.', CreatedById + FROM '.$table_name.' item_table + WHERE '.$id_field.' IN ('.$selected_ids.')'; + $items = $this->Conn->Query($sql, $id_field); + } + else { + // when creating new category, then no IDs are stored in session + $parent_cat = $this->Application->RecallVar('m_cat_id'); + $items[$parent_cat] = Array ( + $id_field => $parent_cat, + 'CreatedById' => $this->Application->RecallVar('user_id'), + ); + } $perm_value = true; $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + /* @var $perm_helper kPermissionsHelper */ + foreach ($items as $item_id => $item_data) { if ($perm_helper->ModifyCheckPermission($item_data['CreatedById'], $item_data[$id_field], $event->Prefix) == 0) { // one of items selected has no permission