noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 11/17: Use Dossier::connect (singleton) inste


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 11/17: Use Dossier::connect (singleton) instead of new Databass(dossier_id)
Date: Fri, 02 Oct 2015 10:22:19 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 8fc56e3ef492ce56f4d77b375e109bc0db2a267b
Author: Dany De Bontridder <address@hidden>
Date:   Tue Sep 15 12:12:50 2015 +0200

    Use Dossier::connect (singleton) instead of new Databass(dossier_id)
---
 html/ajax_card.php                               |    2 +-
 html/ajax_history.php                            |    2 +-
 html/ajax_ledger.php                             |    2 +-
 html/ajax_misc.php                               |   13 +++---
 html/ajax_poste.php                              |    2 +-
 html/ajax_todo_list.php                          |    6 +-
 html/compute.php                                 |    2 +-
 html/direct.php                                  |    2 +-
 html/do.php                                      |    2 +-
 html/export.php                                  |    2 +-
 html/extension.raw.php                           |    2 +-
 html/fid.php                                     |    2 +-
 html/fid_card.php                                |    2 +-
 html/popup.php                                   |    2 +-
 html/recherche.php                               |    2 +-
 html/show_document.php                           |    2 +-
 html/show_document_modele.php                    |    2 +-
 html/show_pj.php                                 |    2 +-
 html/test.php                                    |    2 +-
 include/ajax/ajax_auto_anc_card.php              |    2 +-
 include/ajax/ajax_display_submenu.php            |   44 ----------------------
 include/ajax/ajax_mod_document.php               |    2 +-
 include/ajax/ajax_preference.php                 |    2 +-
 include/ajax/ajax_update_predef.php              |    2 +-
 include/class/class_acc_account.php              |    1 -
 include/class/class_acc_account_ledger.php       |    2 +-
 include/class/class_acc_balance.php              |    2 +-
 include/class/class_acc_bilan.php                |    4 +-
 include/class/class_acc_ledger.php               |    6 +-
 include/class/class_acc_ledger_info.php          |    2 +-
 include/class/class_acc_ledger_sold.php          |    2 +-
 include/class/class_acc_operation.php            |    2 +-
 include/class/class_acc_reconciliation.php       |    2 +-
 include/class/class_acc_report.php               |    2 +-
 include/class/class_acc_report_row.php           |    2 +-
 include/class/class_acc_tva.php                  |    2 +-
 include/class/class_anc_account.php              |    2 +-
 include/class/class_anc_balance_double.php       |    2 +-
 include/class/class_anc_balance_simple.php       |    2 +-
 include/class/class_anc_group.php                |    2 +-
 include/class/class_anc_group_operation.php      |    2 +-
 include/class/class_anc_operation.php            |    2 +-
 include/class/class_anc_plan.php                 |    2 +-
 include/class/class_anticipation.php             |    2 +-
 include/class/class_calendar.php                 |   14 +++---
 include/class/class_fiche.php                    |    2 +-
 include/class/class_periode.php                  |    2 +-
 include/compta_ach.inc.php                       |    2 +-
 include/compta_fin.inc.php                       |    2 +-
 include/compta_ods.inc.php                       |    2 +-
 include/compta_ven.inc.php                       |    2 +-
 include/export/export_anc_balance_double_csv.php |    2 +-
 include/export/export_anc_balance_double_pdf.php |    2 +-
 include/export/export_anc_balance_simple_csv.php |    2 +-
 include/export/export_anc_balance_simple_pdf.php |    2 +-
 include/export/export_anc_list_csv.php           |    2 +-
 include/export/export_balance_csv.php            |    2 +-
 include/export/export_balance_pdf.php            |    2 +-
 include/export/export_bilan_oth.php              |    2 +-
 include/export/export_fiche_balance_pdf.php      |    2 +-
 include/export/export_fiche_csv.php              |    2 +-
 include/export/export_fiche_detail_csv.php       |    2 +-
 include/export/export_fiche_detail_pdf.php       |    2 +-
 include/export/export_fiche_pdf.php              |    2 +-
 include/export/export_form_csv.php               |    2 +-
 include/export/export_form_pdf.php               |    2 +-
 include/export/export_gl_csv.php                 |    2 +-
 include/export/export_gl_pdf.php                 |    2 +-
 include/export/export_ledger_pdf.php             |    2 +-
 include/export/export_poste_detail_csv.php       |    2 +-
 include/export/export_poste_detail_pdf.php       |    2 +-
 include/export/export_reportinit_csv.php         |    2 +-
 include/export/export_security_pdf.php           |    2 +-
 include/ext/dummy/dummy.php                      |    2 +-
 include/extension_choice.inc.php                 |    2 +-
 include/fiche.inc.php                            |    2 +-
 include/impress_gl_comptes.inc.php               |    2 +-
 include/lib/class_html_table.php                 |    4 +-
 include/lib/class_itva_popup.php                 |    2 +-
 include/opening.inc.php                          |    4 +-
 include/operation_ods_new.inc.php                |    2 +-
 include/param_pcmn.inc.php                       |    2 +-
 include/param_sec.inc.php                        |    2 +-
 include/periode.inc.php                          |    2 +-
 include/report.inc.php                           |    4 +-
 include/search.inc.php                           |    2 +-
 include/verif_bilan.inc.php                      |    2 +-
 87 files changed, 105 insertions(+), 149 deletions(-)

diff --git a/html/ajax_card.php b/html/ajax_card.php
index 3deb19f..2903017 100644
--- a/html/ajax_card.php
+++ b/html/ajax_card.php
@@ -89,7 +89,7 @@ set_language();
  */
 ajax_disconnected($_REQUEST['ctl']);
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 global $g_user;
 $g_user=new User($cn);
 $g_user->check(true);
diff --git a/html/ajax_history.php b/html/ajax_history.php
index 0a84cdf..c7b3285 100644
--- a/html/ajax_history.php
+++ b/html/ajax_history.php
@@ -41,7 +41,7 @@ mb_internal_encoding("UTF-8");
  */
 ajax_disconnected($div);
 global $g_user,$cn;
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $g_user=new User($cn);
 set_language();
 /* security */
diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php
index aaa5f31..6ab53d4 100644
--- a/html/ajax_ledger.php
+++ b/html/ajax_ledger.php
@@ -62,7 +62,7 @@ $gDossier=dossier::id();
  */
 ajax_disconnected($div);
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $g_parameter=new Own($cn);
 if ( LOGINPUT)
     {
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 69c578c..379091d 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -66,7 +66,7 @@ global $g_user, $cn, $g_parameter;
 // but to the administration
 // 
 if ($gDossier<>0) {
-    $cn = new Database($gDossier);
+    $cn =Dossier::connect();
     $g_parameter=new Own($cn);
     $g_user = new User($cn);
     $g_user->check(true);
@@ -102,7 +102,7 @@ if ( LOGINPUT)
 switch ($op)
 {
         case 'pcmn_update':
-            require 'ajax/ajax_pcmn_update.php';
+            require NOALYSS_INCLUDE.'/ajax/ajax_pcmn_update.php';
             return;
        case "remove_anc":
                if ($g_user->check_module('ANCODS') == 0)
@@ -221,7 +221,7 @@ EOF;
                require_once 
NOALYSS_INCLUDE.'/template/document_mod_change.php';
                break;
        case 'dsp_tva':
-               $cn = new Database($gDossier);
+               $cn = Dossier::connect();
                $Res = $cn->exec_sql("select * from tva_rate order by tva_rate 
desc");
                $Max = Database::num_row($Res);
                $r = "";
@@ -284,7 +284,7 @@ EOF;
 EOF;
                break;
        case 'label_tva':
-               $cn = new Database($gDossier);
+               $cn =Dossier::connect();
                if (isNumber($id) == 0)
                        $value = _('tva inconnue');
                else
@@ -568,8 +568,9 @@ EOF;
                        from menu_ref where me_code=$1", array($me_code));
                if (empty($m))
                {
-                       echo HtmlInput::title_box("Ce plugin n'existe pas ", 
$ctl);
-                       echo "<p>Il y a une erreur, ce plugin n'existe pas";
+                       echo HtmlInput::title_box(_("Ce plugin n'existe pas "), 
$ctl);
+                       echo "<p>"._("Il y a une erreur, ce plugin n'existe 
pas").
+                                "</p>";
                        exit;
                }
                $me_code = new IText('me_code', $m[0] ['me_code']);
diff --git a/html/ajax_poste.php b/html/ajax_poste.php
index ea6f1b2..4625571 100644
--- a/html/ajax_poste.php
+++ b/html/ajax_poste.php
@@ -59,7 +59,7 @@ ajax_disconnected($ctl);
 set_language();
 
 if ( $cont != 0 ) exit();
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 require_once  NOALYSS_INCLUDE.'/class/class_user.php';
 global $g_user;
 $g_user=new User($cn);
diff --git a/html/ajax_todo_list.php b/html/ajax_todo_list.php
index 2cc5027..e71dfd7 100644
--- a/html/ajax_todo_list.php
+++ b/html/ajax_todo_list.php
@@ -53,7 +53,7 @@ ajax_disconnected('add_todo_list');
 
////////////////////////////////////////////////////////////////////////////////
 if (isset($_REQUEST['show']))
 {
-    $cn=new Database(dossier::id());
+    $cn=Dossier::connect();
     $todo=new Todo_list($cn);
     $todo->set_parameter('id',$_REQUEST['id']);
     $todo->load();
@@ -78,7 +78,7 @@ if (isset($_REQUEST['show']))
 
////////////////////////////////////////////////////////////////////////////////
 if (isset($_REQUEST['del']))
 {
-    $cn=new Database(dossier::id());
+    $cn=Dossier::connect();
     $todo=new Todo_list($cn);
     $todo->set_parameter('id',$_REQUEST['id']);
     $todo->delete();
@@ -92,7 +92,7 @@ $ac=HtmlInput::default_value_get('act', 'save');
 if ($ac == 'save')
 {
     
-    $cn=new Database(dossier::id());
+    $cn=Dossier::connect();
     $todo=new Todo_List($cn);
      $id=HtmlInput::default_value_get("id", 0);
     $todo->set_parameter("id",$id);
diff --git a/html/compute.php b/html/compute.php
index a98407f..f4f9de7 100644
--- a/html/compute.php
+++ b/html/compute.php
@@ -48,7 +48,7 @@ foreach (array('t','c','p','q','n','gDossier') as $a)
     }
 
 }
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $User=new User($cn);
 $User->Check();
 // Retrieve the rate of vat, it $t == -1 it means no VAT
diff --git a/html/direct.php b/html/direct.php
index 36fed4b..d968d42 100644
--- a/html/direct.php
+++ b/html/direct.php
@@ -22,7 +22,7 @@ require_once '../include/constant.php';
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 require_once NOALYSS_INCLUDE.'/class/class_user.php';
 
-$cn=new Database($_GET['gDossier']);
+$cn=Dossier::connect();
 global $g_user;
 $g_user=new User($cn);
 $g_user->Check();
diff --git a/html/do.php b/html/do.php
index 9640178..5661887 100644
--- a/html/do.php
+++ b/html/do.php
@@ -84,7 +84,7 @@ global $g_user, $cn,$g_parameter;
 
 
 
-$cn = new Database(Dossier::id());
+$cn = Dossier::connect();
 
 /*
  * check that the database is not empty
diff --git a/html/export.php b/html/export.php
index 1124fc3..86cb679 100644
--- a/html/export.php
+++ b/html/export.php
@@ -30,7 +30,7 @@ global $g_user,$cn,$g_parameter;
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 require_once NOALYSS_INCLUDE.'/class/class_user.php';
 $gDossier=dossier::id();
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 mb_internal_encoding("UTF-8");
 $g_user=new User($cn);
 $g_user->Check();
diff --git a/html/extension.raw.php b/html/extension.raw.php
index 5ff4576..7cd12dc 100644
--- a/html/extension.raw.php
+++ b/html/extension.raw.php
@@ -35,7 +35,7 @@ require_once  NOALYSS_INCLUDE.'/class/class_user.php';
 
 global $g_user,$cn,$g_parameter;
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $g_user=new User($cn);
 $g_user->check();
 $only_plugin=$g_user->check_dossier(dossier::id());
diff --git a/html/fid.php b/html/fid.php
index 3e02cdf..a095301 100644
--- a/html/fid.php
+++ b/html/fid.php
@@ -41,7 +41,7 @@ $gDossier=dossier::id();
 
 require_once('class/class_user.php');
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 global $g_user;
 $g_user=new User($cn);
 $g_user->check();
diff --git a/html/fid_card.php b/html/fid_card.php
index d9842fc..fab07b3 100644
--- a/html/fid_card.php
+++ b/html/fid_card.php
@@ -44,7 +44,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 
 $jrn= ( ! isset($_REQUEST['j']))?-1:$_REQUEST['j'];
 $filter_card="";
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $d=$_REQUEST['e'];
 $filter_card='';
 
diff --git a/html/popup.php b/html/popup.php
index d756cd5..e7b8884 100644
--- a/html/popup.php
+++ b/html/popup.php
@@ -33,7 +33,7 @@ global $g_user;
 if ( basename($_GET['ajax']) == 'ajax_history.php' )
   {
     $href=dossier::get();
-    $cn=new Database(dossier::id());
+    $cn=Dossier::connect();
     /* current year  */
     $g_user=new User($cn);
     $exercice=$g_user->get_exercice();
diff --git a/html/recherche.php b/html/recherche.php
index 30f8490..aba5f08 100644
--- a/html/recherche.php
+++ b/html/recherche.php
@@ -35,7 +35,7 @@ $gDossier=dossier::id();
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 /* Admin. Dossier */
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 include_once NOALYSS_INCLUDE.'/class/class_user.php';
 
 global $g_user;
diff --git a/html/show_document.php b/html/show_document.php
index 728333d..a30cdfd 100644
--- a/html/show_document.php
+++ b/html/show_document.php
@@ -28,7 +28,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
 require_once NOALYSS_INCLUDE.'/class/class_document.php';
 require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 $gDossier = dossier::id();
-$cn = new Database($gDossier);
+$cn = Dossier::connect();
 $action = (isset($_REQUEST['a'])) ? $_REQUEST['a'] : 'sh';
 
 require_once  NOALYSS_INCLUDE.'/class/class_user.php';
diff --git a/html/show_document_modele.php b/html/show_document_modele.php
index 0c993d3..bafd8aa 100644
--- a/html/show_document_modele.php
+++ b/html/show_document_modele.php
@@ -27,7 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
 require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 
 $gDossier=dossier::id();
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 
 require_once NOALYSS_INCLUDE.'/class/class_user.php';
diff --git a/html/show_pj.php b/html/show_pj.php
index 7811e3f..2af9bbf 100644
--- a/html/show_pj.php
+++ b/html/show_pj.php
@@ -37,7 +37,7 @@ set_language();
 
 $jr_grpt_id=$_GET['jr_grpt_id'];
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 
 require_once NOALYSS_INCLUDE.'/class/class_user.php';
diff --git a/html/test.php b/html/test.php
index e0f99eb..819c8b0 100644
--- a/html/test.php
+++ b/html/test.php
@@ -45,7 +45,7 @@ if ($gDossier==-1)
 }
 $gDossierLogInput=$gDossier;
 global $cn, $g_user, $g_succeed, $g_failed;
-$cn=new Database($_GET['gDossier']);
+$cn=Dossier::id();
 
 $g_parameter=new Own($cn);
 $g_user=new User($cn);
diff --git a/include/ajax/ajax_auto_anc_card.php 
b/include/ajax/ajax_auto_anc_card.php
index 912bd1f..b850888 100644
--- a/include/ajax/ajax_auto_anc_card.php
+++ b/include/ajax/ajax_auto_anc_card.php
@@ -5,7 +5,7 @@
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 require_once NOALYSS_INCLUDE.'/class/class_user.php';
-$cn=new Database($_GET['gDossier']);
+$cn=Dossier::connect();
 
 
 if ( isset($_REQUEST['pa_id']) )
diff --git a/include/ajax/ajax_display_submenu.php 
b/include/ajax/ajax_display_submenu.php
index 3d5908c..f005149 100644
--- a/include/ajax/ajax_display_submenu.php
+++ b/include/ajax/ajax_display_submenu.php
@@ -51,48 +51,4 @@ $profile=new Profile_Menu($cn);
 $profile->p_id=$p_id;
 $profile->display_module_menu($module,$p_level);
 
-////////////////////////////////////////////////////////////////////////////////
-// EXAMPLE
-////////////////////////////////////////////////////////////////////////////////
-/*
-if ($ac == 'save') // operation
-{
-    
-    $cn=new Database(dossier::id());
-    $todo=new Todo_List($cn);
-     $id=HtmlInput::default_value_get("id", 0); // get variable
-    $todo->set_parameter("id",$id);
-    if ($id <> 0 ) { $todo->load(); }
-    else
-    {
-        $todo->set_parameter("owner", $_SESSION['g_user']);
-    }
-    
-    $todo->set_parameter("date", HtmlInput::default_value_get("p_date_todo", 
""));
-    $todo->set_parameter("title", HtmlInput::default_value_get("p_title", ""));
-    $todo->set_parameter("desc", HtmlInput::default_value_get("p_desc", ""));
-    $todo->set_is_public(HtmlInput::default_value_get("p_public", "N"));
-    
-    if ( $todo->get_parameter('owner') == $_SESSION['g_user'] ) $todo->save();
-    $todo->load();
- //----------------------------------------------------------------
- // Answer in XML
-     header('Content-type: text/xml; charset=UTF-8');
-    $dom=new DOMDocument('1.0','UTF-8');
-    $tl_id=$dom->createElement('tl_id',$todo->get_parameter('id'));
-    
$tl_content=$dom->createElement('row',$todo->display_row('class="odd"','N'));
-     $root=$dom->createElement("root");
-     $todo_class=$todo->get_class();
-     $todo_class=($todo_class=="")?' odd ':$todo_class;
-     $class=$dom->createElement("style",$todo_class);
-    
-    $root->appendChild($tl_id);
-    $root->appendChild($tl_content);
-    $root->appendChild($class);
-    $dom->appendChild($root);
-   
-    echo $dom->saveXML();
-    exit();
-}
-  */
 ?>        
\ No newline at end of file
diff --git a/include/ajax/ajax_mod_document.php 
b/include/ajax/ajax_mod_document.php
index eaf004e..a260467 100644
--- a/include/ajax/ajax_mod_document.php
+++ b/include/ajax/ajax_mod_document.php
@@ -28,7 +28,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 require_once NOALYSS_INCLUDE.'/class/class_document_modele.php';
 
   /* 1. Check security */
-$cn=new Database(dossier::id());
+$cn=Dossier::id();
   /* 2. find the document */
 $doc=new Document_Modele($cn,$id);
 
diff --git a/include/ajax/ajax_preference.php b/include/ajax/ajax_preference.php
index 42a7231..82bb35d 100644
--- a/include/ajax/ajax_preference.php
+++ b/include/ajax/ajax_preference.php
@@ -43,7 +43,7 @@ if (isset($_REQUEST['gDossier']) && $_REQUEST['gDossier']<>0)
 {
     $g_user->load_global_pref();
     $msg = "";
-    $cn = new Database($_REQUEST['gDossier']);
+    $cn =Dossier::connect();
     $g_user->cn = $cn;
     $inside_dossier = true;
     $local_pref=$g_user->get_preference();
diff --git a/include/ajax/ajax_update_predef.php 
b/include/ajax/ajax_update_predef.php
index 6043f8f..bd6bac2 100644
--- a/include/ajax/ajax_update_predef.php
+++ b/include/ajax/ajax_update_predef.php
@@ -44,7 +44,7 @@ foreach (array('l','t','d','gDossier') as $a)
     }
 
 }
-$cn=new Database(dossier::id());
+$cn=Dossier::id();
 $op=new Pre_operation_detail($cn);
 $op->set('ledger',$l);
 $op->set('ledger_type',$t);
diff --git a/include/class/class_acc_account.php 
b/include/class/class_acc_account.php
index 1e69f37..f8347ad 100644
--- a/include/class/class_acc_account.php
+++ b/include/class/class_acc_account.php
@@ -205,7 +205,6 @@ class Acc_Account
     /*!\brief for developper only during test */
     static function test_me()
     {
-        $cn=new Database(dossier::id());
 
     }
     /**
diff --git a/include/class/class_acc_account_ledger.php 
b/include/class/class_acc_account_ledger.php
index 0d5afa6..274039d 100644
--- a/include/class/class_acc_account_ledger.php
+++ b/include/class/class_acc_account_ledger.php
@@ -648,7 +648,7 @@ class Acc_Account_Ledger
        }
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $a=new Acc_Account_Ledger($cn,550);
         echo ' Journal 4 '.$a->belong_ledger(4);
         return $a->belong_ledger(4);;
diff --git a/include/class/class_acc_balance.php 
b/include/class/class_acc_balance.php
index 119c9cf..f5b6939 100644
--- a/include/class/class_acc_balance.php
+++ b/include/class/class_acc_balance.php
@@ -275,7 +275,7 @@ class Acc_Balance
     {
         require 'class/class_user.php';
         global $g_user;
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $g_user=new User($cn);
         $a=new Acc_Balance($cn);
         $a->get_row(163, 175, 1);
diff --git a/include/class/class_acc_bilan.php 
b/include/class/class_acc_bilan.php
index 049071e..2088bbd 100644
--- a/include/class/class_acc_bilan.php
+++ b/include/class/class_acc_bilan.php
@@ -696,7 +696,7 @@ class Acc_Bilan
         if ( isset($_GET['result']))
         {
             ob_start();
-            $cn=new Database(dossier::id());
+            $cn=Dossier::connect();
             $a=new Acc_Bilan($cn);
             $a->get_request_get();
 
@@ -714,7 +714,7 @@ class Acc_Bilan
         }
         else
         {
-            $cn=new Database(dossier::id());
+            $cn=Dossier::connect();
             $a=new Acc_Bilan($cn);
             $a->get_request_get();
 
diff --git a/include/class/class_acc_ledger.php 
b/include/class/class_acc_ledger.php
index 45300e2..2f8654c 100644
--- a/include/class/class_acc_ledger.php
+++ b/include/class/class_acc_ledger.php
@@ -3245,7 +3245,7 @@ class Acc_Ledger extends jrn_def_sql
                {
                        echo Acc_Reconciliation::$javascript;
                        html_page_start();
-                       $cn = new Database(dossier::id());
+                       $cn = Dossier::connect();
                        $_SESSION['g_user'] = 'phpcompta';
                        $_SESSION['g_pass'] = 'phpcompta';
 
@@ -3334,7 +3334,7 @@ class Acc_Ledger extends jrn_def_sql
                if ($pCase == 'search')
                {
                        html_page_start();
-                       $cn = new Database(dossier::id());
+                       $cn = Dossier::connect();
                        $ledger = new Acc_Ledger($cn, 0);
                        $_SESSION['g_user'] = 'phpcompta';
                        $_SESSION['g_pass'] = 'phpcompta';
@@ -3346,7 +3346,7 @@ class Acc_Ledger extends jrn_def_sql
                
///////////////////////////////////////////////////////////////////////////
                if ($pCase == 'reverse')
                {
-                       $cn = new Database(dossier::id());
+                       $cn = Dossier::connect();
                        $jr_internal = 'OD-01-272';
                        try
                        {
diff --git a/include/class/class_acc_ledger_info.php 
b/include/class/class_acc_ledger_info.php
index 1d44e56..d406618 100644
--- a/include/class/class_acc_ledger_info.php
+++ b/include/class/class_acc_ledger_info.php
@@ -200,7 +200,7 @@ class Acc_Ledger_Info
     static function test_me()
     {
         echo "Dossier = ".Dossier::id();
-        $cn=new Database(Dossier::id());
+        $cn=Dossier::connect();
         $a=new Acc_Ledger_Info($cn);
         $a->jr_id=3;
         $a->id_type='BON_COMMANDE';
diff --git a/include/class/class_acc_ledger_sold.php 
b/include/class/class_acc_ledger_sold.php
index 3aefc8d..912cf2f 100644
--- a/include/class/class_acc_ledger_sold.php
+++ b/include/class/class_acc_ledger_sold.php
@@ -1365,7 +1365,7 @@ EOF;
      */
 
     static function test_me($p_string = '') {
-        $cn = new Database(dossier::id());
+        $cn = Dossier::connect();
         $a = new Acc_Ledger_Sold($cn, 2);
         echo $a->input();
     }
diff --git a/include/class/class_acc_operation.php 
b/include/class/class_acc_operation.php
index f992d4f..6a1c0fa 100644
--- a/include/class/class_acc_operation.php
+++ b/include/class/class_acc_operation.php
@@ -578,7 +578,7 @@ class Acc_Operation
         $_SESSION['g_user']='phpcompta';
         $_SESSION['g_pass']='dany';
         global $g_user;
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $g_user=new User($cn);
         $a=new Acc_Operation($cn);
         $a->jr_id=1444;
diff --git a/include/class/class_acc_reconciliation.php 
b/include/class/class_acc_reconciliation.php
index 7131e5a..3feb086 100644
--- a/include/class/class_acc_reconciliation.php
+++ b/include/class/class_acc_reconciliation.php
@@ -524,7 +524,7 @@ j1.j_poste as poste
 
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $rap=new Acc_Reconciliation($cn);
         var_dump($rap->get_reconciled_amount('',false));
     }
diff --git a/include/class/class_acc_report.php 
b/include/class/class_acc_report.php
index 18c6538..14b1b18 100644
--- a/include/class/class_acc_report.php
+++ b/include/class/class_acc_report.php
@@ -422,7 +422,7 @@ class Acc_Report
     }
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $a=new Acc_Report($cn);
         print_r($a->get_list());
         $array=array("text0"=>"test1",
diff --git a/include/class/class_acc_report_row.php 
b/include/class/class_acc_report_row.php
index 1f4a377..97e1b32 100644
--- a/include/class/class_acc_report_row.php
+++ b/include/class/class_acc_report_row.php
@@ -107,7 +107,7 @@ class  Acc_Report_Row
     }
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $a=new Acc_Report_Row();
         $array=array("text0"=>"test1",
                      "form0"=>"7%",
diff --git a/include/class/class_acc_tva.php b/include/class/class_acc_tva.php
index 61e00a3..801daac 100644
--- a/include/class/class_acc_tva.php
+++ b/include/class/class_acc_tva.php
@@ -177,7 +177,7 @@ class Acc_Tva
      */
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $a=new Acc_Tva($cn);
         echo $a->get_info();
         $a->set_parameter("id",1);
diff --git a/include/class/class_anc_account.php 
b/include/class/class_anc_account.php
index 282dde6..f983c74 100644
--- a/include/class/class_anc_account.php
+++ b/include/class/class_anc_account.php
@@ -305,7 +305,7 @@ class Anc_Account
     }
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $pa_id=$cn->get_value("select max(pa_id) from plan_analytique");
         $o=new Anc_Account($cn);
         echo "<h1>Poste_Analytique</h1>";
diff --git a/include/class/class_anc_balance_double.php 
b/include/class/class_anc_balance_double.php
index cceff77..c799d8d 100644
--- a/include/class/class_anc_balance_double.php
+++ b/include/class/class_anc_balance_double.php
@@ -557,7 +557,7 @@ class Anc_Balance_Double extends Anc_Print
      */
     static function test_me()
     {
-        $a=new Database(dossier::id());
+        $a=Dossier::connect();
 
         $bal=new Anc_Balance_Double($a);
         $bal->get_request();
diff --git a/include/class/class_anc_balance_simple.php 
b/include/class/class_anc_balance_simple.php
index f5673f1..000e762 100644
--- a/include/class/class_anc_balance_simple.php
+++ b/include/class/class_anc_balance_simple.php
@@ -286,7 +286,7 @@ class Anc_Balance_Simple extends Anc_Print
     static  function test_me ()
     {
         // call the page with ?gDossier=14
-        $a=new Database(dossier::id());
+        $a=Dossier::connect();
 
         $bal=new Anc_Balance_Simple($a);
         $bal->get_request();
diff --git a/include/class/class_anc_group.php 
b/include/class/class_anc_group.php
index f31b8e4..30d3a04 100644
--- a/include/class/class_anc_group.php
+++ b/include/class/class_anc_group.php
@@ -239,7 +239,7 @@ order by ga_description,po_name";
     static function test_me()
     {
 
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         print_r($cn);
         $o=new Anc_Group($cn);
         $r=$o->myList();
diff --git a/include/class/class_anc_group_operation.php 
b/include/class/class_anc_group_operation.php
index 08f9a7c..2140ca9 100644
--- a/include/class/class_anc_group_operation.php
+++ b/include/class/class_anc_group_operation.php
@@ -257,7 +257,7 @@ class Anc_Group_Operation
     static function test_me()
     {
         $dossier=dossier::id();
-        $cn=new Database($dossier);
+        $cn=Dossier::connect();
 
         if ( isset($_POST['go']))
         {
diff --git a/include/class/class_anc_operation.php 
b/include/class/class_anc_operation.php
index 1c029b7..8e907d5 100644
--- a/include/class/class_anc_operation.php
+++ b/include/class/class_anc_operation.php
@@ -939,7 +939,7 @@ class Anc_Operation
      */
     function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $anco=new Anc_Operation($cn);
         $j_id=200;
         $anco->j_id=$j_id;
diff --git a/include/class/class_anc_plan.php b/include/class/class_anc_plan.php
index 2597c1f..3db85af 100644
--- a/include/class/class_anc_plan.php
+++ b/include/class/class_anc_plan.php
@@ -202,7 +202,7 @@ class Anc_Plan
     }
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         echo "<h1>Plan analytique : test</h1>";
         echo "clean";
         $cn->exec_sql("delete from plan_analytique");
diff --git a/include/class/class_anticipation.php 
b/include/class/class_anticipation.php
index 2adf7df..230339f 100644
--- a/include/class/class_anticipation.php
+++ b/include/class/class_anticipation.php
@@ -442,7 +442,7 @@ class Anticipation
      */
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $test=new Anticipation($cn);
 
     }
diff --git a/include/class/class_calendar.php b/include/class/class_calendar.php
index 4959392..af86dec 100644
--- a/include/class/class_calendar.php
+++ b/include/class/class_calendar.php
@@ -51,7 +51,7 @@ class Calendar
                global $g_user;
                $profile=$g_user->get_profile();
 
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $sql="select ag_id,to_char(ag_remind_date,'DD')::integer as 
ag_timestamp_day,ag_title,ag_hour,
              coalesce(name,'interne') as str_name
                        ".
@@ -113,7 +113,7 @@ class Calendar
      */
     function fill_from_todo(&$p_array,$p_style)
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         if ($p_style=="short")
         {
             $sql="select count(*) as nb,to_char(tl_date,'DD')::integer as 
tl_date_day ".
@@ -172,7 +172,7 @@ class Calendar
         $this->fill_from_action($cell,$p_type);
         $this->fill_from_todo($cell,$p_type);
         $wMonth=new ISelect('per');
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $wMonth->value=$cn->make_array("select p_id,to_char(p_start,'MM/YYYY') 
from parm_periode where p_exercice = '$exercice_user' order by p_start");
         $wMonth->selected=$this->default_periode;
         $wMonth->javascript="onchange=change_month(this)";
@@ -201,7 +201,7 @@ class Calendar
      */
     function set_month_year()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $array=$cn->get_array("select to_char(p_start,'MM') as month, 
to_char(p_start,'YYYY') as year ".
                               " from parm_periode where 
p_id=$1",array($this->default_periode));
         $this->month=(int)$array[0]['month'];
@@ -218,7 +218,7 @@ class Calendar
     function get_preference()
     {
         global $g_user;
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $today=date('d.m.Y');
         $p_id=$cn->get_value("
                 select p_id from parm_periode
@@ -262,7 +262,7 @@ class Calendar
         $this->fill_from_action($cell,"long");
         $this->fill_from_todo($cell,"long");
         $wMonth=new ISelect('per_div');
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $wMonth->value=$cn->make_array("select p_id,to_char(p_start,'MM/YYYY') 
from parm_periode where p_exercice = '$exercice_user' order by p_start");
         $wMonth->selected=$this->default_periode;
         
$wMonth->javascript=sprintf("onchange=calendar_zoom({gDossier:%d,invalue:'%s',outvalue:'%s',distype:'%s',notitle:%d})",
@@ -292,7 +292,7 @@ class Calendar
     function zoom_list($notitle)
     {
         global $g_user;
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $profile=$g_user->get_profile();
 
         // Get the event from now and before 30 before
diff --git a/include/class/class_fiche.php b/include/class/class_fiche.php
index cb06d48..6e7e211 100644
--- a/include/class/class_fiche.php
+++ b/include/class/class_fiche.php
@@ -1959,7 +1959,7 @@ class Fiche
     }
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $a=new Fiche($cn);
         $select_cat=new ISelect('fd_id');
         $select_cat->value=$cn->make_array('select fd_id,fd_label from 
fiche_def where frd_id='.
diff --git a/include/class/class_periode.php b/include/class/class_periode.php
index 1df3079..67f43b0 100644
--- a/include/class/class_periode.php
+++ b/include/class/class_periode.php
@@ -567,7 +567,7 @@ class Periode
     }
     static function test_me()
     {
-        $cn=new Database(dossier::id());
+        $cn=Dossier::connect();
         $obj=new Periode($cn);
         $obj->set_jrn(1);
         $obj->display_form_periode();
diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php
index 887c217..6e321a9 100644
--- a/include/compta_ach.inc.php
+++ b/include/compta_ach.inc.php
@@ -31,7 +31,7 @@ require_once  NOALYSS_INCLUDE.'/class/class_pre_op_ach.php';
 require_once NOALYSS_INCLUDE.'/lib/class_ipopup.php';
 $gDossier = dossier::id();
 global $g_parameter;
-$cn = new Database(dossier::id());
+$cn = Dossier::connect();
 //menu = show a list of ledger
 $str_dossier = dossier::get();
 $ac = "ac=" . $_REQUEST['ac'];
diff --git a/include/compta_fin.inc.php b/include/compta_fin.inc.php
index 282d762..136b567 100644
--- a/include/compta_fin.inc.php
+++ b/include/compta_fin.inc.php
@@ -30,7 +30,7 @@ global $g_user,$g_parameter;
 $gDossier=dossier::id();
 
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $menu_action="?ledger_type=fin&ac=".$_REQUEST['ac']."&".dossier::get();
 
 $Ledger=new Acc_Ledger_Fin($cn,0);
diff --git a/include/compta_ods.inc.php b/include/compta_ods.inc.php
index 3dd7fff..bf1197d 100644
--- a/include/compta_ods.inc.php
+++ b/include/compta_ods.inc.php
@@ -37,7 +37,7 @@ require_once NOALYSS_INCLUDE.'/lib/class_ipopup.php';
 
 global $g_user;
 
-$cn = new Database(dossier::id());
+$cn = Dossier::connect();
 
 $id_predef = (isset($_REQUEST['p_jrn_predef'])) ? $_REQUEST['p_jrn_predef'] : 
-1;
 $id_ledger = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : $id_predef;
diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php
index fbecc45..a5cf685 100644
--- a/include/compta_ven.inc.php
+++ b/include/compta_ven.inc.php
@@ -31,7 +31,7 @@ require_once  
NOALYSS_INCLUDE.'/class/class_acc_ledger_info.php';
 require_once NOALYSS_INCLUDE.'/lib/class_ipopup.php';
 
 $gDossier=dossier::id();
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 //menu = show a list of ledger
 $str_dossier=dossier::get();
 $ac="ac=".$_REQUEST['ac'];
diff --git a/include/export/export_anc_balance_double_csv.php 
b/include/export/export_anc_balance_double_csv.php
index 4364c45..067f85f 100644
--- a/include/export/export_anc_balance_double_csv.php
+++ b/include/export/export_anc_balance_double_csv.php
@@ -33,7 +33,7 @@ header('Content-Disposition: 
attachment;filename="ca_bal_croise.csv"',FALSE);
 
 require_once  NOALYSS_INCLUDE.'/class/class_anc_balance_double.php';
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 
 $bal=new Anc_Balance_Double($cn);
 $bal->get_request();
diff --git a/include/export/export_anc_balance_double_pdf.php 
b/include/export/export_anc_balance_double_pdf.php
index 6c3e166..65db933 100644
--- a/include/export/export_anc_balance_double_pdf.php
+++ b/include/export/export_anc_balance_double_pdf.php
@@ -26,7 +26,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas 
permis');
 require_once  NOALYSS_INCLUDE.'/class/class_anc_balance_double.php';
 require_once  NOALYSS_INCLUDE.'/header_print.php';
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 
 
 $balance=new Anc_Balance_Double($cn);
diff --git a/include/export/export_anc_balance_simple_csv.php 
b/include/export/export_anc_balance_simple_csv.php
index 6a09602..5a948c8 100644
--- a/include/export/export_anc_balance_simple_csv.php
+++ b/include/export/export_anc_balance_simple_csv.php
@@ -29,7 +29,7 @@ header('Content-Disposition: 
attachment;filename="ca_bal_simple.csv"',FALSE);
 
 require_once  NOALYSS_INCLUDE.'/class/class_anc_balance_simple.php';
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 
 $bal=new Anc_Balance_Simple($cn);
 $bal->get_request();
diff --git a/include/export/export_anc_balance_simple_pdf.php 
b/include/export/export_anc_balance_simple_pdf.php
index 66fde7e..5f55cee 100644
--- a/include/export/export_anc_balance_simple_pdf.php
+++ b/include/export/export_anc_balance_simple_pdf.php
@@ -26,7 +26,7 @@
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
 require_once  NOALYSS_INCLUDE.'/class/class_anc_balance_simple.php';
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 
 $balance=new Anc_Balance_Simple($cn);
 
diff --git a/include/export/export_anc_list_csv.php 
b/include/export/export_anc_list_csv.php
index f88d6c8..5d08e34 100644
--- a/include/export/export_anc_list_csv.php
+++ b/include/export/export_anc_list_csv.php
@@ -30,7 +30,7 @@ header('Content-Disposition: 
attachment;filename="jrn.csv"',FALSE);
 
 require_once  NOALYSS_INCLUDE.'/class/class_anc_listing.php';
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 
 $bal=new Anc_Listing($cn);
 $bal->get_request();
diff --git a/include/export/export_balance_csv.php 
b/include/export/export_balance_csv.php
index 9ae545e..805a42d 100644
--- a/include/export/export_balance_csv.php
+++ b/include/export/export_balance_csv.php
@@ -31,7 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 $gDossier=dossier::id();
 
 require_once NOALYSS_INCLUDE.'/class/class_acc_ledger.php';
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 bcscale(2);
 
 require_once  NOALYSS_INCLUDE.'/class/class_user.php';
diff --git a/include/export/export_balance_pdf.php 
b/include/export/export_balance_pdf.php
index e16f90c..e7c7cdc 100644
--- a/include/export/export_balance_pdf.php
+++ b/include/export/export_balance_pdf.php
@@ -38,7 +38,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 require_once NOALYSS_INCLUDE.'/lib/class_pdf.php';
 $gDossier=dossier::id();
 bcscale(4);
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 $rep=new Database();
 require_once  NOALYSS_INCLUDE.'/class/class_user.php';
 $g_user->Check();
diff --git a/include/export/export_bilan_oth.php 
b/include/export/export_bilan_oth.php
index b031bb5..f4767ea 100644
--- a/include/export/export_bilan_oth.php
+++ b/include/export/export_bilan_oth.php
@@ -32,7 +32,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 $gDossier=dossier::id();
 
 /* Admin. Dossier */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 $bilan=new Acc_Bilan($cn);
 $bilan->get_request_get();
diff --git a/include/export/export_fiche_balance_pdf.php 
b/include/export/export_fiche_balance_pdf.php
index 828fd47..a31347c 100644
--- a/include/export/export_fiche_balance_pdf.php
+++ b/include/export/export_fiche_balance_pdf.php
@@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
 
 /* Security */
 $gDossier=dossier::id();
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 $g_user->Check();
 $g_user->check_dossier($gDossier);
 $name=$cn->get_value('select fd_label from fiche_def where 
fd_id=$1',array($_GET['cat']));
diff --git a/include/export/export_fiche_csv.php 
b/include/export/export_fiche_csv.php
index 4106eb1..ee957bd 100644
--- a/include/export/export_fiche_csv.php
+++ b/include/export/export_fiche_csv.php
@@ -30,7 +30,7 @@ require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 $gDossier=dossier::id();
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 require_once  NOALYSS_INCLUDE.'/class/class_user.php';
 
diff --git a/include/export/export_fiche_detail_csv.php 
b/include/export/export_fiche_detail_csv.php
index b12dd49..286e63a 100644
--- a/include/export/export_fiche_detail_csv.php
+++ b/include/export/export_fiche_detail_csv.php
@@ -32,7 +32,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 $gDossier=dossier::id();
 
 /* Admin. Dossier */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 
 $Fiche=new Fiche($cn,$f_id);
diff --git a/include/export/export_fiche_detail_pdf.php 
b/include/export/export_fiche_detail_pdf.php
index 4fe9ea5..a0b6d40 100644
--- a/include/export/export_fiche_detail_pdf.php
+++ b/include/export/export_fiche_detail_pdf.php
@@ -33,7 +33,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 require_once NOALYSS_INCLUDE.'/lib/class_pdf.php';
 $gDossier=dossier::id();
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 extract($_GET);
 
diff --git a/include/export/export_fiche_pdf.php 
b/include/export/export_fiche_pdf.php
index 343f6d0..3d1a93b 100644
--- a/include/export/export_fiche_pdf.php
+++ b/include/export/export_fiche_pdf.php
@@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
 
 /* Security */
 $gDossier=dossier::id();
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 $g_user->Check();
 $g_user->check_dossier($gDossier);
 
diff --git a/include/export/export_form_csv.php 
b/include/export/export_form_csv.php
index 64956d2..ed26bcb 100644
--- a/include/export/export_form_csv.php
+++ b/include/export/export_form_csv.php
@@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 $gDossier=dossier::id();
 
 /* Admin. Dossier */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 $Form=new Acc_Report($cn,$_GET['form_id']);
 $Form->get_name();
diff --git a/include/export/export_form_pdf.php 
b/include/export/export_form_pdf.php
index 1081089..2261111 100644
--- a/include/export/export_form_pdf.php
+++ b/include/export/export_form_pdf.php
@@ -35,7 +35,7 @@ require_once NOALYSS_INCLUDE.'/lib/class_pdf.php';
 
 $gDossier=dossier::id();
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 extract($_GET);
 $ret="";
diff --git a/include/export/export_gl_csv.php b/include/export/export_gl_csv.php
index b1e5aa6..167cc3e 100644
--- a/include/export/export_gl_csv.php
+++ b/include/export/export_gl_csv.php
@@ -39,7 +39,7 @@ header('Pragma: public');
 $gDossier=dossier::id();
 
 /* Security */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 
 extract($_GET);
diff --git a/include/export/export_gl_pdf.php b/include/export/export_gl_pdf.php
index 709e948..991cf91 100644
--- a/include/export/export_gl_pdf.php
+++ b/include/export/export_gl_pdf.php
@@ -36,7 +36,7 @@ bcscale(2);
 $gDossier=dossier::id();
 
 /* Security */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 $g_user->Check();
 $g_user->check_dossier($gDossier);
 
diff --git a/include/export/export_ledger_pdf.php 
b/include/export/export_ledger_pdf.php
index 0e8d9c4..1f9c2b5 100644
--- a/include/export/export_ledger_pdf.php
+++ b/include/export/export_ledger_pdf.php
@@ -39,7 +39,7 @@ require_once NOALYSS_INCLUDE.'/class/class_periode.php';
 require_once NOALYSS_INCLUDE.'/class/class_print_ledger.php';
 
 
-$cn = new Database($gDossier);
+$cn = Dossier::connect();
 $periode = new Periode($cn);
 
 $l_type = "JRN";
diff --git a/include/export/export_poste_detail_csv.php 
b/include/export/export_poste_detail_csv.php
index 27277c9..fda4552 100644
--- a/include/export/export_poste_detail_csv.php
+++ b/include/export/export_poste_detail_csv.php
@@ -33,7 +33,7 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
 $gDossier=dossier::id();
 
 /* Admin. Dossier */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 if ( isset ( $_REQUEST['poste_fille']) )
 { //choisit de voir tous les postes
diff --git a/include/export/export_poste_detail_pdf.php 
b/include/export/export_poste_detail_pdf.php
index d75c13e..a3f66ad 100644
--- a/include/export/export_poste_detail_pdf.php
+++ b/include/export/export_poste_detail_pdf.php
@@ -35,7 +35,7 @@ require_once NOALYSS_INCLUDE.'/lib/class_pdf.php';
 $gDossier=dossier::id();
 
 /* Security */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 extract($_GET);
 
 if ( isset ( $poste_fille) )
diff --git a/include/export/export_reportinit_csv.php 
b/include/export/export_reportinit_csv.php
index 5b7ef43..139f948 100644
--- a/include/export/export_reportinit_csv.php
+++ b/include/export/export_reportinit_csv.php
@@ -45,7 +45,7 @@ if ( ! is_dir('tmp') )
     mkdir ('tmp');
 }
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 $rap=new Acc_Report($cn,$_GET['f']);
 
 $file= fopen('php://output',"a+");
diff --git a/include/export/export_security_pdf.php 
b/include/export/export_security_pdf.php
index a6d81bc..cb2a39f 100755
--- a/include/export/export_security_pdf.php
+++ b/include/export/export_security_pdf.php
@@ -27,7 +27,7 @@ $gDossier=dossier::id();
 require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 require_once NOALYSS_INCLUDE.'/lib/class_pdf.php';
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 //-----------------------------------------------------
 // Security
 
diff --git a/include/ext/dummy/dummy.php b/include/ext/dummy/dummy.php
index 8e4308c..54906a8 100755
--- a/include/ext/dummy/dummy.php
+++ b/include/ext/dummy/dummy.php
@@ -15,7 +15,7 @@ Ce code n'est là QUE pour expliquer le concept
 
 
 // se connecter au dossier courant
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 
 // dans extension.php on vérifie la sécurité, en ajoutez une ici n'est en 
général 
 // pas nécessaire
diff --git a/include/extension_choice.inc.php b/include/extension_choice.inc.php
index 26acca1..2750ad7 100644
--- a/include/extension_choice.inc.php
+++ b/include/extension_choice.inc.php
@@ -16,7 +16,7 @@ require_once  NOALYSS_INCLUDE.'/class/class_user.php';
 echo '<div class="topmenu">';
 @html_page_start($_SESSION['g_theme']);
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 global $g_user;
 $g_user=new User($cn);
 $g_user->check();
diff --git a/include/fiche.inc.php b/include/fiche.inc.php
index 199e405..97a3812 100644
--- a/include/fiche.inc.php
+++ b/include/fiche.inc.php
@@ -27,7 +27,7 @@ require_once NOALYSS_INCLUDE.'/class/class_fiche.php';
 require_once NOALYSS_INCLUDE.'/class/class_lettering.php';
 
 $gDossier = dossier::id();
-$cn = new Database($gDossier);
+$cn = Dossier::connect();
 global $g_user, $g_failed;
 ;
 
diff --git a/include/impress_gl_comptes.inc.php 
b/include/impress_gl_comptes.inc.php
index 4fdc77c..1ae6dd1 100644
--- a/include/impress_gl_comptes.inc.php
+++ b/include/impress_gl_comptes.inc.php
@@ -46,7 +46,7 @@ echo HtmlInput::hidden('type','gl_comptes');
 echo dossier::hidden();
 echo '<TABLE><TR>';
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $periode=new Periode($cn);
 $a=$periode->get_limit($g_user->get_exercice());
 // $a is an array
diff --git a/include/lib/class_html_table.php b/include/lib/class_html_table.php
index f7576b1..9c4bf73 100644
--- a/include/lib/class_html_table.php
+++ b/include/lib/class_html_table.php
@@ -38,7 +38,7 @@ class Html_Table
 @code
  static function test_me()
   {
-    $cn=new Database(Dossier::id());
+    $cn=Dossier::connect();
     $order=" order by f_id desc ";
     $url=HtmlInput::get_to_string(array("gDossier","test_select"));
 
@@ -119,7 +119,7 @@ class Html_Table
   }
   static function test_me()
   {
-    $cn=new Database(Dossier::id());
+    $cn=Dossier::connect();
     $order=" order by f_id desc ";
     $url=HtmlInput::get_to_string(array("gDossier","test_select"));
 
diff --git a/include/lib/class_itva_popup.php b/include/lib/class_itva_popup.php
index 906cc91..f6ea2d7 100644
--- a/include/lib/class_itva_popup.php
+++ b/include/lib/class_itva_popup.php
@@ -144,7 +144,7 @@ class ITva_Popup extends HtmlInput
     /*!\brief print in html the readonly value of the widget*/
     public function display()
     {
-        $cn=  new Database(Dossier::id());
+        $cn=  Dossier::connect();
         $tva=new Acc_Tva($cn, $this->value);
         
         $comment=($tva->load()  != "-1")? $tva->tva_label:"";
diff --git a/include/opening.inc.php b/include/opening.inc.php
index d3d9085..4865e25 100644
--- a/include/opening.inc.php
+++ b/include/opening.inc.php
@@ -182,7 +182,7 @@ if ($sa == 'step3')
        echo HtmlInput::hidden('f', $_REQUEST['f']);
        echo HtmlInput::hidden('p_periode', $_REQUEST['p_periode']);
        $wLedger = new ISelect();
-       $g_user = new User(new Database(dossier::id()));
+       $g_user = new User(Dossier::connect());
        $avail = $g_user->get_ledger('ODS');
        /* compute select list */
        $array = array();
@@ -234,7 +234,7 @@ if ($sa == 'step4')
                        $result[$ck] = 'on';
                $idx++;
        }
-       $cn = new Database(dossier::id());
+       $cn = Dossier::connect();
 
        $jrn = new Acc_Ledger($cn, $_REQUEST['p_jrn']);
 
diff --git a/include/operation_ods_new.inc.php 
b/include/operation_ods_new.inc.php
index 5e637d7..84f0422 100644
--- a/include/operation_ods_new.inc.php
+++ b/include/operation_ods_new.inc.php
@@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/class_pre_op_ods.php';
 require_once NOALYSS_INCLUDE.'/lib/class_iconcerned.php';
 
 global $g_user,$g_parameter;
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 
 $id_predef = (isset($_REQUEST['p_jrn_predef'])) ? $_REQUEST['p_jrn_predef'] : 
-1;
 $id_ledger = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : $id_predef;
diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php
index 2f01b4c..d4df67c 100644
--- a/include/param_pcmn.inc.php
+++ b/include/param_pcmn.inc.php
@@ -32,7 +32,7 @@ $gDossier=dossier::id();
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 
 /* Admin. Dossier */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 require_once  NOALYSS_INCLUDE.'/class/class_user.php';
 
diff --git a/include/param_sec.inc.php b/include/param_sec.inc.php
index 1149df1..033c710 100644
--- a/include/param_sec.inc.php
+++ b/include/param_sec.inc.php
@@ -34,7 +34,7 @@ $gDossier=dossier::id();
 $str_dossier=dossier::get();
 
 /* Admin. Dossier */
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 global $g_user;
 $g_user->Check();
 $g_user->check_dossier($gDossier);
diff --git a/include/periode.inc.php b/include/periode.inc.php
index b5cea54..2cb074f 100644
--- a/include/periode.inc.php
+++ b/include/periode.inc.php
@@ -25,7 +25,7 @@ $gDossier=dossier::id();
 require_once NOALYSS_INCLUDE.'/lib/class_iselect.php';
 require_once  NOALYSS_INCLUDE.'/class/class_periode.php';
 echo '<div class="content">';
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 //-----------------------------------------------------
 // Periode
 //-----------------------------------------------------
diff --git a/include/report.inc.php b/include/report.inc.php
index 5656d4c..43dcf5d 100644
--- a/include/report.inc.php
+++ b/include/report.inc.php
@@ -39,10 +39,10 @@ $gDossier=dossier::id();
 $str_dossier=dossier::get();
 
 /* Admin. Dossier */
-$rep=new Database($gDossier);
+$rep=Dossier::connect();
 
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 
 $rap=new Acc_Report($cn);
 $menu=0;
diff --git a/include/search.inc.php b/include/search.inc.php
index 4098237..92ea604 100644
--- a/include/search.inc.php
+++ b/include/search.inc.php
@@ -31,7 +31,7 @@ $gDossier=dossier::id();
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 /* Admin. Dossier */
 
-$cn=new Database($gDossier);
+$cn=Dossier::connect();
 require_once  NOALYSS_INCLUDE.'/class/class_user.php';
 // display a search box
 
diff --git a/include/verif_bilan.inc.php b/include/verif_bilan.inc.php
index a11c5aa..58827be 100644
--- a/include/verif_bilan.inc.php
+++ b/include/verif_bilan.inc.php
@@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/class_acc_bilan.php';
 
 global $g_captcha,$g_failed,$g_succeed;
 
-$cn=new Database(dossier::id());
+$cn=Dossier::connect();
 $exercice=$g_user->get_exercice();
 echo '<div class="content">';
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]