Fix creating/editing boxes without controller
authorMatthias Schmidt <gravatronics@live.com>
Fri, 6 May 2016 10:59:57 +0000 (12:59 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 6 May 2016 10:59:57 +0000 (12:59 +0200)
wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php
wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php

index f18b23675bb07b538ef7b3247d7572b6b7f902c5..7d3f6f57fb1a19fede614f8f43c72e907a1c2b6a 100644 (file)
@@ -373,9 +373,8 @@ class BoxAddForm extends AbstractForm {
                        ];
                }
                
-               $this->objectAction = new BoxAction([], 'create', ['data' => array_merge($this->additionalFields, [
+               $data = [
                        'name' => $this->name,
-                       'objectTypeID' => $this->boxControllerID,
                        'packageID' => 1,
                        'isMultilingual' => $this->isMultilingual,
                        'boxType' => $this->boxType,
@@ -388,7 +387,12 @@ class BoxAddForm extends AbstractForm {
                        'linkPageObjectID' => ($this->linkPageObjectID ?: 0),
                        'externalURL' => $this->externalURL,
                        'identifier' => ''
-               ]), 'content' => $content, 'pageIDs' => $this->pageIDs ]);
+               ];
+               if ($this->boxControllerID) {
+                       $data['objectTypeID'] = $this->boxControllerID;
+               }
+               
+               $this->objectAction = new BoxAction([], 'create', ['data' => array_merge($this->additionalFields, $data), 'content' => $content, 'pageIDs' => $this->pageIDs ]);
                $box = $this->objectAction->executeAction()['returnValues'];
                
                // set generic box identifier
index ecb9b043e7c20668f5aaf1466d217512eaf45ee0..e4358c10dcf9482e0c8bf47a1d4ab9d02bc5105a 100644 (file)
@@ -89,9 +89,8 @@ class BoxEditForm extends BoxAddForm {
                        ];
                }
                
-               $this->objectAction = new BoxAction([$this->box], 'update', ['data' => array_merge($this->additionalFields, [
+               $data = [
                        'name' => $this->name,
-                       'objectTypeID' => $this->boxControllerID,
                        'isMultilingual' => $this->isMultilingual,
                        'boxType' => $this->boxType,
                        'position' => $this->position,
@@ -102,7 +101,12 @@ class BoxEditForm extends BoxAddForm {
                        'linkPageID' => $this->linkPageID,
                        'linkPageObjectID' => ($this->linkPageObjectID ?: 0),
                        'externalURL' => $this->externalURL
-               ]), 'content' => $content, 'pageIDs' => $this->pageIDs]);
+               ];
+               if ($this->boxControllerID) {
+                       $data['objectTypeID'] = $this->boxControllerID;
+               }
+               
+               $this->objectAction = new BoxAction([$this->box], 'update', ['data' => array_merge($this->additionalFields, $data), 'content' => $content, 'pageIDs' => $this->pageIDs]);
                $this->objectAction->executeAction();
                
                if ($this->boxController && $this->boxController->getProcessor() instanceof IConditionBoxController) {