diff --git a/html/ajax_card.php b/html/ajax_card.php
index 3deb19fa5..29030170e 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 0a84cdf00..c7b3285f1 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 aaa5f3103..6ab53d4f7 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 69c578ce1..379091d2d 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 "
Il y a une erreur, ce plugin n'existe pas";
+ echo HtmlInput::title_box(_("Ce plugin n'existe pas "), $ctl);
+ echo "
"._("Il y a une erreur, ce plugin n'existe pas").
+ "
";
exit;
}
$me_code = new IText('me_code', $m[0] ['me_code']);
diff --git a/html/ajax_poste.php b/html/ajax_poste.php
index ea6f1b2ba..462557112 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 2cc50273d..e71dfd7f3 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 a98407fb0..f4f9de7c6 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 36fed4b12..d968d4283 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 9640178c5..566188797 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 1124fc319..86cb67941 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 5ff457679..7cd12dc2f 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 3e02cdfc2..a09530196 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 d9842fc27..fab07b321 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 d756cd5b1..e7b888485 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 30f84903c..aba5f08f7 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 728333d69..a30cdfd58 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 0c993d3f9..bafd8aa5f 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 7811e3fc6..2af9bbf73 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 e0f99eb42..819c8b0a8 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 912bd1f8b..b85088874 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 3d5908c94..f005149f4 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 eaf004e8c..a26046763 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 42a723111..82bb35de6 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 6043f8f35..bd6bac2e4 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 1e69f3706..f8347ad2f 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 0d5afa633..274039d64 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 119c9cf14..f5b693950 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 049071ed0..2088bbdc6 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 45300e266..2f8654cad 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 1d44e568b..d4066187d 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 3aefc8d15..912cf2fbd 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 f992d4ff3..6a1c0fa72 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 7131e5acf..3feb08671 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 18c6538ea..14b1b18d2 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 1f4a377e0..97e1b3287 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 61e00a37b..801daaccf 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 282dde6d4..f983c743c 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 "Poste_Analytique
";
diff --git a/include/class/class_anc_balance_double.php b/include/class/class_anc_balance_double.php
index cceff7720..c799d8d12 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 f5673f129..000e7628d 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 f31b8e414..30d3a0436 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 08f9a7c9d..2140ca9cb 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 1c029b7fb..8e907d5c5 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 2597c1fb7..3db85afef 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 "Plan analytique : test
";
echo "clean";
$cn->exec_sql("delete from plan_analytique");
diff --git a/include/class/class_anticipation.php b/include/class/class_anticipation.php
index 2adf7dfe5..230339fcf 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 4959392ea..af86dec84 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 cb06d4877..6e7e211e0 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 1df3079f7..67f43b052 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 887c21702..6e321a9af 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 282d76225..136b567eb 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 3dd7fffd8..bf1197d69 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 fbecc45b5..a5cf6851c 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 4364c45b8..067f85fc0 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 6c3e16665..65db9337e 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 6a096024c..5a948c8ff 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 66fde7eee..5f55cee73 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 f88d6c8d7..5d08e3431 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 9ae545e8d..805a42df3 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 e16f90c5d..e7c7cdc6d 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 b031bb559..f4767ea10 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 828fd4777..a31347c71 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 4106eb1ba..ee957bd8b 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 b12dd493b..286e63a9b 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 4fe9ea569..a0b6d4031 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 343f6d050..3d1a93bf0 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 64956d2c8..ed26bcb3f 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 10810896b..226111118 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 b1e5aa6e7..167cc3e25 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 709e9485f..991cf911d 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 0e8d9c4ab..1f9c2b505 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 27277c969..fda45529f 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 d75c13e06..a3f66ad7e 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 5b7ef431e..139f9481e 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 a6d81bc2d..cb2a39f6f 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 8e4308cc7..54906a83b 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 26acca1af..2750ad798 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 '