From 78dccddaac0885d25fb66087af25520224bbcdf3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sun, 12 May 2019 17:24:06 +0200 Subject: [PATCH] Restruct showOrder after object deletion See #2508 --- .../type/ReactionTypeAction.class.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php index 67262a9e1e..3bdae6773c 100644 --- a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php @@ -203,4 +203,23 @@ class ReactionTypeAction extends AbstractDatabaseObjectAction implements ISortab } WCF::getDB()->commitTransaction(); } + + /** + * @inheritDoc + */ + public function delete() { + $returnValues = parent::delete(); + + $sql = "UPDATE wcf" . WCF_N . "_reaction_type + SET showOrder = showOrder - 1 + WHERE showOrder > ?"; + $statement = WCF::getDB()->prepareStatement($sql); + foreach ($this->getObjects() as $object) { + $statement->execute([ + $object->showOrder + ]); + } + + return $returnValues; + } } -- 2.20.1