Add category API to react to changed parent category (2)
authorMatthias Schmidt <gravatronics@live.com>
Tue, 24 Feb 2015 17:38:16 +0000 (18:38 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 24 Feb 2015 17:38:16 +0000 (18:38 +0100)
wcfsetup/install/files/lib/data/category/CategoryAction.class.php

index 547e4cdf2d1b8967dec795a9f10d082f4219b544..c3a89937351060f7791505447bc0fe42ace381bb 100644 (file)
@@ -92,7 +92,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc
                
                parent::update();
                
-               if ($this->parameters['data']['parentCategoryID']) {
+               if (isset($this->parameters['data']['parentCategoryID'])) {
                        $objectType = null;
                        $parentUpdates = array();
                        
@@ -102,7 +102,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc
                                }
                                
                                if ($category->parentCategoryID != $this->parameters['data']['parentCategoryID']) {
-                                       $parentUpdates[$categoryID] = array(
+                                       $parentUpdates[$category->categoryID] = array(
                                                'oldParentCategoryID' => $category->parentCategoryID,
                                                'newParentCategoryID' => $this->parameters['data']['parentCategoryID']
                                        );