Index: branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_item.php =================================================================== diff -u -r7060 -r7090 --- branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 7060) +++ branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 7090) @@ -5,18 +5,18 @@ function Create($force_id=false, $system_create=false) { if (!$this->Validate()) return false; - + $this->SetDBField('ResourceId', $this->Application->NextResourceId()); $this->SetDBField('CreatedById', $this->Application->RecallVar('user_id') ); $this->SetDBField('CreatedOn_date', adodb_mktime() ); $this->SetDBField('CreatedOn_time', adodb_mktime() ); - + $this->checkFilename(); $this->generateFilename(); $parent_category = $this->GetDBField('ParentId') > 0 ? $this->GetDBField('ParentId') : $this->Application->GetVar('m_cat_id'); $this->SetDBField('ParentId', $parent_category); - + $ret = parent::Create($force_id, $system_create); if ($ret) { $sql = 'UPDATE %s SET ParentPath = %s WHERE CategoryId = %s'; @@ -33,15 +33,15 @@ { $this->checkFilename(); $this->generateFilename(); - + $ret = parent::Update($id, $system_update); return $ret; } - + function buildParentPath() { $parent_id = $this->GetDBField('ParentId'); - + if ($parent_id == 0) { $parent_path = '|'; } @@ -50,7 +50,7 @@ $sql = 'SELECT ParentPath FROM '.$cat_table.' WHERE CategoryId = %s'; $parent_path = $this->Conn->GetOne( sprintf($sql, $parent_id) ); } - + return $parent_path.$this->GetID().'|'; } @@ -140,7 +140,7 @@ if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name); } - + /** * Allows to detect if root category being edited * @@ -157,18 +157,18 @@ return true; } } - + return false; } - + /** * Sets correct name to Home category while editing it * * @return bool */ function IsNewItem() { - if ($this->IsRoot()) { + if ($this->IsRoot() && $this->Prefix == 'c') { $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); $category_name = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') ); $this->SetDBField($title_field, $category_name);