From cb768e2188ff36ba17353e392b1568a68cd5e164 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 29 Sep 2023 00:11:18 +0200 Subject: [PATCH] Preserve the label selection on validation errors --- .../files/lib/acp/form/ArticleAddForm.class.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php index 5587f21e77..c39dd24450 100644 --- a/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php @@ -477,14 +477,6 @@ class ArticleAddForm extends AbstractForm // reset category ids to accessible category ids ArticleLabelObjectHandler::getInstance()->setCategoryIDs(ArticleCategory::getAccessibleCategoryIDs()); - if (!empty($validationResult[0])) { - throw new UserInputException('labelIDs'); - } - - if (!empty($validationResult)) { - throw new UserInputException('label', $validationResult); - } - foreach ($this->labelIDs as $groupID => $labelID) { foreach ($this->labelPickers as $labelPicker) { if ($labelPicker->labelGroup->groupID == $groupID) { @@ -492,6 +484,14 @@ class ArticleAddForm extends AbstractForm } } } + + if (!empty($validationResult[0])) { + throw new UserInputException('labelIDs'); + } + + if (!empty($validationResult)) { + throw new UserInputException('label', $validationResult); + } } /** @@ -668,7 +668,6 @@ class ArticleAddForm extends AbstractForm 'availableLanguages' => $this->availableLanguages, 'categoryNodeList' => (new CategoryNodeTree('com.woltlab.wcf.article.category'))->getIterator(), 'accessibleCategoryIDs' => ArticleCategory::getAccessibleCategoryIDs(), - 'labelIDs' => $this->labelIDs, 'labelGroupsToCategories' => $this->labelGroupsToCategories, 'labelPickers' => $this->labelPickers, 'attachmentHandler' => $this->attachmentHandler, -- 2.20.1