From: Matthias Schmidt Date: Fri, 6 May 2016 10:59:57 +0000 (+0200) Subject: Fix creating/editing boxes without controller X-Git-Tag: 3.0.0_Beta_1~1759 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=66be27679580b034f04202473e3ebc2afa42c219;p=GitHub%2FWoltLab%2FWCF.git Fix creating/editing boxes without controller --- 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) {