diff --git a/htdocs/telephonie/stats/graph/comm.nbminutes.class.php b/htdocs/telephonie/stats/graph/comm.nbminutes.class.php index 96b32c0d91cde20553765a2a8a2d306e74685936..1d8707df49fd2c73d7613116f025c527f2ac7b2f 100644 --- a/htdocs/telephonie/stats/graph/comm.nbminutes.class.php +++ b/htdocs/telephonie/stats/graph/comm.nbminutes.class.php @@ -31,10 +31,12 @@ class GraphCommNbMinutes extends GraphBar{ $this->db = $DB; $this->file = $file; $this->showframe = true; + $this->client = 0; $this->contrat = 0; - $this->titre = "Nombre de minutes"; + $this->ligne = 0; + $this->titre = "Nombre de minutes"; $this->barcolor = "bisque2"; $this->datas = array(); @@ -57,11 +59,11 @@ class GraphCommNbMinutes extends GraphBar{ $sql = "SELECT date_format(td.date,'%Y%m'), sum(duree)"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; - if ($this->client == 0 && $this->contrat == 0) + if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) { $sql .= " GROUP BY date_format(td.date, '%Y%m') ASC"; } - elseif ($this->client > 0 && $this->contrat == 0) + elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) { $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; @@ -70,7 +72,7 @@ class GraphCommNbMinutes extends GraphBar{ $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; } - elseif ($this->client == 0 && $this->contrat > 0) + elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) { $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; @@ -79,6 +81,13 @@ class GraphCommNbMinutes extends GraphBar{ $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; } + elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) + { + $sql .= " WHERE td.fk_ligne = ".$this->ligne; + + $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; + } + if ($this->db->query($sql)) {