From e22eaec204eaa797c2b4a22f91a0b4fb8b671ebe Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Thu, 8 Dec 2011 16:04:44 +1300 Subject: [PATCH] BUGFIX Restfulserver should use the correct way when sorting SS_Lists --- api/RestfulServer.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/RestfulServer.php b/api/RestfulServer.php index b2825050e..32bdce941 100644 --- a/api/RestfulServer.php +++ b/api/RestfulServer.php @@ -203,10 +203,13 @@ class RestfulServer extends Controller { * @return String The serialized representation of the requested object(s) - usually XML or JSON. */ protected function getHandler($className, $id, $relationName) { - $sort = array( - 'sort' => $this->request->getVar('sort'), - 'dir' => $this->request->getVar('dir') - ); + $sort = ''; + + if($this->request->getVar('sort')) { + $dir = $this->request->getVar('dir'); + $sort = array($this->request->getVar('sort') => ($dir ? $dir : 'ASC')); + } + $limit = array( 'start' => $this->request->getVar('start'), 'limit' => $this->request->getVar('limit')