// added prestashopexception when id_category is wrong when update/save
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9822 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
575939017b
commit
581cdc12e9
1 file changed
+4
@@ -195,6 +195,8 @@ class CategoryCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function update($nullValues = false)
|
public function update($nullValues = false)
|
||||||
{
|
{
|
||||||
|
if ($this->id_parent == $this->id)
|
||||||
|
throw new PrestashopException('a category cannot be it\'s own parent');
|
||||||
// Update group selection
|
// Update group selection
|
||||||
$this->updateGroup($this->groupBox);
|
$this->updateGroup($this->groupBox);
|
||||||
$this->level_depth = $this->calcLevelDepth();
|
$this->level_depth = $this->calcLevelDepth();
|
||||||
@@ -425,6 +427,8 @@ class CategoryCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function recalculateLevelDepth($id_category)
|
public function recalculateLevelDepth($id_category)
|
||||||
{
|
{
|
||||||
|
if (!is_numeric($id_category))
|
||||||
|
throw new PrestashopException('id category is not numeric');
|
||||||
/* Gets all children */
|
/* Gets all children */
|
||||||
$categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT id_category, id_parent, level_depth
|
SELECT id_category, id_parent, level_depth
|
||||||
|
|||||||
Reference in new issue
Block a user