Index: branches/5.1.x/core/kernel/db/cat_event_handler.php =================================================================== diff -u -N -r13987 -r14002 --- branches/5.1.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 13987) +++ branches/5.1.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 14002) @@ -1,6 +1,6 @@ setCustomExportColumns($event); } - if (!$this->Application->isAdminUser) { - $object =& $event->getObject(); - /* @var $object kDBItem */ + $object =& $event->getObject(); + /* @var $object kDBItem */ + if (!$this->Application->isAdminUser) { $image_helper =& $this->Application->recallObject('ImageHelper'); /* @var $image_helper ImageHelper */ @@ -989,6 +989,19 @@ $this->processAdditionalCategories($object, 'update'); } } + + $recycle_bin = $this->Application->ConfigValue('RecycleBinFolder'); + + if ($this->Application->isAdminUser && $recycle_bin) { + $sql = 'SELECT CategoryId + FROM ' . $this->Application->getUnitOption('ci', 'TableName') . ' + WHERE ItemResourceId = ' . $object->GetDBField('ResourceId') . ' AND PrimaryCat = 1'; + $primary_category = $this->Conn->GetOne($sql); + + if ($primary_category == $recycle_bin) { + $event->CallSubEvent('OnAfterItemDelete'); + } + } } /**