Index: branches/5.2.x/core/kernel/event_manager.php =================================================================== diff -u -N -r15252 -r15290 --- branches/5.2.x/core/kernel/event_manager.php (.../event_manager.php) (revision 15252) +++ branches/5.2.x/core/kernel/event_manager.php (.../event_manager.php) (revision 15290) @@ -1,6 +1,6 @@ Application->recallObject('c'); /* @var $category kDBItem */ if ( $category->isLoaded() ) { - $category_ids = trim(str_replace('|', ',', $category->GetDBField('ParentPath')), ','); + $category_ids = explode('|', substr($category->GetDBField('ParentPath'), 1, -1)); } } catch (Exception $e) { @@ -328,6 +329,8 @@ $where_clause['CategoryId'] = $this->_getSubscriberFilter('CategoryId', $category_ids, true); try { + $item_id = $parent_item_id = false; + $object = $event->getObject(); /* @var $object kDBItem */ @@ -385,17 +388,22 @@ * * @param string $field * @param mixed $value - * @param bool $use_in_clause + * @param bool $is_category * @return string * @access protected */ - protected function _getSubscriberFilter($field, $value, $use_in_clause = false) + protected function _getSubscriberFilter($field, $value, $is_category = false) { if ( $value ) { // send to this item subscribers AND to subscribers to all items - $clause = $use_in_clause ? ' IN (' . $value . ')' : ' = ' . $this->Conn->qstr($value); + if ( $is_category ) { + $clause = 'IF(IncludeSublevels = 1, ' . $field . ' IN (' . implode(',', $value) . '), ' . $field . ' = ' . end($value) . ')'; + } + else { + $clause = $field . ' = ' . $this->Conn->qstr($value); + } - return $field . $clause . ' OR ' . $field . ' IS NULL'; + return $clause . ' OR ' . $field . ' IS NULL'; } // send to subscribers to all items