From 84fa92045c549bc8070f31439572567f571d024b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 23 Sep 2015 12:10:38 +0200 Subject: [PATCH] FIX : avoid SQL error when no sortfield send to method --- htdocs/product/class/productcustomerprice.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 1bca4579070..dd072e19a2f 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -351,8 +351,9 @@ class Productcustomerprice extends CommonObject } } } - - $sql.= $this->db->order($sortfield, $sortorder); + if (!empty($sortfield)) { + $sql.= $this->db->order($sortfield, $sortorder); + } if (! empty($limit)) $sql .= ' ' . $this->db->plimit($limit + 1, $offset); dol_syslog(get_class($this) . "::fetch_all", LOG_DEBUG);