Simplify showOrder input
authorJoshua Rüsweg <ruesweg@woltlab.com>
Sun, 12 May 2019 15:18:39 +0000 (17:18 +0200)
committerJoshua Rüsweg <ruesweg@woltlab.com>
Sun, 12 May 2019 15:19:16 +0000 (17:19 +0200)
See #2508

wcfsetup/install/files/lib/acp/form/ReactionTypeAddForm.class.php
wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php

index bff6c926db0b51e858d8d9147b622bb3a77b7aaf..dce9282938fc90a0d231d3dce841aa1e1e5bf75f 100644 (file)
@@ -72,20 +72,7 @@ class ReactionTypeAddForm extends AbstractFormBuilderForm {
                                ShowOrderFormField::create()
                                        ->description('wcf.acp.reactionType.showOrder.description')
                                        ->required()
-                                       ->options(function () {
-                                               $list = new ReactionTypeList();
-                                               $list->sqlOrderBy = 'showOrder ASC';
-                                               $list->readObjects();
-                                               
-                                               $returnValues = [];
-                                               
-                                               foreach ($list as $reactionType) {
-                                                       $returnValues[$reactionType->showOrder + 1] = $reactionType->getTitle();
-                                               }
-                                               
-                                               return $returnValues;
-                                               
-                                       }),
+                                       ->options(new ReactionTypeList()),
                                IsDisabledFormField::create()
                                        ->label('wcf.acp.reactionType.isDisabled')
                        ]);
index 09488edd87bdd0b515ae4c156c634308324eaafc..67262a9e1e397d425d65609a4b50e3350ff327d7 100644 (file)
@@ -153,7 +153,7 @@ class ReactionTypeAction extends AbstractDatabaseObjectAction implements ISortab
                                
                                $sql = "UPDATE  wcf" . WCF_N . "_reaction_type
                                        SET     showOrder = showOrder - 1
-                                       WHERE   showOrder >= ?";
+                                       WHERE   showOrder > ?";
                                $statement = WCF::getDB()->prepareStatement($sql);
                                $statement->execute([
                                        $object->showOrder