[-] MO : #PSTEST-44 : Category cannot be parent of herself

This commit is contained in:
lLefevre
2011-12-20 14:28:01 +00:00
parent ae70918b3e
commit 53eaec4b99
2 changed files with 372 additions and 369 deletions
@@ -315,13 +315,17 @@ class AdminCategoriesControllerCore extends AdminController
if (Tools::isSubmit('submitAdd'.$this->table))
{
if ($id_category = (int)Tools::getValue('id_category'))
$id_category = (int)Tools::getValue('id_category');
$id_parent = (int)Tools::getValue('id_parent');
if ($id_category)
{
if (!Category::checkBeforeMove($id_category, $this->_category->id_parent))
if ($id_category != $id_parent)
{
$this->_errors[] = Tools::displayError('Category cannot be moved here');
return false;
if (!Category::checkBeforeMove($id_category, $id_parent))
$this->_errors[] = Tools::displayError($this->l('Category cannot be moved here'));
}
else
$this->_errors[] = Tools::displayError($this->l('Category cannot be parent of herself.'));
}
}
/* Delete object */