From bc78d41b47f0f338689122741c48f77435d89a1f Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 15 Mar 2005 16:22:50 +0000 Subject: [PATCH] Ajout graph des lignes --- .../stats/graph/appelsdureemoyenne.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php b/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php index b37ed4f8483..ea0930a3816 100644 --- a/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php +++ b/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php @@ -32,6 +32,7 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ $this->client = 0; $this->contrat = 0; + $this->ligne = 0; $this->titre = "Durée moyenne des appels"; //$this->type = "LinePlot"; @@ -47,11 +48,11 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ $sql = "SELECT date_format(td.date,'%Y%m'), sum(td.duree), count(td.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"; @@ -59,7 +60,7 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ $sql .= " AND s.fk_client_comm = ".$this->client; $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"; @@ -68,7 +69,15 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ $sql .= " AND s.fk_contrat = ".$this->contrat; $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; } + elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) + { + $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; + + $sql .= " WHERE td.ligne = s.ligne"; + $sql .= " AND s.rowid = ".$this->ligne; + $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; + } if ($this->db->query($sql)) {