From 6e5eb9ccdc5313d44873e8cc96bad68fac6149db Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Fri, 29 Aug 2008 18:56:22 +0000
Subject: [PATCH] Normalize code to removed database conexion creation in user
 code. Database handler $db is already created by master.inc.php called by
 every PHP file (directly or through main.inc.php).

---
 htdocs/telephonie/stats/ProcessGraphClients.class.php  | 7 +++----
 htdocs/telephonie/stats/ProcessGraphContrats.class.php | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/htdocs/telephonie/stats/ProcessGraphClients.class.php b/htdocs/telephonie/stats/ProcessGraphClients.class.php
index 899f6776736..1e6415828e7 100644
--- a/htdocs/telephonie/stats/ProcessGraphClients.class.php
+++ b/htdocs/telephonie/stats/ProcessGraphClients.class.php
@@ -20,9 +20,8 @@
  *
  *
  * Generation des graphiques clients
- *
- *
  */
+
 require ("../../master.inc.php");
 
 require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
@@ -51,11 +50,11 @@ class ProcessGraphClients
   
   function ProcessGraphClients( $ident , $cpc)
   {
-    global $conf;
+    global $db;
 
     $this->ident = $ident;
     $this->cpc = $cpc;
-    $this->db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
+    $this->db = $db;
   }
   
   function go($id=0)
diff --git a/htdocs/telephonie/stats/ProcessGraphContrats.class.php b/htdocs/telephonie/stats/ProcessGraphContrats.class.php
index 8215ecc3416..888930d51d1 100644
--- a/htdocs/telephonie/stats/ProcessGraphContrats.class.php
+++ b/htdocs/telephonie/stats/ProcessGraphContrats.class.php
@@ -38,11 +38,11 @@ class ProcessGraphContrats
   
   function ProcessGraphContrats( $ident=0 , $cpc=0)
   {
-    global $conf;
+    global $db;
     
     $this->ident = $ident;
     $this->cpc = $cpc;
-    $this->db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
+    $this->db = $db;
     $this->messages = array();
   }
 
-- 
GitLab