From 899152b8c62f83c319a2a846698fc9615382a902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 5 Apr 2013 22:28:12 +0200 Subject: [PATCH] Fix ordering in RoomList --- file/lib/acp/page/RoomListPage.class.php | 2 +- file/lib/data/room/RoomAction.class.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/file/lib/acp/page/RoomListPage.class.php b/file/lib/acp/page/RoomListPage.class.php index 468f308..7bb93b2 100644 --- a/file/lib/acp/page/RoomListPage.class.php +++ b/file/lib/acp/page/RoomListPage.class.php @@ -38,7 +38,7 @@ public function readData() { parent::readData(); $this->objects = new \chat\data\room\RoomList(); - $this->objects->sqlOrder = 'position ASC'; + $this->objects->sqlOrderBy = 'position ASC'; $this->objects->readObjects(); } diff --git a/file/lib/data/room/RoomAction.class.php b/file/lib/data/room/RoomAction.class.php index 1848c28..47a2ba3 100644 --- a/file/lib/data/room/RoomAction.class.php +++ b/file/lib/data/room/RoomAction.class.php @@ -98,8 +98,6 @@ public function validateUpdatePosition() { if (!isset($this->parameters['data']['structure'])) { throw new \wcf\system\exception\UserInputException('structure'); } - - if (!isset($this->parameters['data']['offset'])) $this->parameters['data']['offset'] = 0; } /** @@ -107,14 +105,14 @@ public function validateUpdatePosition() { */ public function updatePosition() { $roomList = new RoomList(); - $roomList->sqlOrderBy = "room.position"; $roomList->readObjects(); - $i = $this->parameters['data']['offset']; + $i = 0; WCF::getDB()->beginTransaction(); foreach ($this->parameters['data']['structure'][0] as $roomID) { $room = $roomList->search($roomID); if ($room === null) continue; + $editor = new RoomEditor($room); $editor->update(array('position' => $i++)); }