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)
|
function order($sortfield=null,$sortorder=null)
|
||||||
{
|
{
|
||||||
if (isset($sortfield))
|
if (! empty($sortfield))
|
||||||
{
|
{
|
||||||
$return='';
|
$return='';
|
||||||
$fields=explode(',',$sortfield);
|
$fields=explode(',',$sortfield);
|
||||||
@ -236,7 +236,7 @@ abstract class DoliDB implements Database
|
|||||||
else $return.=',';
|
else $return.=',';
|
||||||
|
|
||||||
$return.=preg_replace('/[^0-9a-z_\.]/i','',$val);
|
$return.=preg_replace('/[^0-9a-z_\.]/i','',$val);
|
||||||
if (isset($sortorder))
|
if (! empty($sortorder))
|
||||||
{
|
{
|
||||||
$return.=' '.preg_replace('/[^0-9a-z]/i','',$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 ($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.")";
|
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.= " GROUP BY s.nom, s.rowid";
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user