Index: branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5615 -r5616 --- branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5615) +++ branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5616) @@ -79,7 +79,7 @@ // apply status filter only on front $object->addFilter('status_filter', $object->TableName.'.Status = 1'); } - + if(strpos($types, 'category_related') !== false) { $object->removeFilter('parent_filter'); @@ -317,7 +317,7 @@ } $this->clearSelectedIDs($event); } - + /** * Add selected items to clipboard with mode = COPY (CLONE) * @@ -328,7 +328,7 @@ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper'); $clipboard_helper->setClipboard($event, 'copy', $this->StoreSelectedIDs($event)); } - + /** * Add selected items to clipboard with mode = CUT * @@ -353,7 +353,7 @@ $this->Application->HandleEvent($paste_event); } } - + /** * Paste categories with subitems from clipboard * @@ -363,8 +363,8 @@ { echo 'performs category paste'; $event->redirect = false; - - + + /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard'); if ($ids == '') { $event->redirect = false; @@ -390,7 +390,7 @@ } $event->status = erSUCCESS;*/ } - + /** * Occurs when pasting category * @@ -424,11 +424,11 @@ $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); if($item_ids) $temp->CloneItems($event->Prefix, $event->Special, $item_ids); } - + $this->Application->SetVar('m_cat_id', $saved_cat_id); } }*/ - + /** * Cleares clipboard content * @@ -438,6 +438,24 @@ { $this->Application->RemoveVar('clipboard'); } + + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnBeforeDeleteFromLive(&$event) + { + $foreign_keys = $event->getEventParam('foreign_key'); + + // Do not delete live sub-items with 0 id + // otherwise home category permissions got deleted when creating new category + $zero_id = array_search(0, $foreign_keys); + if ($zero_id !== false) { + array_splice($foreign_keys, $zero_id, 1); + } + } } ?> \ No newline at end of file