Fix: pgql compatibility

This commit is contained in:
Laurent Destailleur
2011-07-04 10:30:00 +00:00
parent 573354f5d9
commit df8da8678b
13 changed files with 64 additions and 62 deletions

View File

@@ -22,7 +22,7 @@
* \file htdocs/commande/class/commandestats.class.php
* \ingroup commandes
* \brief Fichier de la classe de gestion des stats des commandes
* \version $Id$
* \version $Id: commandestats.class.php,v 1.5 2011/07/04 10:30:01 eldy Exp $
*/
include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php";
include_once DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php";
@@ -102,7 +102,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, count(*) nb";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year;
$sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@@ -141,7 +141,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, sum(c.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year;
$sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@@ -161,7 +161,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, avg(c.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year;
$sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');

View File

@@ -23,7 +23,7 @@
* \file htdocs/commande/liste.php
* \ingroup commande
* \brief Page to list orders
* \version $Id$
* \version $Id: liste.php,v 1.77 2011/07/04 10:30:02 eldy Exp $
*/
@@ -115,19 +115,19 @@ if ($viewstatut <> '')
}
if ($_GET['ordermonth'] > 0)
{
$sql.= " AND date_format(c.date_valid, '%Y-%m') = '$orderyear-$ordermonth'";
$sql.= " AND date_format(c.date_valid, '%Y-%m') = '".$orderyear."-".$ordermonth."'";
}
if ($_GET['orderyear'] > 0)
{
$sql.= " AND date_format(c.date_valid, '%Y') = $orderyear";
$sql.= " AND date_format(c.date_valid, '%Y') = '".$orderyear."'";
}
if ($_GET['deliverymonth'] > 0)
{
$sql.= " AND date_format(c.date_livraison, '%Y-%m') = '$deliveryyear-$deliverymonth'";
$sql.= " AND date_format(c.date_livraison, '%Y-%m') = '".$deliveryyear."-".$deliverymonth."'";
}
if ($_GET['deliveryyear'] > 0)
{
$sql.= " AND date_format(c.date_livraison, '%Y') = $deliveryyear";
$sql.= " AND date_format(c.date_livraison, '%Y') = '".$deliveryyear."'";
}
if (!empty($snom))
{
@@ -278,5 +278,5 @@ else
$db->close();
llxFooter('$Date$ - $Revision$');
llxFooter('$Date: 2011/07/04 10:30:02 $ - $Revision: 1.77 $');
?>