From dc4a874e70143d61181d3a10b0952679950ea515 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Tue, 23 Dec 2014 13:07:16 +0100 Subject: [PATCH] Fixed: [ bug #1690 ] Sorting on salary table triggers SQL errors --- htdocs/compta/charges/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index dd6455a3932..ca03e11bcba 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -102,7 +102,7 @@ if ($conf->salaries->enabled) // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire $sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - if (preg_match('/^s/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + if (preg_match('/^s\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder); $result = $db->query($sql); if ($result) @@ -204,7 +204,7 @@ if ($conf->tax->enabled) $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= ")"; } - if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + if (preg_match('/^cs\./',$sortfield) || preg_match('/^c\./',$sortfield) || preg_match('/^pc\./',$sortfield) || preg_match('/^pct\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder); //$sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -295,7 +295,7 @@ if ($conf->tax->enabled) // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire $sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + if (preg_match('/^pv\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder); $result = $db->query($sql); if ($result) -- GitLab