Skip to content
Snippets Groups Projects
Commit dc4a874e authored by Laurent Destailleur's avatar Laurent Destailleur Committed by Juanjo Menent
Browse files

Fixed: [ bug #1690 ] Sorting on salary table triggers SQL errors

parent 08fd74e7
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,7 @@ if ($conf->salaries->enabled) ...@@ -102,7 +102,7 @@ if ($conf->salaries->enabled)
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire // 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))."'"; $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); $result = $db->query($sql);
if ($result) if ($result)
...@@ -204,7 +204,7 @@ if ($conf->tax->enabled) ...@@ -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 .= " 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 .= ")"; $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); //$sql.= $db->plimit($limit+1,$offset);
//print $sql; //print $sql;
...@@ -295,7 +295,7 @@ if ($conf->tax->enabled) ...@@ -295,7 +295,7 @@ if ($conf->tax->enabled)
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire // 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))."'"; $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); $result = $db->query($sql);
if ($result) if ($result)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment