Fix: pgsql compatibility

This commit is contained in:
Laurent Destailleur
2011-03-09 10:47:28 +00:00
parent f61337c339
commit 6fa657a904
5 changed files with 45 additions and 24 deletions

View File

@@ -100,13 +100,14 @@ class CommandeStats extends Stats
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_commande,'%Y') = ".$year;
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm DESC";
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getNbByMonth($year, $sql);
}
/**
* Renvoie le nombre de commande par ann<EFBFBD>e
* Renvoie le nombre de commande par annee
*
*/
function getNbByYear()
@@ -118,13 +119,14 @@ class CommandeStats extends Stats
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY dm DESC";
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getNbByYear($sql);
}
/**
* Renvoie le nombre de commande par mois pour une ann<EFBFBD>e donn<EFBFBD>e
* Renvoie le nombre de commande par mois pour une annee donnee
*
*/
function getAmountByMonth($year)
@@ -137,13 +139,14 @@ class CommandeStats extends Stats
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_commande,'%Y') = ".$year;
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm DESC";
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getAmountByMonth($year, $sql);
}
/**
* Renvoie le nombre de commande par mois pour une ann<EFBFBD>e donn<EFBFBD>e
* Renvoie le nombre de commande par mois pour une annee donnee
*
*/
function getAverageByMonth($year)
@@ -156,7 +159,8 @@ class CommandeStats extends Stats
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_commande,'%Y') = ".$year;
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm DESC";
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getAverageByMonth($year, $sql);
}
@@ -174,7 +178,8 @@ class CommandeStats extends Stats
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY year DESC";
$sql.= " GROUP BY year";
$sql.= $this->db->order('year','DESC');
return $this->_getAllByYear($sql);
}