Fixes validation order in LabelAddForm::validate()
authorMatthias Schmidt <gravatronics@live.com>
Mon, 17 Jun 2013 08:43:40 +0000 (10:43 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 17 Jun 2013 08:43:40 +0000 (10:43 +0200)
wcfsetup/install/files/lib/acp/form/LabelAddForm.class.php

index 01d173e37960d6fe4fb440d444daede525b1b9f0..9b45087b2f9c5b35085e1bb05c31b1f7ccb20706 100644 (file)
@@ -111,6 +111,15 @@ class LabelAddForm extends AbstractForm {
        public function validate() {
                parent::validate();
                
+               // validate group
+               if (!$this->groupID) {
+                       throw new UserInputException('groupID');
+               }
+               $groups = $this->labelGroupList->getObjects();
+               if (!isset($groups[$this->groupID])) {
+                       throw new UserInputException('groupID', 'notValid');
+               }
+               
                // validate label
                if (!I18nHandler::getInstance()->validateValue('label')) {
                        if (I18nHandler::getInstance()->isPlainValue('label')) {
@@ -121,15 +130,7 @@ class LabelAddForm extends AbstractForm {
                        }
                }
                
-               // validate group
-               if (!$this->groupID) {
-                       throw new UserInputException('groupID');
-               }
-               $groups = $this->labelGroupList->getObjects();
-               if (!isset($groups[$this->groupID])) {
-                       throw new UserInputException('groupID', 'notValid');
-               }
-               
+               // validate class name
                if (empty($this->cssClassName)) {
                        throw new UserInputException('cssClassName', 'empty');
                }