From eb14e25e2a7ceec8088586118c9da0e9f377e208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Thu, 17 Oct 2013 11:33:05 +0200 Subject: [PATCH] // small fix for some order by on listing --- classes/controller/AdminController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index aa184d885..01f069f44 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2189,8 +2189,10 @@ class AdminControllerCore extends Controller if (preg_match('/[.!]/', $order_by)) { $order_by_split = preg_split('/[.!]/', $order_by); - $order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`'; + $order_by = bqSQL($order_by_split[0]).'.`'.bqSQL($order_by_split[1]).'`'; } + elseif ($order_by) + $order_by = '`'.bqSQL($order_by).'`'; $this->_orderWay = Tools::strtoupper($order_way); @@ -2284,7 +2286,7 @@ class AdminControllerCore extends Controller (isset($this->_filter) ? $this->_filter : '').$where_shop.' '.(isset($this->_group) ? $this->_group.' ' : '').' '.$having_clause.' - ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way). + ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').$order_by.' '.pSQL($order_way). ($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : ''). (($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');