From e9288027fd244ea03f5b210848927b56f49feff6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 16 Apr 2010 18:02:59 +0000 Subject: [PATCH] Fix: pgsql compatibility --- htdocs/product/product.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/product/product.class.php b/htdocs/product/product.class.php index cdaf4a66c12..86098e25d9a 100644 --- a/htdocs/product/product.class.php +++ b/htdocs/product/product.class.php @@ -1454,7 +1454,8 @@ class Product extends CommonObject $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND f.fk_soc = $socid"; - $sql.= " GROUP BY date_format(f.datef,'%Y%m') DESC"; + $sql.= " GROUP BY date_format(f.datef,'%Y%m')"; + $sql.= " ORDER BY date_format(f.datef,'%Y%m') DESC"; return $this->_get_stats($sql,$mode); } @@ -1481,7 +1482,8 @@ class Product extends CommonObject $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND f.fk_soc = $socid"; - $sql.= " GROUP BY date_format(f.datef,'%Y%m') DESC"; + $sql.= " GROUP BY date_format(f.datef,'%Y%m')"; + $sql.= " ORDER BY date_format(f.datef,'%Y%m') DESC"; $resarray=$this->_get_stats($sql,$mode); return $resarray; @@ -1508,7 +1510,8 @@ class Product extends CommonObject $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND p.fk_soc = ".$socid; - $sql.= " GROUP BY date_format(p.datep,'%Y%m') DESC"; + $sql.= " GROUP BY date_format(p.datep,'%Y%m')"; + $sql.= " ORDER BY date_format(p.datep,'%Y%m') DESC"; return $this->_get_stats($sql,$mode); } @@ -1533,7 +1536,8 @@ class Product extends CommonObject $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; - $sql.= " GROUP BY date_format(c.date_commande,'%Y%m') DESC"; + $sql.= " GROUP BY date_format(c.date_commande,'%Y%m')"; + $sql.= " ORDER BY date_format(c.date_commande,'%Y%m') DESC"; return $this->_get_stats($sql,$mode); }