This commit is contained in:
Rodolphe Quiedeville 2005-01-12 15:30:40 +00:00
parent 7c9b703ccf
commit 5427a1066a

View File

@ -43,14 +43,34 @@ class GraphCommNbMensuel extends GraphBar{
Function Graph($datas='', $labels='') Function Graph($datas='', $labels='')
{ {
$this->GetDatas(); $this->GetDatas();
$this->GraphDraw($this->file, $this->datas, $this->labels);
if (sizeof($this->datas))
{
$this->GraphDraw($this->file, $this->datas, $this->labels);
}
} }
Function GetDatas() Function GetDatas()
{ {
$sql = "SELECT date_format(date, '%Y%m'), count(*)"; if ($this->client == 0)
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; {
$sql .= " GROUP BY date_format(date, '%Y%m') ASC";
$sql = "SELECT date_format(date, '%Y%m'), count(*)";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
$sql .= " GROUP BY date_format(date, '%Y%m') ASC";
}
else
{
$sql = "SELECT date_format(td.date,'%Y%m'), count(*)";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s";
$sql .= " WHERE td.ligne = s.ligne";
$sql .= " AND s.fk_client_comm = ".$this->client;
$sql .= " GROUP BY date_format(td.date,'%Y%m') ASC ";
}
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -70,7 +90,7 @@ class GraphCommNbMensuel extends GraphBar{
} }
else else
{ {
dolibarr_syslog("Error");
} }
} }
} }