mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX sql syntax error when sort order not defined.
This commit is contained in:
parent
70f3da80df
commit
57ea4fc23d
|
|
@ -226,7 +226,7 @@ abstract class DoliDB implements Database
|
|||
*/
|
||||
function order($sortfield=null,$sortorder=null)
|
||||
{
|
||||
if (isset($sortfield))
|
||||
if (! empty($sortfield))
|
||||
{
|
||||
$return='';
|
||||
$fields=explode(',',$sortfield);
|
||||
|
|
@ -236,7 +236,7 @@ abstract class DoliDB implements Database
|
|||
else $return.=',';
|
||||
|
||||
$return.=preg_replace('/[^0-9a-z_\.]/i','',$val);
|
||||
if (isset($sortorder))
|
||||
if (! empty($sortorder))
|
||||
{
|
||||
$return.=' '.preg_replace('/[^0-9a-z]/i','',$sortorder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ $sql.= " AND p.fk_statut = 1";
|
|||
if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
$sql.= " GROUP BY s.nom, s.rowid";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
$var=true;
|
||||
$resql = $db->query($sql);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user