From 66be27679580b034f04202473e3ebc2afa42c219 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 6 May 2016 12:59:57 +0200 Subject: [PATCH] Fix creating/editing boxes without controller --- .../install/files/lib/acp/form/BoxAddForm.class.php | 10 +++++++--- .../install/files/lib/acp/form/BoxEditForm.class.php | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php b/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php index f18b23675b..7d3f6f57fb 100644 --- a/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php @@ -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 diff --git a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php index ecb9b043e7..e4358c10dc 100644 --- a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php @@ -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) { -- 2.20.1