Index: branches/5.2.x/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r15361 -r15390 --- branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 15361) +++ branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 15390) @@ -1,6 +1,6 @@ Application->getUnitOption($event->Prefix, 'IDField') . ' FROM ' . $this->Application->getUnitOption($event->Prefix, 'TableName') . ' WHERE ( - (NamedParentPath = ' . $this->Conn->qstr($template) . ') OR - (NamedParentPath = ' . $this->Conn->qstr('Content/' . $template) . ') OR - (`Type` = ' . PAGE_TYPE_TEMPLATE . ' AND CachedTemplate = ' . $this->Conn->qstr($template) . ') + (NamedParentPathHash = ' . $template_crc . ') OR + (`Type` = ' . PAGE_TYPE_TEMPLATE . ' AND CachedTemplateHash = ' . $template_crc . ') ) AND (ThemeId = ' . $this->_getCurrentThemeId() . ' OR ThemeId = 0)'; $page_id = $this->Conn->GetOne($sql); @@ -719,7 +720,7 @@ if ( $event->getEventParam('temp_id') == 0 ) { if ( $object->isLoaded() ) { // update path only for real categories (not including "Home" root category) - $fields_hash = Array ('ParentPath' => $object->buildParentPath()); + $fields_hash = $object->buildParentBasedFields(); $this->Conn->doUpdate($fields_hash, $object->TableName, 'CategoryId = ' . $object->GetID()); $parent_path = $fields_hash['ParentPath']; } @@ -2213,14 +2214,9 @@ /* @var $object CategoriesItem */ // need to update path after category is created, so category is included in that path - $parent_path = $object->buildParentPath(); - - $sql = 'UPDATE ' . $object->TableName . ' - SET ParentPath = ' . $this->Conn->qstr($parent_path) . ' - WHERE CategoryId = ' . $object->GetID(); - $this->Conn->Query($sql); - - $object->SetDBField('ParentPath', $parent_path); + $fields_hash = $object->buildParentBasedFields(); + $this->Conn->doUpdate($fields_hash, $object->TableName, $object->IDField . ' = ' . $object->GetID()); + $object->SetDBFieldsFromHash($fields_hash); } /**