From fcd9a361aa389e5894ffe838db79790f6090b7f9 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 12 Jan 2005 20:42:01 +0000
Subject: [PATCH] Qual: Uniformisation du code des modules.

---
 htdocs/includes/modules/modAdherent.class.php | 39 +++++++++++++++----
 .../modules/modComptabilite.class.php         | 10 +++--
 .../includes/modules/modExpedition.class.php  |  2 -
 htdocs/includes/modules/modFacture.class.php  |  7 ++++
 htdocs/includes/modules/modSociete.class.php  |  5 +++
 5 files changed, 50 insertions(+), 13 deletions(-)

diff --git a/htdocs/includes/modules/modAdherent.class.php b/htdocs/includes/modules/modAdherent.class.php
index 5602f59d3cb..f98d6a24af7 100644
--- a/htdocs/includes/modules/modAdherent.class.php
+++ b/htdocs/includes/modules/modAdherent.class.php
@@ -121,16 +121,41 @@ class modAdherent extends DolibarrModules
     */
   function init()
   {
+    global $conf;
+    
     // Permissions
     $this->remove();
 
-    $sql = array(
-		 "INSERT INTO ".MAIN_DB_PREFIX."rights_def VALUES (70,'Tous les droits sur les adherents','adherent','a',0);",
-		 "INSERT INTO ".MAIN_DB_PREFIX."rights_def VALUES (71,'Lire les fiche adherents','adherent','r',1);",
-		 "INSERT INTO ".MAIN_DB_PREFIX."rights_def VALUES (72,'Cr�er modifier des adherents','adherent','w',0);",
-		 "INSERT INTO ".MAIN_DB_PREFIX."rights_def VALUES (73,'Modifier les adherents','adherent','m',0);",
-		 "INSERT INTO ".MAIN_DB_PREFIX."rights_def VALUES (74,'Supprimer les adherents','adherent','d',0);"
-		 );
+    $this->rights[0][0] = 70; // id de la permission
+    $this->rights[0][1] = 'Tous les droits sur les adherents'; // libelle de la permission
+    $this->rights[0][2] = 'a'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[0][3] = 0; // La permission est-elle une permission par d�faut
+
+    $this->rights[1][0] = 71; // id de la permission
+    $this->rights[1][1] = 'Lire les fiche adherents'; // libelle de la permission
+    $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+
+    $this->rights[2][0] = 72; // id de la permission
+    $this->rights[2][1] = 'Cr�er modifier des adherents'; // libelle de la permission
+    $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+
+    $this->rights[3][0] = 73; // id de la permission
+    $this->rights[3][1] = 'Modifier les adherents'; // libelle de la permission
+    $this->rights[3][2] = 'm'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+
+    $this->rights[4][0] = 74; // id de la permission
+    $this->rights[4][1] = 'Supprimer les adherents'; // libelle de la permission
+    $this->rights[4][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[4][3] = 0; // La permission est-elle une permission par d�faut
+
+    // Dir
+    $this->dirs[0] = $conf->adherent->dir_output;
+    $this->dirs[1] = $conf->adherent->dir_output."/photos";
+  
+    $sql = array();
     
     return $this->_init($sql);
   }
diff --git a/htdocs/includes/modules/modComptabilite.class.php b/htdocs/includes/modules/modComptabilite.class.php
index cac162f22cb..80d955ae4aa 100644
--- a/htdocs/includes/modules/modComptabilite.class.php
+++ b/htdocs/includes/modules/modComptabilite.class.php
@@ -83,8 +83,11 @@ class modComptabilite extends DolibarrModules
     */
   function init()
   {
+    global $conf;
+    
     // Permissions
     $this->remove();
+
     $isq = "INSERT INTO ".MAIN_DB_PREFIX."rights_def VALUES";
     $sql = array(
 		 "$isq (90,'Tous les droits sur la compta','compta',NULL,NULL,'a',0);",
@@ -98,10 +101,9 @@ class modComptabilite extends DolibarrModules
 
 
     // Dir
-    $this->dirs[0] = DOL_DATA_ROOT."/compta/";
-    $this->dirs[1] = DOL_DATA_ROOT."/compta/export/";
-    
-
+    $this->dirs[0] = $conf->compta->dir_output;
+    $this->dirs[1] = $conf->compta->dir_output."/rapport";
+    $this->dirs[2] = $conf->compta->dir_output."/export";
     
     return $this->_init($sql);
   }
diff --git a/htdocs/includes/modules/modExpedition.class.php b/htdocs/includes/modules/modExpedition.class.php
index c87b4a45e77..5c5adb38f19 100644
--- a/htdocs/includes/modules/modExpedition.class.php
+++ b/htdocs/includes/modules/modExpedition.class.php
@@ -86,8 +86,6 @@ class modExpedition extends DolibarrModules
     // Permissions
     $this->remove();
 
-    $sql = array();
-
     $this->rights[0][0] = 100; // id de la permission
     $this->rights[0][1] = 'Tous les droits sur les expeditions'; // libelle de la permission
     $this->rights[0][2] = 'a'; // type de la permission (d�pr�ci� � ce jour)
diff --git a/htdocs/includes/modules/modFacture.class.php b/htdocs/includes/modules/modFacture.class.php
index 9272bdeb262..727f995e6c6 100644
--- a/htdocs/includes/modules/modFacture.class.php
+++ b/htdocs/includes/modules/modFacture.class.php
@@ -126,6 +126,8 @@ class modFacture extends DolibarrModules
     */
   function init()
   {
+    global $conf;
+    
     // Permissions
     $this->remove();
 
@@ -164,6 +166,11 @@ class modFacture extends DolibarrModules
     $this->rights[6][2] = 'a';
     $this->rights[6][3] = 0;
 
+    // Dir
+    $this->dirs[0] = $conf->facture->dir_output;
+    
+    $sql = array();
+
     return $this->_init($sql);
   }
 
diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php
index 0991805d649..aa957a8b90b 100644
--- a/htdocs/includes/modules/modSociete.class.php
+++ b/htdocs/includes/modules/modSociete.class.php
@@ -83,6 +83,8 @@ class modSociete extends DolibarrModules
     */
   function init()
   {
+    global $conf;
+    
     // Permissions
     $this->remove();
 
@@ -106,6 +108,9 @@ class modSociete extends DolibarrModules
     $this->rights[3][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
 
+    // Dir
+    $this->dirs[0] = $conf->societe->dir_output;
+    
     $sql = array();
     
     return $this->_init($sql);
-- 
GitLab