From 754041115f06e8831ebedacfcd7a5dad1a72c375 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Mon, 4 May 2009 11:40:00 +0000
Subject: [PATCH] Qual: Reduce quantity of code. Make code simpler

---
 htdocs/comm/action/rapport/index.php          |  16 +-
 .../prelevement/bon-prelevement.class.php     |   2 +-
 htdocs/compta/prelevement/fiche.php           |   2 +-
 htdocs/includes/modules/modAdherent.class.php |  14 +-
 htdocs/includes/modules/modBanque.class.php   | 256 ++++++------
 htdocs/includes/modules/modBarcode.class.php  |  10 +-
 htdocs/includes/modules/modBookmark.class.php |  14 +-
 htdocs/includes/modules/modBoutique.class.php |  26 +-
 htdocs/includes/modules/modCashDesk.class.php |  40 +-
 .../includes/modules/modCategorie.class.php   |   2 +-
 .../includes/modules/modClickToDial.class.php |   2 +-
 htdocs/includes/modules/modCommande.class.php |  18 +-
 .../includes/modules/modCommercial.class.php  |  44 +-
 .../modules/modComptabiliteExpert.class.php   |  42 +-
 htdocs/includes/modules/modContrat.class.php  | 210 +++++-----
 .../includes/modules/modDeplacement.class.php |  18 +-
 htdocs/includes/modules/modDocument.class.php |  10 +-
 htdocs/includes/modules/modDomain.class.php   |  49 ++-
 htdocs/includes/modules/modDon.class.php      |  27 +-
 .../includes/modules/modDroitPret.class.php   |  11 +-
 htdocs/includes/modules/modECM.class.php      |  46 +--
 htdocs/includes/modules/modEditeur.class.php  |   7 +-
 htdocs/includes/modules/modEnergie.class.php  |  21 +-
 .../includes/modules/modExpedition.class.php  |   5 +-
 htdocs/includes/modules/modExport.class.php   |  16 +-
 .../includes/modules/modExternalRss.class.php |  12 +-
 htdocs/includes/modules/modFacture.class.php  | 376 +++++++++---------
 .../includes/modules/modFckeditor.class.php   |  14 +-
 .../includes/modules/modFicheinter.class.php  |  14 +-
 .../includes/modules/modFournisseur.class.php |  19 +-
 htdocs/includes/modules/modImport.class.php   |  10 +-
 htdocs/includes/modules/modLabel.class.php    |  10 +-
 htdocs/includes/modules/modLdap.class.php     |  27 +-
 htdocs/includes/modules/modMailing.class.php  |  10 +-
 htdocs/includes/modules/modMantis.class.php   |  35 +-
 .../modules/modMultiCompany.class.php         |  10 +-
 .../modules/modNotification.class.php         |   4 +-
 .../modules/modOSCommerceWS.class.php         |   2 +-
 htdocs/includes/modules/modPaybox.class.php   |   4 +-
 htdocs/includes/modules/modPostnuke.class.php |   5 +-
 .../includes/modules/modPrelevement.class.php |  18 +-
 htdocs/includes/modules/modProduit.class.php  |  18 +-
 htdocs/includes/modules/modProjet.class.php   |   3 +
 htdocs/includes/modules/modPropale.class.php  |  20 +-
 htdocs/includes/modules/modService.class.php  |  22 +-
 htdocs/includes/modules/modSociete.class.php  |  13 +-
 htdocs/includes/modules/modStock.class.php    |  10 +-
 htdocs/includes/modules/modSyslog.class.php   |   5 -
 htdocs/includes/modules/modTax.class.php      |  84 ++--
 .../includes/modules/modTelephonie.class.php  |  61 +--
 htdocs/includes/modules/modUser.class.php     |  22 +-
 htdocs/viewimage.php                          |   6 +-
 52 files changed, 715 insertions(+), 1027 deletions(-)

diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php
index 19b4bae589e..55dab8162ba 100644
--- a/htdocs/comm/action/rapport/index.php
+++ b/htdocs/comm/action/rapport/index.php
@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2003      Eric Seigne          <erics@rycks.com>
- * Copyright (C) 2004-2008 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -92,23 +92,23 @@ if ($resql)
 	while ($i < min($num,$limit))
 	{
 		$obj=$db->fetch_object($resql);
-		
+
 		if ($obj)
 		{
 			$var=!$var;
 			print "<tr $bc[$var]>";
-	
+
 			print "<td>$obj->df</td>\n";
 			print '<td align="center">'.$obj->cc.'</td>';
-	
+
 			print '<td>';
 			print '<a href="index.php?action=builddoc&amp;page='.$page.'&amp;month='.$obj->month.'&amp;year='.$obj->year.'">'.img_file_new().'</a>';
 			print '</td>';
-	
+
 			$name = "actions-".$obj->month."-".$obj->year.".pdf";
 			$relativepath= $name;
-			$file = $conf->commercial->dir_actions_temp."/".$name;
-	
+			$file = $conf->agenda->dir_temp."/".$name;
+
 			if (file_exists($file))
 			{
 				print '<td align="center"><a href="'.DOL_URL_ROOT.'/document.php?page='.$page.'&amp;file='.urlencode($relativepath).'&amp;modulepart=actionsreport">'.img_pdf().'</a></td>';
@@ -120,7 +120,7 @@ if ($resql)
 				print '<td>&nbsp;</td>';
 				print '<td>&nbsp;</td>';
 			}
-	
+
 			print "</tr>\n";
 		}
 		$i++;
diff --git a/htdocs/compta/prelevement/bon-prelevement.class.php b/htdocs/compta/prelevement/bon-prelevement.class.php
index 55c3cb7ea02..2d3635f3db9 100644
--- a/htdocs/compta/prelevement/bon-prelevement.class.php
+++ b/htdocs/compta/prelevement/bon-prelevement.class.php
@@ -830,7 +830,7 @@ class BonPrelevement extends CommonObject
                 {
                     $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
 
-                    $dir=$conf->prelevement->dir_bon;
+                    $dir=$conf->prelevement->dir_output.'/receipts';
                     $file=$filebonprev;
                     if (! is_dir($dir)) create_exdir($dir);
 
diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php
index 1e670001863..5ea922c4c15 100644
--- a/htdocs/compta/prelevement/fiche.php
+++ b/htdocs/compta/prelevement/fiche.php
@@ -58,7 +58,7 @@ if ($_POST["action"] == 'infotrans')
 
 	if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
 	{
-		$dir = $conf->prelevement->dir_bon;
+		$dir = $conf->prelevement->dir_output.'/receipts';
 
 		if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name'],1) > 0)
 		{
diff --git a/htdocs/includes/modules/modAdherent.class.php b/htdocs/includes/modules/modAdherent.class.php
index 116b94f403a..74d238dea11 100644
--- a/htdocs/includes/modules/modAdherent.class.php
+++ b/htdocs/includes/modules/modAdherent.class.php
@@ -61,19 +61,7 @@ class modAdherent extends DolibarrModules
         $this->picto='user';
 
         // Data directories to create when module is enabled
-        $this->dirs = array();
-        $r=0;
-        
-        $this->dirs[$r][0] = "output";
-        $this->dirs[$r][1] = "/adherent";
-        
-        $r++;
-        $this->dirs[$r][0] = "temp";
-        $this->dirs[$r][1] = "/adherent/temp";
-        
-        $r++;
-        $this->dirs[$r][0] = "photos";
-        $this->dirs[$r][1] = "/adherent/photos";
+        $this->dirs = array("/adherent/temp");
 
         // Config pages
         //-------------
diff --git a/htdocs/includes/modules/modBanque.class.php b/htdocs/includes/modules/modBanque.class.php
index 092c743a432..e877057dcff 100644
--- a/htdocs/includes/modules/modBanque.class.php
+++ b/htdocs/includes/modules/modBanque.class.php
@@ -21,177 +21,169 @@
  */
 
 /**     \defgroup   banque     Module banque
-        \brief      Module pour g�rer la tenue d'un compte bancaire et rapprochements
-		\version	$Id$
-*/
+ \brief      Module pour g�rer la tenue d'un compte bancaire et rapprochements
+ \version	$Id$
+ */
 
 /**
-        \file       htdocs/includes/modules/modBanque.class.php
-        \ingroup    banque
-        \brief      Fichier de description et activation du module Banque
-*/
+ \file       htdocs/includes/modules/modBanque.class.php
+ \ingroup    banque
+ \brief      Fichier de description et activation du module Banque
+ */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 
 
 /**     \class      modBanque
-		\brief      Classe de description et activation du module Banque
-*/
+ \brief      Classe de description et activation du module Banque
+ */
 
 class modBanque extends DolibarrModules
 {
 
-   /**
-    *   \brief      Constructeur. Definit les noms, constantes et boites
-    *   \param      DB      handler d'acc�s base
-    */
+	/**
+	 *   \brief      Constructeur. Definit les noms, constantes et boites
+	 *   \param      DB      handler d'acc�s base
+	 */
 	function modBanque($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
-	  $this->numero = 85 ;
+		$this->numero = 85 ;
 
-	  $this->family = "financial";
+		$this->family = "financial";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = eregi_replace('^mod','',get_class($this));
-	  $this->description = "Gestion des comptes financiers de type Comptes bancaires ou postaux";
+		$this->description = "Gestion des comptes financiers de type Comptes bancaires ou postaux";
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
 
-	  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
-	  $this->special = 0;
-	  $this->picto='account';
-	  
-	  // Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/banque";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/banque/temp";
+		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
+		$this->special = 0;
+		$this->picto='account';
+
+		// Data directories to create when module is enabled
+		$this->dirs = array("/banque/temp");
 
-	  // D�pendances
-	  $this->depends = array();
-	  $this->requiredby = array("modComptabilite","modComptabiliteExpert");
+		// Dependancies
+		$this->depends = array();
+		$this->requiredby = array("modComptabilite","modComptabiliteExpert");
 		$this->conflictwith = array();
 		$this->langfiles = array("banks","compta","bills","companies");
 
-	  // Constantes
-	  $this->const = array();
-
-	  // Boites
-	  $this->boxes = array();
-	  $this->boxes[0][1] = "box_comptes.php";
-
-	  // Permissions
-	  $this->rights = array();
-	  $this->rights_class = 'banque';
-	  $r=0;
-
-	  $r++;
-	  $this->rights[$r][0] = 111; // id de la permission
-	  $this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission
-	  $this->rights[$r][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
-	  $this->rights[$r][3] = 1; // La permission est-elle une permission par d�faut
-	  $this->rights[$r][4] = 'lire';
-
-	  $r++;
-	  $this->rights[$r][0] = 112; // id de la permission
-	  $this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire'; // libelle de la permission
-	  $this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
-	  $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
-	  $this->rights[$r][4] = 'modifier';
-
-	  $r++;
-	  $this->rights[$r][0] = 113; // id de la permission
-	  $this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)'; // libelle de la permission
-	  $this->rights[$r][2] = 'a'; // type de la permission (d�pr�ci� � ce jour)
-	  $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
-	  $this->rights[$r][4] = 'configurer';
-
-	  $r++;
-	  $this->rights[$r][0] = 114; // id de la permission
-	  $this->rights[$r][1] = 'Rapprocher les ecritures bancaires'; // libelle de la permission
-	  $this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
-	  $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
-	  $this->rights[$r][4] = 'consolidate';
-
-    $r++;
-	  $this->rights[$r][0] = 115; // id de la permission
-	  $this->rights[$r][1] = 'Exporter transactions et releves'; // libelle de la permission
-	  $this->rights[$r][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
-	  $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
-	  $this->rights[$r][4] = 'export';
-
-   	$r++;
-	  $this->rights[$r][0] = 116; // id de la permission
-	  $this->rights[$r][1] = 'Virements entre comptes'; // libelle de la permission
-	  $this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
-	  $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
-	  $this->rights[$r][4] = 'transfer';
-
-	  $r++;
-	  $this->rights[$r][0] = 117; // id de la permission
-	  $this->rights[$r][1] = 'Gerer les envois de cheques'; // libelle de la permission
-	  $this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
-	  $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
-	  $this->rights[$r][4] = 'cheque';
-	  
-	  
-	  
-	  // Exports
-    //--------
-    $r=0;
-
-    $r++;
-    $this->export_code[$r]=$this->rights_class.'_'.$r;
-    $this->export_label[$r]='Ecritures bancaires et relev�s';
-    $this->export_permission[$r]=array(array("banque","export"));
-    $this->export_fields_array[$r]=array('b.rowid'=>'IdTransaction','ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','b.num_chq'=>'ChequeOrTransferNumber','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode");
+		// Constants
+		$this->const = array();
+
+		// Boites
+		$this->boxes = array();
+		$this->boxes[0][1] = "box_comptes.php";
+
+		// Permissions
+		$this->rights = array();
+		$this->rights_class = 'banque';
+		$r=0;
+
+		$r++;
+		$this->rights[$r][0] = 111; // id de la permission
+		$this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission
+		$this->rights[$r][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
+		$this->rights[$r][3] = 1; // La permission est-elle une permission par d�faut
+		$this->rights[$r][4] = 'lire';
+
+		$r++;
+		$this->rights[$r][0] = 112; // id de la permission
+		$this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire'; // libelle de la permission
+		$this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
+		$this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
+		$this->rights[$r][4] = 'modifier';
+
+		$r++;
+		$this->rights[$r][0] = 113; // id de la permission
+		$this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)'; // libelle de la permission
+		$this->rights[$r][2] = 'a'; // type de la permission (d�pr�ci� � ce jour)
+		$this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
+		$this->rights[$r][4] = 'configurer';
+
+		$r++;
+		$this->rights[$r][0] = 114; // id de la permission
+		$this->rights[$r][1] = 'Rapprocher les ecritures bancaires'; // libelle de la permission
+		$this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
+		$this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
+		$this->rights[$r][4] = 'consolidate';
+
+		$r++;
+		$this->rights[$r][0] = 115; // id de la permission
+		$this->rights[$r][1] = 'Exporter transactions et releves'; // libelle de la permission
+		$this->rights[$r][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
+		$this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
+		$this->rights[$r][4] = 'export';
+
+		$r++;
+		$this->rights[$r][0] = 116; // id de la permission
+		$this->rights[$r][1] = 'Virements entre comptes'; // libelle de la permission
+		$this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
+		$this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
+		$this->rights[$r][4] = 'transfer';
+
+		$r++;
+		$this->rights[$r][0] = 117; // id de la permission
+		$this->rights[$r][1] = 'Gerer les envois de cheques'; // libelle de la permission
+		$this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
+		$this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut
+		$this->rights[$r][4] = 'cheque';
+
+
+
+		// Exports
+		//--------
+		$r=0;
+
+		$r++;
+		$this->export_code[$r]=$this->rights_class.'_'.$r;
+		$this->export_label[$r]='Ecritures bancaires et relev�s';
+		$this->export_permission[$r]=array(array("banque","export"));
+		$this->export_fields_array[$r]=array('b.rowid'=>'IdTransaction','ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','b.num_chq'=>'ChequeOrTransferNumber','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode");
 		$this->export_entities_array[$r]=array('b.rowid'=>'account','ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.dateo'=>'account','b.label'=>'account','b.num_chq'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account","bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company");
-    $this->export_alias_array[$r]=array('b.rowid'=>'tran_id','ba.ref'=>'account_ref','ba.label'=>'account_label','b.datev'=>'datev','b.dateo'=>'dateo','b.label'=>'label','b.num_chq'=>'num','-b.amount'=>'debit','b.amount'=>'credit','b.num_releve'=>'numrel','b.datec'=>"datec","bu.url_id"=>"soc_id","s.nom"=>"thirdparty","s.code_compta"=>"customeracccode","s.code_compta_fournisseur"=>"supplieracccode");
+		$this->export_alias_array[$r]=array('b.rowid'=>'tran_id','ba.ref'=>'account_ref','ba.label'=>'account_label','b.datev'=>'datev','b.dateo'=>'dateo','b.label'=>'label','b.num_chq'=>'num','-b.amount'=>'debit','b.amount'=>'credit','b.num_releve'=>'numrel','b.datec'=>"datec","bu.url_id"=>"soc_id","s.nom"=>"thirdparty","s.code_compta"=>"customeracccode","s.code_compta_fournisseur"=>"supplieracccode");
 		$this->export_special_array[$r]=array('-b.amount'=>'NULLIFNEG','b.amount'=>'NULLIFNEG');
 
-    $this->export_sql_start[$r]='SELECT DISTINCT ';
-    $this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'bank_account as ba, '.MAIN_DB_PREFIX.'bank as b)';
+		$this->export_sql_start[$r]='SELECT DISTINCT ';
+		$this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'bank_account as ba, '.MAIN_DB_PREFIX.'bank as b)';
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."bank_url as bu ON (bu.fk_bank = b.rowid AND bu.type = 'company')";
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON bu.url_id = s.rowid';
-    $this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account';
-    $this->export_sql_end[$r] .=' AND ba.entity = '.$conf->entity;
+		$this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account';
+		$this->export_sql_end[$r] .=' AND ba.entity = '.$conf->entity;
 		$this->export_sql_end[$r] .=' ORDER BY b.datev, b.num_releve';
 	}
 
 
-   /**
-    *   \brief      Fonction appel�e lors de l'activation du module. Ins�re en base les constantes, boites, permissions du module.
-    *               D�finit �galement les r�pertoires de donn�es � cr�er pour ce module.
-    */
-    function init()
-    {
-    	global $conf;
+	/**
+	 *   \brief      Fonction appel�e lors de l'activation du module. Ins�re en base les constantes, boites, permissions du module.
+	 *               D�finit �galement les r�pertoires de donn�es � cr�er pour ce module.
+	 */
+	function init()
+	{
+		global $conf;
 
-      // Permissions
-      $this->remove();
+		// Permissions
+		$this->remove();
 
-      $sql = array();
+		$sql = array();
 
-      return $this->_init($sql);
-    }
+		return $this->_init($sql);
+	}
 
-  /**
-   *    \brief      Fonction appel�e lors de la d�sactivation d'un module.
-   *                Supprime de la base les constantes, boites et permissions du module.
-   */
-  function remove()
-  {
-    $sql = array();
+	/**
+	 *    \brief      Fonction appel�e lors de la d�sactivation d'un module.
+	 *                Supprime de la base les constantes, boites et permissions du module.
+	 */
+	function remove()
+	{
+		$sql = array();
 
-    return $this->_remove($sql);
-  }
+		return $this->_remove($sql);
+	}
 }
 ?>
\ No newline at end of file
diff --git a/htdocs/includes/modules/modBarcode.class.php b/htdocs/includes/modules/modBarcode.class.php
index 4d7d6b40d8d..f1aa21741f4 100644
--- a/htdocs/includes/modules/modBarcode.class.php
+++ b/htdocs/includes/modules/modBarcode.class.php
@@ -59,15 +59,7 @@ class modBarcode extends DolibarrModules
 		$this->picto='barcode';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/barcode";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/barcode/temp";
+		$this->dirs = array("/barcode/temp");
 
 		// Dependances
 		$this->depends = array("modProduit");
diff --git a/htdocs/includes/modules/modBookmark.class.php b/htdocs/includes/modules/modBookmark.class.php
index dde9df3ffe3..d2657d62156 100644
--- a/htdocs/includes/modules/modBookmark.class.php
+++ b/htdocs/includes/modules/modBookmark.class.php
@@ -18,15 +18,15 @@
  */
 
 /**
- \defgroup   bookmark    Module Bookmark
- \brief      Module pour g�rer les Bookmarks
- \version	$Id$
+ *	\defgroup   bookmark    Module Bookmark
+ *	\brief      Module to manage Bookmarks
+ *	\version	$Id$
  */
 
 /**
- \file       htdocs/includes/modules/modBookmark.class.php
- \ingroup    bookmark
- \brief      Fichier de description et activation du module Bookmarks
+ *	\file       htdocs/includes/modules/modBookmark.class.php
+ *	\ingroup    bookmark
+ *	\brief      Fichier de description et activation du module Bookmarks
  */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@@ -61,7 +61,7 @@ class modBookmark extends DolibarrModules
 		$this->special = 2;
 		$this->picto='bookmark';
 
-		// Dir
+		// Data directories to create when module is enabled
 		$this->dirs = array();
 
 		// Dependancies
diff --git a/htdocs/includes/modules/modBoutique.class.php b/htdocs/includes/modules/modBoutique.class.php
index f8c6fe29e8b..e72f6b71989 100644
--- a/htdocs/includes/modules/modBoutique.class.php
+++ b/htdocs/includes/modules/modBoutique.class.php
@@ -33,7 +33,7 @@
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 
 
-/** 
+/**
 		\class 		modBoutique
 		\brief      Classe de description et activation du module OSCommerce
 */
@@ -57,23 +57,23 @@ class modBoutique extends DolibarrModules
 		$this->version = 'dolibarr';                        // 'experimental' or 'dolibarr' or version
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 1;
-	
-		// Dir
+
+		// Data directories to create when module is enabled
 		$this->dirs = array();
-	
+
 		// Config pages
 //		$this->config_page_url = array("boutique.php","osc-languages.php");
 		$this->config_page_url = array("boutique.php");
-	
-		// Dependances
+
+		// Dependancies
 		$this->depends = array();
 		$this->requiredby = array();
 	    $this->conflictwith = array("modOSCommerceWS");
 	   	$this->langfiles = array("shop");
-	
-		// Constantes
+
+		// Constants
 		$this->const = array();
-	
+
 	    // Boites
 	    $this->boxes = array();
 
@@ -81,7 +81,7 @@ class modBoutique extends DolibarrModules
 		$this->rights = array();
 		$this->rights_class = 'boutique';
 	}
-  
+
    /**
     *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
     *               Definit egalement les repertoires de donnees a creer pour ce module.
@@ -89,7 +89,7 @@ class modBoutique extends DolibarrModules
 	function init()
 	{
 		$sql = array();
-		
+
 		return $this->_init($sql);
 	}
 
@@ -100,9 +100,9 @@ class modBoutique extends DolibarrModules
 	function remove()
 	{
 		$sql = array();
-		
+
 		return $this->_remove($sql);
 	}
-  
+
 }
 ?>
diff --git a/htdocs/includes/modules/modCashDesk.class.php b/htdocs/includes/modules/modCashDesk.class.php
index cce4526119d..e50ef573bce 100644
--- a/htdocs/includes/modules/modCashDesk.class.php
+++ b/htdocs/includes/modules/modCashDesk.class.php
@@ -31,9 +31,9 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 
 
 /**
-        \class      modCategorie
-        \brief      Classe de description et activation du module Categorie
-*/
+ *       \class      modCategorie
+ *       \brief      Classe de description et activation du module Categorie
+ */
 class modCashDesk extends DolibarrModules
 {
 	/**
@@ -43,51 +43,51 @@ class modCashDesk extends DolibarrModules
 	function modCashDesk ($DB)
 	{
 		$this->db = $DB;
-		
+
 		// Id for module (must be unique).
 		// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
 		$this->numero = 50100;
 		// Key text used to identify module (for permission, menus, etc...)
 		$this->rights_class = 'cashdesk';
-		
+
 		$this->family = "products";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = eregi_replace('^mod','',get_class($this));
 		$this->description = "CashDesk module";
-	
+
 		$this->revision = explode(' ','$Revision$');
 		$this->version = 'development';
 		//$this->version = 'experimental';    // 'development' or 'experimental' or 'dolibarr' or version
-	
+
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
 		$this->picto = 'generic';
-	
-		// Dir
+
+		// Data directories to create when module is enabled
 		$this->dirs = array();
-	
+
 		// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
 		$this->style_sheet = '';
-		
+
 		// Config pages. Put here list of php page names stored in admmin directory used to setup module.
 		$this->config_page_url = array("cashdesk.php");
-		
+
 		// Dependencies
 		$this->depends = array("modBanque","modFacture","modProduit","modStock");	// List of modules id that must be enabled if this module is enabled
 		$this->requiredby = array();			// List of modules id to disable if this one is disabled
 		$this->phpmin = array(4,1);					// Minimum version of PHP required by module
 		$this->need_dolibarr_version = array(2,4);	// Minimum version of Dolibarr required by module
 		$this->langfiles = array("@cashdesk");
-	
+
 		// Constantes
 		$this->const = array();
-	
+
 		// Boxes
 		$this->boxes = array();
-	
+
 		// Permissions
 		$this->rights = array();
-		
+
 		// Main menu entries
 		$this->menus = array();			// List of menus to add
 		$r=0;
@@ -106,7 +106,7 @@ class modCashDesk extends DolibarrModules
 									'user'=>0);				// 0=Menu for internal users, 1=external users, 2=both
 
 		$r++;
-		
+
 		// This is to declare a Left Menu entry:
 		// $this->menu[$r]=array(	'fk_menu'=>'r=0',		// Use r=value where r is index key used for the top menu entry
 		//							'type'=>'left',			// This is a Left menu entry
@@ -131,9 +131,9 @@ class modCashDesk extends DolibarrModules
 	function init()
   	{
     	$sql = array();
-    
+
 		$result=$this->load_tables();
-	
+
     	return $this->_init($sql);
   	}
 
@@ -162,6 +162,6 @@ class modCashDesk extends DolibarrModules
 	{
 		return $this->_load_tables('/cashdesk/sql/');
 	}
-	  	
+
 }
 ?>
diff --git a/htdocs/includes/modules/modCategorie.class.php b/htdocs/includes/modules/modCategorie.class.php
index eecb10da6a4..e28d1b278c2 100644
--- a/htdocs/includes/modules/modCategorie.class.php
+++ b/htdocs/includes/modules/modCategorie.class.php
@@ -58,7 +58,7 @@ class modCategorie extends DolibarrModules
 		$this->special = 2;
 		$this->picto = 'generic';
 
-		// Dir
+		// Data directories to create when module is enabled
 		$this->dirs = array();
 
 		// Dependencies
diff --git a/htdocs/includes/modules/modClickToDial.class.php b/htdocs/includes/modules/modClickToDial.class.php
index e6f9dd99f56..09086bf91da 100644
--- a/htdocs/includes/modules/modClickToDial.class.php
+++ b/htdocs/includes/modules/modClickToDial.class.php
@@ -60,7 +60,7 @@ class modClickToDial extends DolibarrModules
 		$this->special = 1;
 		$this->picto='phoning';
 
-		// Dir
+		// Data directories to create when module is enabled
 		$this->dirs = array();
 
 		// Dependencies
diff --git a/htdocs/includes/modules/modCommande.class.php b/htdocs/includes/modules/modCommande.class.php
index 3608100dd1d..de1951fafd8 100644
--- a/htdocs/includes/modules/modCommande.class.php
+++ b/htdocs/includes/modules/modCommande.class.php
@@ -48,7 +48,7 @@ class modCommande extends DolibarrModules
 	function modCommande($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 25 ;
 
@@ -58,21 +58,13 @@ class modCommande extends DolibarrModules
 		$this->description = "Gestion des commandes clients";
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
-		
+
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
 		$this->picto='order';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/commande";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/commande/temp";
+		$this->dirs = array("/commande/temp");
 
 		// Config pages
 		$this->config_page_url = array("commande.php");
@@ -86,13 +78,13 @@ class modCommande extends DolibarrModules
 		// Constantes
 		$this->const = array();
 		$r=0;
-		
+
 		$this->const[$r][0] = "COMMANDE_ADDON_PDF";
 		$this->const[$r][1] = "chaine";
 		$this->const[$r][2] = "einstein";
 		$this->const[$r][3] = 'Nom du gestionnaire de generation des commandes en PDF';
 		$this->const[$r][4] = 0;
-		
+
 		$r++;
 		$this->const[$r][0] = "COMMANDE_ADDON";
 		$this->const[$r][1] = "chaine";
diff --git a/htdocs/includes/modules/modCommercial.class.php b/htdocs/includes/modules/modCommercial.class.php
index a88afea79c2..c2f0aa889f9 100644
--- a/htdocs/includes/modules/modCommercial.class.php
+++ b/htdocs/includes/modules/modCommercial.class.php
@@ -48,53 +48,37 @@ class modCommercial extends DolibarrModules
   {
   	$this->db = $DB ;
     $this->numero = 2 ;
-        
+
     $this->family = "crm";
     // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
     $this->name = eregi_replace('^mod','',get_class($this));
     $this->description = "Gestion commercial";
-      
+
     // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
     $this->version = 'dolibarr';
-      
+
     $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
     $this->special = 0;
     $this->picto='commercial';
-      
+
     // Data directories to create when module is enabled
-    $this->dirs = array();
-    $r=0;
-      
-    $this->dirs[$r][0] = "output";
-    $this->dirs[$r][1] = "/comm";
-      
-    $r++;
-    $this->dirs[$r][0] = "temp";
-    $this->dirs[$r][1] = "/comm/temp";
-    
-    $r++;
-    $this->dirs[$r][0] = "actions";
-    $this->dirs[$r][1] = "/action";
-    
-    $r++;
-    $this->dirs[$r][0] = "actions_temp";
-    $this->dirs[$r][1] = "/action/temp";
-        
+    $this->dirs = array("/comm/temp");
+
     // Dependancies
     $this->depends = array("modSociete");
     $this->requiredby = array("modPropale","modContrat","modCommande","modFicheinter");
-        
-    // Constantes
+
+    // Constants
     $this->const = array();
-        
+
     // Boxes
     $this->boxes = array();
-        
+
     // Permissions
     $this->rights = array();
     $this->rights_class = 'commercial';
     $r = 1;
-        
+
     // 261 : Permission generale
     $this->rights[$r][0] = 261;
     $this->rights[$r][1] = 'Consulter menu commercial';
@@ -113,12 +97,12 @@ class modCommercial extends DolibarrModules
     {
     	// Permissions
       $this->remove();
-        
+
       $sql = array();
 
       return $this->_init($sql);
     }
-	
+
     /**
      *  \brief      Fonction appelee lors de la desactivation d'un module.
      *              Supprime de la base les constantes, boites et permissions du module.
@@ -126,7 +110,7 @@ class modCommercial extends DolibarrModules
     function remove()
     {
     	$sql = array();
-        
+
       return $this->_remove($sql);
     }
 }
diff --git a/htdocs/includes/modules/modComptabiliteExpert.class.php b/htdocs/includes/modules/modComptabiliteExpert.class.php
index 8490934e155..d55e4b1f05e 100644
--- a/htdocs/includes/modules/modComptabiliteExpert.class.php
+++ b/htdocs/includes/modules/modComptabiliteExpert.class.php
@@ -75,45 +75,11 @@ class modComptabiliteExpert extends DolibarrModules
 
 		// Constantes
 		$this->const = array();
-		
+
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/comptaexpert";
-		$this->dirs[$r][2] = 1;
-		$this->dirs[$r][3] = "";
-		$this->dirs[$r][4] = "comptaexpert";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/comptaexpert/temp";
-		$this->dirs[$r][2] = 1;
-		$this->dirs[$r][3] = "";
-		$this->dirs[$r][4] = "comptaexpert";
-		
-		$r++;
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/comptaexpert/rapport";
-		$this->dirs[$r][2] = 1;
-		$this->dirs[$r][3] = "rapport";
-		$this->dirs[$r][4] = "comptaexpert";
-		
-		$r++;
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/comptaexpert/export";
-		$this->dirs[$r][2] = 1;
-		$this->dirs[$r][3] = "export";
-		$this->dirs[$r][4] = "comptaexpert";
-
-		// Repertoires
-		//$this->dirs = array();
-		//$this->dirs[0] = $conf->comptaexpert->dir_output;
-		//$this->dirs[1] = $conf->comptaexpert->dir_output."/rapport";
-		//$this->dirs[2] = $conf->comptaexpert->dir_output."/export";
-
-		// Boites
+		$this->dirs = array("/comptabiliteexpert/temp");
+
+		// Boxes
 		$this->boxes = array();
 
 		// Permissions
diff --git a/htdocs/includes/modules/modContrat.class.php b/htdocs/includes/modules/modContrat.class.php
index 38e9fe7460f..2baf57f5995 100644
--- a/htdocs/includes/modules/modContrat.class.php
+++ b/htdocs/includes/modules/modContrat.class.php
@@ -18,131 +18,123 @@
  */
 
 /**
-        \defgroup   contrat     Module contrat
-        \brief      Module pour gerer la tenue de contrat de services
-		\version	$Id$
-*/
+ \defgroup   contrat     Module contrat
+ \brief      Module pour gerer la tenue de contrat de services
+ \version	$Id$
+ */
 
 /**
-        \file       htdocs/includes/modules/modContrat.class.php
-        \ingroup    contrat
-        \brief      Fichier de description et activation du module Contrat
-*/
+ \file       htdocs/includes/modules/modContrat.class.php
+ \ingroup    contrat
+ \brief      Fichier de description et activation du module Contrat
+ */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 
 
 /**
-        \class      modContrat
-        \brief      Classe de description et activation du module Contrat
-*/
+ \class      modContrat
+ \brief      Classe de description et activation du module Contrat
+ */
 
 class modContrat extends DolibarrModules
 {
 
-    /**
-     *   \brief      Constructeur. Definit les noms, constantes et boites
-     *   \param      DB      handler d'acces base
-     */
-    function modContrat($DB)
-    {
-        $this->db = $DB ;
-        $this->numero = 54 ;
+	/**
+	 *   \brief      Constructeur. Definit les noms, constantes et boites
+	 *   \param      DB      handler d'acces base
+	 */
+	function modContrat($DB)
+	{
+		$this->db = $DB ;
+		$this->numero = 54 ;
 
-        $this->family = "crm";
+		$this->family = "crm";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = eregi_replace('^mod','',get_class($this));
-        $this->description = "Gestion des contrats de services";
+		$this->description = "Gestion des contrats de services";
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
-        
-        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
-        $this->special = 0;
-        $this->picto='contract';
-
-        // Data directories to create when module is enabled
-		    $this->dirs = array();
-		    $r=0;
-		
-		    $this->dirs[$r][0] = "output";
-		    $this->dirs[$r][1] = "/contracts";
-		
-		    $r++;
-		    $this->dirs[$r][0] = "temp";
-		    $this->dirs[$r][1] = "/contracts/temp";
-
-        // Dependances
-        $this->depends = array("modService");
-        $this->requiredby = array();
-
-        // Constantes
-        $this->const = array();
-
-        // Boites
-        $this->boxes = array();
-
-        // Permissions
-        $this->rights = array();
-        $this->rights_class = 'contrat';
-
-        $this->rights[1][0] = 161;
-        $this->rights[1][1] = 'Lire les contrats';
-        $this->rights[1][2] = 'r';
-        $this->rights[1][3] = 1;
-        $this->rights[1][4] = 'lire';
-
-        $this->rights[2][0] = 162;
-        $this->rights[2][1] = 'Creer / modifier les contrats';
-        $this->rights[2][2] = 'w';
-        $this->rights[2][3] = 0;
-        $this->rights[2][4] = 'creer';
-
-        $this->rights[3][0] = 163;
-        $this->rights[3][1] = 'Activer un service d\'un contrat';
-        $this->rights[3][2] = 'w';
-        $this->rights[3][3] = 0;
-        $this->rights[3][4] = 'activer';
-
-        $this->rights[4][0] = 164;
-        $this->rights[4][1] = 'Desactiver un service d\'un contrat';
-        $this->rights[4][2] = 'w';
-        $this->rights[4][3] = 0;
-        $this->rights[4][4] = 'desactiver';
-
-        $this->rights[5][0] = 165;
-        $this->rights[5][1] = 'Supprimer un contrat';
-        $this->rights[5][2] = 'd';
-        $this->rights[5][3] = 0;
-        $this->rights[5][4] = 'supprimer';
-
-    }
-
-
-    /**
-     *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
-     *               Definit egalement les repertoires de donnees a creer pour ce module.
-     */
-    function init()
-    {
-        global $conf;
-        
-        // Nettoyage avant activation
-        $this->remove();
-
-        return $this->_init($sql);
-    }
-
-    /**
-     *    \brief      Fonction appelee lors de la desactivation d'un module.
-     *                Supprime de la base les constantes, boites et permissions du module.
-     */
-    function remove()
-    {
-        $sql = array();
-
-        return $this->_remove($sql);
-
-    }
+
+		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
+		$this->special = 0;
+		$this->picto='contract';
+
+		// Data directories to create when module is enabled
+		$this->dirs = array("/contracts/temp");
+
+		// Dependances
+		$this->depends = array("modService");
+		$this->requiredby = array();
+
+		// Constantes
+		$this->const = array();
+
+		// Boites
+		$this->boxes = array();
+
+		// Permissions
+		$this->rights = array();
+		$this->rights_class = 'contrat';
+
+		$this->rights[1][0] = 161;
+		$this->rights[1][1] = 'Lire les contrats';
+		$this->rights[1][2] = 'r';
+		$this->rights[1][3] = 1;
+		$this->rights[1][4] = 'lire';
+
+		$this->rights[2][0] = 162;
+		$this->rights[2][1] = 'Creer / modifier les contrats';
+		$this->rights[2][2] = 'w';
+		$this->rights[2][3] = 0;
+		$this->rights[2][4] = 'creer';
+
+		$this->rights[3][0] = 163;
+		$this->rights[3][1] = 'Activer un service d\'un contrat';
+		$this->rights[3][2] = 'w';
+		$this->rights[3][3] = 0;
+		$this->rights[3][4] = 'activer';
+
+		$this->rights[4][0] = 164;
+		$this->rights[4][1] = 'Desactiver un service d\'un contrat';
+		$this->rights[4][2] = 'w';
+		$this->rights[4][3] = 0;
+		$this->rights[4][4] = 'desactiver';
+
+		$this->rights[5][0] = 165;
+		$this->rights[5][1] = 'Supprimer un contrat';
+		$this->rights[5][2] = 'd';
+		$this->rights[5][3] = 0;
+		$this->rights[5][4] = 'supprimer';
+
+	}
+
+
+	/**
+	 *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
+	 *               Definit egalement les repertoires de donnees a creer pour ce module.
+	 */
+	function init()
+	{
+		global $conf;
+
+		// Nettoyage avant activation
+		$this->remove();
+
+		return $this->_init($sql);
+	}
+
+	/**
+	 *    \brief      Fonction appelee lors de la desactivation d'un module.
+	 *                Supprime de la base les constantes, boites et permissions du module.
+	 */
+	function remove()
+	{
+		$sql = array();
+
+		return $this->_remove($sql);
+
+	}
 }
 ?>
diff --git a/htdocs/includes/modules/modDeplacement.class.php b/htdocs/includes/modules/modDeplacement.class.php
index 74824b3cb04..bac97c47cdf 100644
--- a/htdocs/includes/modules/modDeplacement.class.php
+++ b/htdocs/includes/modules/modDeplacement.class.php
@@ -47,7 +47,7 @@ class modDeplacement extends DolibarrModules
 	function modDeplacement($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 75 ;
 
@@ -58,23 +58,23 @@ class modDeplacement extends DolibarrModules
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
-		
+
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
 		$this->picto = "trip";
 
-		// Dir
+		// Data directories to create when module is enabled
 		$this->dirs = array();
 
 		// Config pages
 		$this->config_page_url = array();
 		$this->langfiles = array("companies","trips");
-		
-		// Dependances
+
+		// Dependancies
 		$this->depends = array();
 		$this->requiredby = array();
 
-		// Constantes
+		// Constants
 		$this->const = array();
 
 		// Boxes
@@ -110,7 +110,7 @@ class modDeplacement extends DolibarrModules
 
 		// Exports
 		$r=0;
-		
+
 		$r++;
 		$this->export_code[$r]='trips_'.$r;
 		$this->export_label[$r]='ListTripsAndExpenses';
@@ -118,12 +118,12 @@ class modDeplacement extends DolibarrModules
 		$this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.type'=>"Type",'d.km'=>"FeesKilometersOrAmout",'d.note'=>'Note','s.nom'=>'ThirdParty');
 		$this->export_entities_array[$r]=array('d.rowid'=>"Trip",'d.type'=>"Trip",'d.km'=>"Trip",'d.note'=>'Trip','s.nom'=>'company');
 		$this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.km'=>"km",'d.note'=>'note','s.nom'=>'name');
-		
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'deplacement as d, '.MAIN_DB_PREFIX.'societe as s';
 		$this->export_sql_end[$r] .=' WHERE d.fk_soc = s.rowid';
 		$this->export_sql_end[$r] .=' AND s.entity = '.$conf->entity;
-		
+
 	}
 
 
diff --git a/htdocs/includes/modules/modDocument.class.php b/htdocs/includes/modules/modDocument.class.php
index f862bdd6654..4b65034550a 100644
--- a/htdocs/includes/modules/modDocument.class.php
+++ b/htdocs/includes/modules/modDocument.class.php
@@ -61,15 +61,7 @@ class modDocument extends DolibarrModules
 		$this->picto='dir';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/ged";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/ged/temp";
+		$this->dirs = array("/ged/temp");
 
 		// Config pages
 		//$this->config_page_url = array("document.php");
diff --git a/htdocs/includes/modules/modDomain.class.php b/htdocs/includes/modules/modDomain.class.php
index dfa0f4b41dd..94fb87e434a 100644
--- a/htdocs/includes/modules/modDomain.class.php
+++ b/htdocs/includes/modules/modDomain.class.php
@@ -14,13 +14,12 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
  */
 
 /**
-        \defgroup   domain     Module domain
-        \brief      Module pour g�rer une base de noms de domaines
+ *      \defgroup   domain     Module domain
+ *      \brief      Module to manage a list of DNS names
+ *		\version	$Id$
 */
 
 /**
@@ -48,7 +47,7 @@ class modDomain extends DolibarrModules
     {
         $this->db = $DB;
         $this->numero = 1300 ;
-    
+
         $this->family = "other";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = eregi_replace('^mod','',get_class($this));
@@ -57,29 +56,29 @@ class modDomain extends DolibarrModules
         $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
         $this->special = 2;
         $this->picto='user';
-    
+
         // Dir
         //----
         $this->dirs = array();
-    
+
         // Config pages
         //-------------
         $this->config_page_url = array();
-    
-        // D�pendances
-        //------------
+
+        // Dependancies
+        //-------------
         $this->depends = array();
         $this->requiredby = array();
         $this->langfiles = array("domains");
-    
+
         // Constantes
         //-----------
         $this->const = array();
-    
+
         // Boites
         //-------
         $this->boxes = array();
-    
+
         // Permissions
         //------------
         $this->rights = array();
@@ -90,23 +89,23 @@ class modDomain extends DolibarrModules
 	    $this->rights[$r][0] = 1301;
 	    $this->rights[$r][1] = 'Read domain names';
 	    $this->rights[$r][2] = 'r';
-	    $this->rights[$r][3] = 1;    
+	    $this->rights[$r][3] = 1;
 	    $this->rights[$r][4] = 'read';
-        
+
 	    $r++;
 	    $this->rights[$r][0] = 1302;
 	    $this->rights[$r][1] = 'Create/modify domain names';
 	    $this->rights[$r][2] = 'w';
-	    $this->rights[$r][3] = 0;    
+	    $this->rights[$r][3] = 0;
 	    $this->rights[$r][4] = 'create';
-        
+
 	    $r++;
 	    $this->rights[$r][0] = 1303;
 	    $this->rights[$r][1] = 'Delete domain names';
 	    $this->rights[$r][2] = 'd';
-	    $this->rights[$r][3] = 0;    
+	    $this->rights[$r][3] = 0;
 	    $this->rights[$r][4] = 'delete';
-        
+
         // Exports
         //--------
         $r=0;
@@ -119,7 +118,7 @@ class modDomain extends DolibarrModules
         // $this->export_sql[$r]           Requete sql qui offre les donnees a l'export
     }
 
-    
+
     /**
      *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
      *               Definit egalement les repertoires de donnees a creer pour ce module.
@@ -127,15 +126,15 @@ class modDomain extends DolibarrModules
     function init()
     {
         global $conf;
-        
+
         // Permissions
         $this->remove();
-        
+
         $sql = array();
-        
+
         return $this->_init($sql);
     }
-    
+
     /**
      *    \brief      Fonction appelee lors de la desactivation d'un module.
      *                Supprime de la base les constantes, boites et permissions du module.
@@ -143,7 +142,7 @@ class modDomain extends DolibarrModules
     function remove()
     {
 		$sql = array();
-    
+
 		return $this->_remove($sql);
     }
 
diff --git a/htdocs/includes/modules/modDon.class.php b/htdocs/includes/modules/modDon.class.php
index 10c9af15399..bdb50a6935c 100644
--- a/htdocs/includes/modules/modDon.class.php
+++ b/htdocs/includes/modules/modDon.class.php
@@ -25,19 +25,18 @@
  */
 
 /**
- \file       htdocs/includes/modules/modDon.class.php
- \ingroup    don
- \brief      Fichier de description et activation du module Don
+ *	\file       htdocs/includes/modules/modDon.class.php
+ *	\ingroup    don
+ *	\brief      Fichier de description et activation du module Don
  */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 
 
 /**
- \class      modDon
- \brief      Classe de description et activation du module Don
+ *	\class      modDon
+ *	\brief      Classe de description et activation du module Don
  */
-
 class modDon  extends DolibarrModules
 {
 
@@ -59,24 +58,16 @@ class modDon  extends DolibarrModules
 		$this->special = 0;
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/dons";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/dons/temp";
-
-		// Dependances
+		$this->dirs = array("/dons/temp");
+
+		// Dependancies
 		$this->depends = array();
 		$this->requiredby = array();
 
 		// Config pages
 		$this->config_page_url = array("dons.php");
 
-		// Constantes
+		// Constants
 		$this->const = array();
 		$this->const[0][0] = "DON_FORM";
 		$this->const[0][1] = "chaine";
diff --git a/htdocs/includes/modules/modDroitPret.class.php b/htdocs/includes/modules/modDroitPret.class.php
index 1f7e3190a48..2f3968a6167 100644
--- a/htdocs/includes/modules/modDroitPret.class.php
+++ b/htdocs/includes/modules/modDroitPret.class.php
@@ -60,10 +60,7 @@ class modDroitPret  extends DolibarrModules
 		// Dir
 		global $dolibarr_smarty_compile;
 		global $dolibarr_smarty_cache;
-		$this->dirs = array();
-		
-	  $this->dirs[0] = $dolibarr_smarty_compile;
-	  $this->dirs[1] = $dolibarr_smarty_cache;
+		$this->dirs = array($dolibarr_smarty_compile,$dolibarr_smarty_cache);
 
 		// Dependances
 		$this->depends = array();
@@ -79,13 +76,13 @@ class modDroitPret  extends DolibarrModules
 		// Constantes
 		$this->const=array();
 		$r=0;
-		
+
 		$this->const[$r][0] = "PRODUCT_CANVAS_ABILITY";
 		$this->const[$r][1] = "chaine";
 		$this->const[$r][2] = 1;
 		$this->const[$r][3] = 'This is a constant';
 		$this->const[$r][4] = 1;
-		
+
 		$r++;
 		$this->const[$r][0] = "MAIN_NEED_SMARTY";
 		$this->const[$r][1] = "chaine";
@@ -106,7 +103,7 @@ class modDroitPret  extends DolibarrModules
 		$this->rights[$r][2] = 'r';
 		$this->rights[$r][3] = 1;
 		$this->rights[$r][4] = 'lire';
-		
+
 		$r++;
 		$this->rights[$r][0] = 2201;
 		$this->rights[$r][1] = 'Creer/modifier les droits de prets';
diff --git a/htdocs/includes/modules/modECM.class.php b/htdocs/includes/modules/modECM.class.php
index f1e26e25925..8fa9cd48826 100644
--- a/htdocs/includes/modules/modECM.class.php
+++ b/htdocs/includes/modules/modECM.class.php
@@ -44,52 +44,44 @@ class modECM extends DolibarrModules
 	function modECM($DB)
 	{
 		$this->db = $DB;
-		
+
 		// Id for module (must be unique).
 		// Use here a free id.
 		$this->numero = 2500;
-		
+
 		// Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
-		// It is used to sort modules in module setup page 
-		$this->family = "ecm";		
+		// It is used to sort modules in module setup page
+		$this->family = "ecm";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = eregi_replace('^mod','',get_class($this));
 		// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
 		$this->description = "Electronic Content Management";
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
-		$this->version = 'dolibarr';    
+		$this->version = 'dolibarr';
 		// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		// Where to store the module in setup page (0=common,1=interface,2=other)
 		$this->special = 0;
 		// Name of png file (without png) used for this module
 		$this->picto='dir';
-		
+
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/ecm";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/ecm/temp";
-		
+		$this->dirs = array("/ecm/temp");
+
 		// Config pages. Put here list of php page names stored in admmin directory used to setup module
 		$this->config_page_url = array();
-		
+
 		// Dependencies
 		$this->depends = array();		// List of modules id that must be enabled if this module is enabled
 		$this->requiredby = array();	// List of modules id to disable if this one is disabled
-		
+
 		// Constants
 		$this->const = array();			// List of parameters
-		
+
 		// Boxes
-		$this->boxes = array();			// List of boxes 
+		$this->boxes = array();			// List of boxes
 		$r=0;
-		
+
 		// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
 		// Example:
         //$this->boxes[$r][1] = "myboxa.php";
@@ -122,12 +114,12 @@ class modECM extends DolibarrModules
 		$this->rights[$r][3] = 1;
 		$this->rights[$r][4] = 'setup';
 
-		
+
         // Menus
 		//------
 		$this->menus = array();			// List of menus to add
 		$r=0;
-		
+
 		// Top menu
 		$this->menu[$r]=array('fk_menu'=>0,
 							  'type'=>'top',
@@ -156,7 +148,7 @@ class modECM extends DolibarrModules
 							  'target'=>'',
 							  'user'=>0);
 		$r++;
-		
+
 		$this->menu[$r]=array('fk_menu'=>'r=1',
 							  'type'=>'left',
 							  'titre'=>'ECMNewSection',
@@ -169,7 +161,7 @@ class modECM extends DolibarrModules
 							  'target'=>'',
 							  'user'=>0);
 		$r++;
-		
+
 		$this->menu[$r]=array('fk_menu'=>'r=1',
 							  'type'=>'left',
 							  'titre'=>'ECMFileManager',
@@ -182,7 +174,7 @@ class modECM extends DolibarrModules
 							  'target'=>'',
 							  'user'=>0);
 		$r++;
-		
+
 		$this->menu[$r]=array('fk_menu'=>'r=1',
 							  'type'=>'left',
 							  'titre'=>'Search',
@@ -206,7 +198,7 @@ class modECM extends DolibarrModules
 	function init()
   	{
     	$sql = array();
-    
+
     	return $this->_init($sql);
   	}
 
diff --git a/htdocs/includes/modules/modEditeur.class.php b/htdocs/includes/modules/modEditeur.class.php
index 26b9a131e1e..e6c2ca52cf3 100644
--- a/htdocs/includes/modules/modEditeur.class.php
+++ b/htdocs/includes/modules/modEditeur.class.php
@@ -59,13 +59,10 @@ class modEditeur extends DolibarrModules
 		$this->special = 3;
 		$this->picto='book';
 
-		// Dir
+		// Data directories to create when module is enabled
 		global $dolibarr_smarty_compile;
 		global $dolibarr_smarty_cache;
-		$this->dirs = array();
-		
-	  $this->dirs[0] = $dolibarr_smarty_compile;
-	  $this->dirs[1] = $dolibarr_smarty_cache;
+		$this->dirs = array($dolibarr_smarty_compile,$dolibarr_smarty_cache);
 
 		// Config pages
 		$this->config_page_url = array("editeur.php");
diff --git a/htdocs/includes/modules/modEnergie.class.php b/htdocs/includes/modules/modEnergie.class.php
index 6e0eb20a5a3..77e06e8d499 100644
--- a/htdocs/includes/modules/modEnergie.class.php
+++ b/htdocs/includes/modules/modEnergie.class.php
@@ -15,13 +15,12 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
  */
 
 /**
- \defgroup   energie     Module energie
- \brief      Module pour le suivi de la consommation d'energie
+ 	\defgroup   energie     Module energie
+ 	\brief      Module pour le suivi de la consommation d'energie
+	\version	$Id$
  */
 
 /**
@@ -63,19 +62,7 @@ class modEnergie extends DolibarrModules
 		$this->picto='energie';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/energie";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/energie/temp";
-		
-		$r++;
-		$this->dirs[$r][0] = "graph";
-		$this->dirs[$r][1] = "/energie/graph";
+		$this->dirs = array("/energie/temp","/energie/graph");
 
 		// Dependances
 		$this->depends = array();
diff --git a/htdocs/includes/modules/modExpedition.class.php b/htdocs/includes/modules/modExpedition.class.php
index 8ab685ea0f6..e783c7e35f8 100644
--- a/htdocs/includes/modules/modExpedition.class.php
+++ b/htdocs/includes/modules/modExpedition.class.php
@@ -51,7 +51,7 @@ class modExpedition extends DolibarrModules
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = eregi_replace('^mod','',get_class($this));
 		$this->description = "Gestion des expeditions";
-		
+
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
 
@@ -60,9 +60,10 @@ class modExpedition extends DolibarrModules
 		$this->picto = "sending";
 
 		// Data directories to create when module is enabled
+		// TODO Replace with simple directories
 		$this->dirs = array();
 		$r=0;
-		
+
 		$this->dirs[$r][0] = "output";
 		$this->dirs[$r][1] = "/expedition";
 		$r++;
diff --git a/htdocs/includes/modules/modExport.class.php b/htdocs/includes/modules/modExport.class.php
index 4255b6af067..ae25b8fb98d 100644
--- a/htdocs/includes/modules/modExport.class.php
+++ b/htdocs/includes/modules/modExport.class.php
@@ -23,9 +23,9 @@
  */
 
 /**
- \file       htdocs/includes/modules/modExport.class.php
- \ingroup    export
- \brief      Fichier de description et activation du module export
+ *	\file       htdocs/includes/modules/modExport.class.php
+ *	\ingroup    export
+ *	\brief      Fichier de description et activation du module export
  */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@@ -57,15 +57,7 @@ class modExport extends DolibarrModules
 		$this->picto='';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/export";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/export/temp";
+		$this->dirs = array("/export/temp");
 
 		// Config pages
 		$this->config_page_url = array();
diff --git a/htdocs/includes/modules/modExternalRss.class.php b/htdocs/includes/modules/modExternalRss.class.php
index fa668050700..6c817b2254f 100644
--- a/htdocs/includes/modules/modExternalRss.class.php
+++ b/htdocs/includes/modules/modExternalRss.class.php
@@ -60,15 +60,7 @@ class modExternalRss extends DolibarrModules
 		$this->picto='rss';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/rss";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/rss/temp";
+		$this->dirs = array("/rss/temp");
 
 		// Config pages
 		$this->config_page_url = array("external_rss.php");
@@ -98,7 +90,7 @@ class modExternalRss extends DolibarrModules
 	function init()
 	{
 		global $conf;
-		
+
 		$sql = array();
 
 		// Recherche configuration de boites
diff --git a/htdocs/includes/modules/modFacture.class.php b/htdocs/includes/modules/modFacture.class.php
index 99a63616d31..64388b5a006 100644
--- a/htdocs/includes/modules/modFacture.class.php
+++ b/htdocs/includes/modules/modFacture.class.php
@@ -41,202 +41,194 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 class modFacture extends DolibarrModules
 {
 
-   /**
-    *   \brief      Constructeur. Definit les noms, constantes et boites
-    *   \param      DB      Database handler
-    */
-    function modFacture($DB)
-    {
-    	global $conf;
-    	
-    	$this->db = $DB;
-      $this->numero = 30;
-
-      $this->family = "financial";
-      // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
-      $this->name = eregi_replace('^mod','',get_class($this));
-      $this->description = "Gestion des factures";
-      
-      // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
-      $this->version = 'dolibarr';
-
-      $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
-      $this->special = 0;
-      $this->picto='bill';
-
-      // Data directories to create when module is enabled
-		  $this->dirs = array();
-		  $r=0;
-		
-		  $this->dirs[$r][0] = "output";
-		  $this->dirs[$r][1] = "/facture";
-		
-		  $r++;
-		  $this->dirs[$r][0] = "temp";
-		  $this->dirs[$r][1] = "/facture/temp";
-
-      // Dependencies
-      $this->depends = array("modSociete");
-      $this->requiredby = array("modComptabilite","modComptabiliteExpert");
-      $this->conflictwith = array();
-      $this->langfiles = array("bills","companies","compta","products");
-
-      // Config pages
-      $this->config_page_url = array("facture.php");
-
-      // Constantes
-      $this->const = array();
-    	$r=0;
-
-      $this->const[$r][0] = "FACTURE_ADDON_PDF";
-      $this->const[$r][1] = "chaine";
-      $this->const[$r][2] = "crabe";
-    	$r++;
-
-      $this->const[$r][0] = "FACTURE_ADDON";
-      $this->const[$r][1] = "chaine";
-      $this->const[$r][2] = "terre";
-    	$r++;
-
-      $this->const[$r][0] = "FAC_FORCE_DATE_VALIDATION";
-      $this->const[$r][1] = "yesno";
-      $this->const[$r][2] = "0";
-    	$r++;
-
-      // Boites
-      $this->boxes = array();
-      $r=0;
-      $this->boxes[$r][1] = "box_factures_imp.php";
-    	$r++;
-      $this->boxes[$r][1] = "box_factures.php";
-    	$r++;
-
-      // Permissions
-      $this->rights = array();
-      $this->rights_class = 'facture';
-      $r=0;
-
-      $r++;
-      $this->rights[$r][0] = 11;
-      $this->rights[$r][1] = 'Lire les factures';
-      $this->rights[$r][2] = 'a';
-      $this->rights[$r][3] = 1;
-      $this->rights[$r][4] = 'lire';
-
-      $r++;
-      $this->rights[$r][0] = 12;
-      $this->rights[$r][1] = 'Creer les factures';
-      $this->rights[$r][2] = 'a';
-      $this->rights[$r][3] = 0;
-      $this->rights[$r][4] = 'creer';
-
-      $r++;
-      $this->rights[$r][0] = 13;
-      $this->rights[$r][1] = 'Modifier les factures';
-      $this->rights[$r][2] = 'a';
-      $this->rights[$r][3] = 0;
-      $this->rights[$r][4] = 'modifier';
-
-      $r++;
-      $this->rights[$r][0] = 14;
-      $this->rights[$r][1] = 'Valider les factures';
-      $this->rights[$r][2] = 'a';
-      $this->rights[$r][3] = 0;
-      $this->rights[$r][4] = 'valider';
-
-      $r++;
-      $this->rights[$r][0] = 15;
-      $this->rights[$r][1] = 'Envoyer les factures par mail';
-      $this->rights[$r][2] = 'a';
-      $this->rights[$r][3] = 0;
-      $this->rights[$r][4] = 'envoyer';
-
-      $r++;
-      $this->rights[$r][0] = 16;
-      $this->rights[$r][1] = 'Emettre des paiements sur les factures';
-      $this->rights[$r][2] = 'a';
-      $this->rights[$r][3] = 0;
-      $this->rights[$r][4] = 'paiement';
-
-      $r++;
-      $this->rights[$r][0] = 19;
-      $this->rights[$r][1] = 'Supprimer les factures';
-      $this->rights[$r][2] = 'a';
-      $this->rights[$r][3] = 0;
-      $this->rights[$r][4] = 'supprimer';
-
-      $r++;
-      $this->rights[$r][0] = 1321;
-      $this->rights[$r][1] = 'Exporter les factures clients, attributs et reglements';
-      $this->rights[$r][2] = 'r';
-      $this->rights[$r][3] = 0;
-      $this->rights[$r][4] = 'facture';
-      $this->rights[$r][5] = 'export';
-      
-      
-      // Exports
-      //--------
-      $r=1;
-
-      $this->export_code[$r]=$this->rights_class.'_'.$r;
-      $this->export_label[$r]='CustomersInvoicesAndInvoiceLines';	// Translation key (used only if key ExportDataset_xxx_z not found)
-      $this->export_permission[$r]=array(array("facture","facture","export"));
-      $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
-      $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
-      $this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','s.tva_intra'=>'vat','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.price'=>"lineprice",'fd.total_ht'=>"linetotalht",'fd.total_tva'=>"linetotaltva",'fd.total_ttc'=>"linetotalttc",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend",'fd.product_type'=>'producttype','fd.fk_product'=>'productid','p.ref'=>'productref','p.label'=>'productlabel');
-      
-      $this->export_sql_start[$r]='SELECT DISTINCT ';
-      $this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)';
-      $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
-      $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
-      $this->export_sql_end[$r] .=' AND s.entity = '.$conf->entity;
-      $r++;
-
-      $this->export_code[$r]=$this->rights_class.'_'.$r;
-      $this->export_label[$r]='CustomersInvoicesAndPayments';	// Translation key (used only if key ExportDataset_xxx_z not found)
-      $this->export_permission[$r]=array(array("facture","facture","export"));
-      $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
-      $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
-      $this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','s.tva_intra'=>'vat','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'p.rowid'=>'paymentid','pf.amount'=>'amount_payment','p.datep'=>'date_payment','p.num_paiement'=>'num_payment');
-      
-      $this->export_sql_start[$r]='SELECT DISTINCT ';
-      $this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'societe as s)';
-      $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
-      $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
-      $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
-      $this->export_sql_end[$r] .=' AND s.entity = '.$conf->entity;
-      $r++;
-    }
-
-
-   /**
-    *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
-    *               Definit egalement les repertoires de donnees a creer pour ce module.
-    */
-    function init()
-    {
-    	global $conf;
-
-      // Permissions
-      $this->remove();
-
-	    $sql = array(
+	/**
+	 *   \brief      Constructeur. Definit les noms, constantes et boites
+	 *   \param      DB      Database handler
+	 */
+	function modFacture($DB)
+	{
+		global $conf;
+
+		$this->db = $DB;
+		$this->numero = 30;
+
+		$this->family = "financial";
+		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
+		$this->name = eregi_replace('^mod','',get_class($this));
+		$this->description = "Gestion des factures";
+
+		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
+		$this->version = 'dolibarr';
+
+		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
+		$this->special = 0;
+		$this->picto='bill';
+
+		// Data directories to create when module is enabled
+		$this->dirs = array("/facture/temp");
+
+		// Dependencies
+		$this->depends = array("modSociete");
+		$this->requiredby = array("modComptabilite","modComptabiliteExpert");
+		$this->conflictwith = array();
+		$this->langfiles = array("bills","companies","compta","products");
+
+		// Config pages
+		$this->config_page_url = array("facture.php");
+
+		// Constantes
+		$this->const = array();
+		$r=0;
+
+		$this->const[$r][0] = "FACTURE_ADDON_PDF";
+		$this->const[$r][1] = "chaine";
+		$this->const[$r][2] = "crabe";
+		$r++;
+
+		$this->const[$r][0] = "FACTURE_ADDON";
+		$this->const[$r][1] = "chaine";
+		$this->const[$r][2] = "terre";
+		$r++;
+
+		$this->const[$r][0] = "FAC_FORCE_DATE_VALIDATION";
+		$this->const[$r][1] = "yesno";
+		$this->const[$r][2] = "0";
+		$r++;
+
+		// Boites
+		$this->boxes = array();
+		$r=0;
+		$this->boxes[$r][1] = "box_factures_imp.php";
+		$r++;
+		$this->boxes[$r][1] = "box_factures.php";
+		$r++;
+
+		// Permissions
+		$this->rights = array();
+		$this->rights_class = 'facture';
+		$r=0;
+
+		$r++;
+		$this->rights[$r][0] = 11;
+		$this->rights[$r][1] = 'Lire les factures';
+		$this->rights[$r][2] = 'a';
+		$this->rights[$r][3] = 1;
+		$this->rights[$r][4] = 'lire';
+
+		$r++;
+		$this->rights[$r][0] = 12;
+		$this->rights[$r][1] = 'Creer les factures';
+		$this->rights[$r][2] = 'a';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'creer';
+
+		$r++;
+		$this->rights[$r][0] = 13;
+		$this->rights[$r][1] = 'Modifier les factures';
+		$this->rights[$r][2] = 'a';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'modifier';
+
+		$r++;
+		$this->rights[$r][0] = 14;
+		$this->rights[$r][1] = 'Valider les factures';
+		$this->rights[$r][2] = 'a';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'valider';
+
+		$r++;
+		$this->rights[$r][0] = 15;
+		$this->rights[$r][1] = 'Envoyer les factures par mail';
+		$this->rights[$r][2] = 'a';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'envoyer';
+
+		$r++;
+		$this->rights[$r][0] = 16;
+		$this->rights[$r][1] = 'Emettre des paiements sur les factures';
+		$this->rights[$r][2] = 'a';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'paiement';
+
+		$r++;
+		$this->rights[$r][0] = 19;
+		$this->rights[$r][1] = 'Supprimer les factures';
+		$this->rights[$r][2] = 'a';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'supprimer';
+
+		$r++;
+		$this->rights[$r][0] = 1321;
+		$this->rights[$r][1] = 'Exporter les factures clients, attributs et reglements';
+		$this->rights[$r][2] = 'r';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'facture';
+		$this->rights[$r][5] = 'export';
+
+
+		// Exports
+		//--------
+		$r=1;
+
+		$this->export_code[$r]=$this->rights_class.'_'.$r;
+		$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';	// Translation key (used only if key ExportDataset_xxx_z not found)
+		$this->export_permission[$r]=array(array("facture","facture","export"));
+		$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
+		$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
+		$this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','s.tva_intra'=>'vat','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.price'=>"lineprice",'fd.total_ht'=>"linetotalht",'fd.total_tva'=>"linetotaltva",'fd.total_ttc'=>"linetotalttc",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend",'fd.product_type'=>'producttype','fd.fk_product'=>'productid','p.ref'=>'productref','p.label'=>'productlabel');
+
+		$this->export_sql_start[$r]='SELECT DISTINCT ';
+		$this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)';
+		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
+		$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
+		$this->export_sql_end[$r] .=' AND s.entity = '.$conf->entity;
+		$r++;
+
+		$this->export_code[$r]=$this->rights_class.'_'.$r;
+		$this->export_label[$r]='CustomersInvoicesAndPayments';	// Translation key (used only if key ExportDataset_xxx_z not found)
+		$this->export_permission[$r]=array(array("facture","facture","export"));
+		$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
+		$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
+		$this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','s.tva_intra'=>'vat','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'p.rowid'=>'paymentid','pf.amount'=>'amount_payment','p.datep'=>'date_payment','p.num_paiement'=>'num_payment');
+
+		$this->export_sql_start[$r]='SELECT DISTINCT ';
+		$this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'societe as s)';
+		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
+		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
+		$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
+		$this->export_sql_end[$r] .=' AND s.entity = '.$conf->entity;
+		$r++;
+	}
+
+
+	/**
+	 *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
+	 *               Definit egalement les repertoires de donnees a creer pour ce module.
+	 */
+	function init()
+	{
+		global $conf;
+
+		// Permissions
+		$this->remove();
+
+		$sql = array(
 			 "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
 			 "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")",
-			 );
+		);
 
-      return $this->_init($sql);
-    }
+		return $this->_init($sql);
+	}
 
-    /**
-     *    \brief      Fonction appelee lors de la desactivation d'un module.
-     *                Supprime de la base les constantes, boites et permissions du module.
-     */
-    function remove()
-    {
-        $sql = array();
+	/**
+	 *    \brief      Fonction appelee lors de la desactivation d'un module.
+	 *                Supprime de la base les constantes, boites et permissions du module.
+	 */
+	function remove()
+	{
+		$sql = array();
 
-        return $this->_remove($sql);
-    }
+		return $this->_remove($sql);
+	}
 }
 ?>
diff --git a/htdocs/includes/modules/modFckeditor.class.php b/htdocs/includes/modules/modFckeditor.class.php
index 3f12d77aacd..74c8486942f 100644
--- a/htdocs/includes/modules/modFckeditor.class.php
+++ b/htdocs/includes/modules/modFckeditor.class.php
@@ -57,19 +57,7 @@ class modFckeditor extends DolibarrModules
 		$this->special = 2;
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/fckeditor";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/fckeditor/temp";
-		
-		$r++;
-		$this->dirs[$r][0] = "images";
-		$this->dirs[$r][1] = "/fckeditor/images";
+		$this->dirs = array("/fckeditor/temp","/fckeditor/images");
 
 		// Config pages
 		$this->config_page_url = array("fckeditor.php");
diff --git a/htdocs/includes/modules/modFicheinter.class.php b/htdocs/includes/modules/modFicheinter.class.php
index e48e03e88dc..94d80f20644 100644
--- a/htdocs/includes/modules/modFicheinter.class.php
+++ b/htdocs/includes/modules/modFicheinter.class.php
@@ -49,7 +49,7 @@ class modFicheinter  extends DolibarrModules
 	function modFicheinter($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 70 ;
 
@@ -66,15 +66,7 @@ class modFicheinter  extends DolibarrModules
 		$this->picto = "intervention";
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/ficheinter";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/ficheinter/temp";
+		$this->dirs = array("/ficheinter/temp");
 
         // Dependencies
 		$this->depends = array("modSociete","modCommercial");
@@ -145,7 +137,7 @@ class modFicheinter  extends DolibarrModules
     $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote",'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc");
 		$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention",'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line');
     $this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','f.rowid'=>"interid",'f.ref'=>"ref",'f.datec'=>"datecreation",'f.duree'=>"duration",'f.fk_statut'=>'status','f.description'=>"note",'fd.rowid'=>'lineid','fd.date'=>"linedate",'fd.duree'=>'lineduration','fd.description'=>"linedescription");
-    
+
     $this->export_sql_start[$r]='SELECT DISTINCT ';
     $this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'fichinter as f, '.MAIN_DB_PREFIX.'fichinterdet as fd, '.MAIN_DB_PREFIX.'societe as s)';
 		$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_fichinter';
diff --git a/htdocs/includes/modules/modFournisseur.class.php b/htdocs/includes/modules/modFournisseur.class.php
index 1d68c0993f9..b4ad72d6b2d 100644
--- a/htdocs/includes/modules/modFournisseur.class.php
+++ b/htdocs/includes/modules/modFournisseur.class.php
@@ -44,7 +44,7 @@ class modFournisseur extends DolibarrModules
 	function modFournisseur($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 40 ;
 
@@ -61,34 +61,35 @@ class modFournisseur extends DolibarrModules
 		$this->picto='company';
 
 		// Data directories to create when module is enabled
+		// TODO Replace with simple directories
 		$this->dirs = array();
 		$r=0;
-		
+
 		$this->dirs[$r][0] = "output";
 		$this->dirs[$r][1] = "/fournisseur";
-		
+
 		$r++;
 		$this->dirs[$r][0] = "temp";
 		$this->dirs[$r][1] = "/fournisseur/temp";
-		
+
 		$r++;
 		$this->dirs[$r][0] = "output";
 		$this->dirs[$r][1] = "/fournisseur/commande";
 		$this->dirs[$r][2] = 1;
 		$this->dirs[$r][3] = "commande";
-		
+
 		$r++;
 		$this->dirs[$r][0] = "temp";
 		$this->dirs[$r][1] = "/fournisseur/commande/temp";
 		$this->dirs[$r][2] = 1;
 		$this->dirs[$r][3] = "commande";
-		
+
 		$r++;
 		$this->dirs[$r][0] = "output";
 		$this->dirs[$r][1] = "/fournisseur/facture";
 		$this->dirs[$r][2] = 1;
 		$this->dirs[$r][3] = "facture";
-		
+
 		$r++;
 		$this->dirs[$r][0] = "temp";
 		$this->dirs[$r][1] = "/fournisseur/facture/temp";
@@ -257,7 +258,7 @@ class modFournisseur extends DolibarrModules
 		$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
 		$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
 		$this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.tva_intra'=>'vat','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total_ht'=>"totalht",'f.total_ttc'=>"totalttc",'f.total_tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.total_ht'=>"total_ht",'fd.total_ttc'=>"total_ttc",'fd.tva'=>"tva",'fd.product_type'=>'producttype','fd.fk_product'=>'productid','p.ref'=>'productref','p.label'=>'productlabel');
-		
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'facture_fourn as f, '.MAIN_DB_PREFIX.'facture_fourn_det as fd, '.MAIN_DB_PREFIX.'societe as s)';
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
@@ -272,7 +273,7 @@ class modFournisseur extends DolibarrModules
 		$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
 		$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
 		$this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.tva_intra'=>'vat','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total_ht'=>"totalht",'f.total_ttc'=>"totalttc",'f.total_tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'p.rowid'=>'paymentid','pf.amount'=>'amount_payment','p.datep'=>'date_payment','p.num_paiement'=>'num_payment');
-		
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM ('.MAIN_DB_PREFIX.'facture_fourn as f, '.MAIN_DB_PREFIX.'societe as s)';
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
diff --git a/htdocs/includes/modules/modImport.class.php b/htdocs/includes/modules/modImport.class.php
index 37ae31d66eb..95b5ca67ed5 100644
--- a/htdocs/includes/modules/modImport.class.php
+++ b/htdocs/includes/modules/modImport.class.php
@@ -57,15 +57,7 @@ class modImport extends DolibarrModules
 		$this->picto='';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/import";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/import/temp";
+		$this->dirs = array("/import/temp");
 
 		// Config pages
 		$this->config_page_url = array();
diff --git a/htdocs/includes/modules/modLabel.class.php b/htdocs/includes/modules/modLabel.class.php
index b51e2902036..0d942895e15 100644
--- a/htdocs/includes/modules/modLabel.class.php
+++ b/htdocs/includes/modules/modLabel.class.php
@@ -59,15 +59,7 @@ class modLabel extends DolibarrModules
 		$this->picto='label';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/label";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/label/temp";
+		$this->dirs = array("/label/temp");
 
 		// Dependancies
 		$this->depends = array();
diff --git a/htdocs/includes/modules/modLdap.class.php b/htdocs/includes/modules/modLdap.class.php
index 40a8081dc00..711d1ca803a 100644
--- a/htdocs/includes/modules/modLdap.class.php
+++ b/htdocs/includes/modules/modLdap.class.php
@@ -16,18 +16,17 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
  */
 
 /**     \defgroup   ldap     Module ldap
- \brief      Module pour interfacer les contacts avec un annuaire Ldap
+ 		\brief      Module pour interfacer les contacts avec un annuaire Ldap
  */
 
 /**
- \file       htdocs/includes/modules/modLdap.class.php
- \ingroup    ldap
- \brief      Fichier de description et activation du module Ldap
+ 	\file       htdocs/includes/modules/modLdap.class.php
+ 	\ingroup    ldap
+ 	\brief      Fichier de description et activation du module Ldap
+	\version	$Id$
  */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@@ -57,24 +56,16 @@ class modLdap extends DolibarrModules
 		$this->special = 1;
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/ldap";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/ldap/temp";
+		$this->dirs = array("/ldap/temp");
 
 		// Config pages
 		$this->config_page_url = array("ldap.php");
 
-		// D�pendances
+		// Dependancies
 		$this->depends = array();
 		$this->requiredby = array();
 
-		// Constantes
+		// Constants
 		$this->const = array();
 		$r=0;
 
@@ -132,7 +123,7 @@ class modLdap extends DolibarrModules
 		$this->const[$r][1] = "chaine";
 		$this->const[$r][2] = "mobile";
 		$r++;
-			
+
 		// Boites
 		$this->boxes = array();
 
diff --git a/htdocs/includes/modules/modMailing.class.php b/htdocs/includes/modules/modMailing.class.php
index cf58630e09c..3934c322d22 100644
--- a/htdocs/includes/modules/modMailing.class.php
+++ b/htdocs/includes/modules/modMailing.class.php
@@ -59,15 +59,7 @@ class modMailing extends DolibarrModules
 		$this->picto='email';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/mailings";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/mailings/temp";
+		$this->dirs = array("/mailing/temp");
 
 		// Dependances
 		$this->depends = array();
diff --git a/htdocs/includes/modules/modMantis.class.php b/htdocs/includes/modules/modMantis.class.php
index f101a20d07b..ff8337af113 100644
--- a/htdocs/includes/modules/modMantis.class.php
+++ b/htdocs/includes/modules/modMantis.class.php
@@ -15,8 +15,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
  */
 
 /**     \defgroup   mantis     Module Mantis
@@ -27,6 +25,7 @@
         \file       htdocs/includes/modules/modMantis.class.php
         \ingroup    mantis
         \brief      Description and activation file for module Mantis
+		\version	$Id$
 */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@@ -46,43 +45,43 @@ class modMantis extends DolibarrModules
 	function modMantis($DB)
 	{
 		$this->db = $DB;
-		
+
 		// Id for module (must be unique).
 		// Use here a free id.
 		$this->numero = 1200;
-		
+
 		// Family can be 'crm','financial','hr','projects','product','technic','other'
-		// It is used to sort modules in module setup page 
-		$this->family = "projects";		
+		// It is used to sort modules in module setup page
+		$this->family = "projects";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = eregi_replace('^mod','',get_class($this));
 		// Module description used translation string 'ModuleXXXDesc' not found (XXX is id value)
 		$this->description = "Interfacage avec le bug tracking Mantis";
 		// Possible values for version are: 'experimental' or 'dolibarr' or version
-		$this->version = 'dolibarr';    
-		// Id used in llx_const table to manage module status (enabled/disabled)	
+		$this->version = 'dolibarr';
+		// Id used in llx_const table to manage module status (enabled/disabled)
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		// Where to store the module in setup page (0=common,1=interface,2=other)
 		$this->special = 1;
 		// Name of png file (without png) used for this module
 		$this->picto='calendar';
-		
+
 		// Data directories to create when module is enabled
 		$this->dirs = array();
-		
+
 		// Config pages
 		$this->config_page_url = array("mantis.php");
-		
+
 		// Dependencies
 		$this->depends = array();		// List of modules id that must be enabled
 		$this->requiredby = array();	// List of modules id to disable if this one is disabled
-		
+
 		// Constants
 		$this->const = array();			// List of parameters
-		
+
 		// Boxes
-		$this->boxes = array();			// List of boxes 
-		
+		$this->boxes = array();			// List of boxes
+
 		// Permissions
 		$this->rights_class = 'mantis';	// Permission key
 		$this->rights = array();		// Permission array used by this module
@@ -90,10 +89,10 @@ class modMantis extends DolibarrModules
         // Menus
 		//------
 		$r=0;
-		
+
 		$this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'BugTracker','mainmenu'=>'mantis','leftmenu'=>'1','url'=>'/mantis/mantis.php','langs'=>'other','position'=>100,'perms'=>'','target'=>'','user'=>0);
 		$r++;
-		
+
 	}
 
 	/**
@@ -104,7 +103,7 @@ class modMantis extends DolibarrModules
 	function init()
   	{
     	$sql = array();
-    
+
     	return $this->_init($sql);
   	}
 
diff --git a/htdocs/includes/modules/modMultiCompany.class.php b/htdocs/includes/modules/modMultiCompany.class.php
index 611ca548010..7aef2682ff6 100644
--- a/htdocs/includes/modules/modMultiCompany.class.php
+++ b/htdocs/includes/modules/modMultiCompany.class.php
@@ -72,8 +72,6 @@ class modMultiCompany extends DolibarrModules
 
 		// Data directories to create when module is enabled.
 		$this->dirs = array();
-		//$this->dirs[0] = DOL_DATA_ROOT.'/mymodule;
-        //$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
 
 		// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
 		$this->style_sheet = '';
@@ -207,7 +205,7 @@ class modMultiCompany extends DolibarrModules
   	$sql = array();
 
 		$init = $this->_init($sql);
-		
+
 		$result=$this->load_tables('/multicompany/sql/init/');
 
     return $init;
@@ -222,10 +220,10 @@ class modMultiCompany extends DolibarrModules
 	function remove()
 	{
 		$sql = array();
-		
+
 		$result=$this->load_tables('/multicompany/sql/remove/');
 		$result = $this->destroy_cookie();
-		
+
 		return $this->_remove($sql);
 	}
 
@@ -241,7 +239,7 @@ class modMultiCompany extends DolibarrModules
 	{
 		return $this->_load_tables($path);
 	}
-	
+
 	/**
 	*   \brief   Destroy a cookie
 	*/
diff --git a/htdocs/includes/modules/modNotification.class.php b/htdocs/includes/modules/modNotification.class.php
index fdbe405ca81..1d080770a72 100644
--- a/htdocs/includes/modules/modNotification.class.php
+++ b/htdocs/includes/modules/modNotification.class.php
@@ -58,7 +58,7 @@ class modNotification extends DolibarrModules
 		$this->special = 1;
 		$this->picto='email';
 
-		// Dir
+		// Data directories to create when module is enabled.
 		$this->dirs = array();
 
 		// Dependances
@@ -89,7 +89,7 @@ class modNotification extends DolibarrModules
 	{
 		// Permissions
 		$this->remove();
-		 
+
 		return $this->_init($sql);
 	}
 
diff --git a/htdocs/includes/modules/modOSCommerceWS.class.php b/htdocs/includes/modules/modOSCommerceWS.class.php
index caaaf34372b..84ad2050614 100644
--- a/htdocs/includes/modules/modOSCommerceWS.class.php
+++ b/htdocs/includes/modules/modOSCommerceWS.class.php
@@ -59,7 +59,7 @@ class modOSCommerceWS extends DolibarrModules
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 1;
 
-		// Dir
+		// Data directories to create when module is enabled.
 		$this->dirs = array();
 
 		// Config pages
diff --git a/htdocs/includes/modules/modPaybox.class.php b/htdocs/includes/modules/modPaybox.class.php
index d6ad0272f9b..17793788e95 100644
--- a/htdocs/includes/modules/modPaybox.class.php
+++ b/htdocs/includes/modules/modPaybox.class.php
@@ -69,9 +69,7 @@ class modPayBox extends DolibarrModules
 		$this->picto=DOL_URL_ROOT.'/paybox/images/paybox.png';
 
 		// Data directories to create when module is enabled.
-		$this->dirs = array();
-		//$this->dirs[0] = DOL_DATA_ROOT.'/mymodule;
-        //$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
+		$this->dirs = array('/paybox/temp');
 
 		// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
 		$this->style_sheet = '';
diff --git a/htdocs/includes/modules/modPostnuke.class.php b/htdocs/includes/modules/modPostnuke.class.php
index 001863e439f..1222fc4a3ed 100644
--- a/htdocs/includes/modules/modPostnuke.class.php
+++ b/htdocs/includes/modules/modPostnuke.class.php
@@ -15,8 +15,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
  */
 
 /**     \defgroup   postnuke     Module postnuke
@@ -27,6 +25,7 @@
  \file       htdocs/includes/modules/modPostnuke.class.php
  \ingroup    postnuke
  \brief      Fichier de description et activation du module Postnuke
+ \version	$Id$
  */
 
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@@ -57,7 +56,7 @@ class modPostnuke extends DolibarrModules
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 1;
 
-		// Dir
+		// Data directories to create when module is enabled
 		$this->dirs = array();
 
 		// D�pendances
diff --git a/htdocs/includes/modules/modPrelevement.class.php b/htdocs/includes/modules/modPrelevement.class.php
index 03d2f24693a..a400a88cd51 100644
--- a/htdocs/includes/modules/modPrelevement.class.php
+++ b/htdocs/includes/modules/modPrelevement.class.php
@@ -62,23 +62,9 @@ class modPrelevement extends DolibarrModules
 		$this->special = 0;
 		// Name of png file (without png) used for this module
 		$this->picto='payment';
-		
+
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/prelevement";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/prelevement/temp";
-		
-		$r++;
-		$this->dirs[$r][0] = "bon";
-		$this->dirs[$r][1] = "/prelevement/bon";
-		
-		$this->dirs[0] = $conf->prelevement->dir_output . "/bon";
+		$this->dirs = array("/prelevement/temp","/prelevement/receipts");
 
 		// Dependancies
 		$this->depends = array("modFacture");
diff --git a/htdocs/includes/modules/modProduit.class.php b/htdocs/includes/modules/modProduit.class.php
index 85dafeab3d5..934374f656f 100644
--- a/htdocs/includes/modules/modProduit.class.php
+++ b/htdocs/includes/modules/modProduit.class.php
@@ -66,15 +66,7 @@ class modProduit extends DolibarrModules
 		$this->picto='product';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/produit";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/produit/temp";
+		$this->dirs = array("/produit/temp");
 
 		// Dependencies
 		$this->depends = array();
@@ -149,12 +141,12 @@ class modProduit extends DolibarrModules
 		$this->export_label[$r]="ProductsOrServices";	// Translation key (used only if key ExportDataset_xxx_z not found)
 		$this->export_permission[$r]=array(array("produit","export"));
 		$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"Price",'p.tva_tx'=>'VAT','p.envente'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
-		if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge ($this->export_fields_array[$r],array('p.stock'=>'Stock'));	
+		if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge ($this->export_fields_array[$r],array('p.stock'=>'Stock'));
 		$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.tva_tx'=>'product','p.envente'=>"product",'p.duration'=>"product",'p.datec'=>'product','p.tms'=>'product');
-		if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge ($this->export_entities_array[$r],array('p.stock'=>'product'));	
+		if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge ($this->export_entities_array[$r],array('p.stock'=>'product'));
 		$this->export_alias_array[$r]=array('p.rowid'=>"id",'p.ref'=>"ref",'p.fk_product_type'=>"type",'p.label'=>"label",'p.description'=>"description",'p.note'=>"note",'p.price'=>"price",'p.tva_tx'=>'vat','p.envente'=>"onsell",'p.duration'=>"duration",'p.datec'=>'datecreation','p.tms'=>'datemodification');
-		if (! empty($conf->stock->enabled)) $this->export_alias_array[$r]=array_merge ($this->export_alias_array[$r],array('p.stock'=>'stock'));	
-		
+		if (! empty($conf->stock->enabled)) $this->export_alias_array[$r]=array_merge ($this->export_alias_array[$r],array('p.stock'=>'stock'));
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'product as p';
 		$this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity;
diff --git a/htdocs/includes/modules/modProjet.class.php b/htdocs/includes/modules/modProjet.class.php
index 1fa70aebadc..a487ac80afc 100644
--- a/htdocs/includes/modules/modProjet.class.php
+++ b/htdocs/includes/modules/modProjet.class.php
@@ -60,6 +60,9 @@ class modProjet extends DolibarrModules
 		$this->special = 0;
 		$this->picto='project';
 
+		// Data directories to create when module is enabled
+		$this->dirs = array();
+
 		// Dependancies
 		$this->depends = array();
 		$this->requiredby = array();
diff --git a/htdocs/includes/modules/modPropale.class.php b/htdocs/includes/modules/modPropale.class.php
index 4b0ffe9ca5d..f545ef8345d 100644
--- a/htdocs/includes/modules/modPropale.class.php
+++ b/htdocs/includes/modules/modPropale.class.php
@@ -47,7 +47,7 @@ class modPropale extends DolibarrModules
 	function modPropale($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 20 ;
 
@@ -58,27 +58,19 @@ class modPropale extends DolibarrModules
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
-		
+
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
 		$this->picto='propal';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/propale";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/propale/temp";
-
-		// Dependances
+		$this->dirs = array("/propale/temp");
+
+		// Dependancies
 		$this->depends = array("modSociete","modCommercial");
 		$this->config_page_url = array("propale.php");
 
-		// Constantes
+		// Constants
 		$this->const = array();
 
 		$this->const[0][0] = "PROPALE_ADDON_PDF";
diff --git a/htdocs/includes/modules/modService.class.php b/htdocs/includes/modules/modService.class.php
index 57e88775c23..240aae9ccbc 100644
--- a/htdocs/includes/modules/modService.class.php
+++ b/htdocs/includes/modules/modService.class.php
@@ -59,30 +59,22 @@ class modService extends DolibarrModules
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
-		
+
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
 		$this->picto='service';
-		
+
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/produit";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/produit/temp";
-
-		// Dependances
+		$this->dirs = array("/produit/temp");
+
+		// Dependancies
 		$this->depends = array("modProduit");
 		$this->requiredby = array("modContrat");
 
-		// Constantes
+		// Constants
 		$this->const = array();
 
-		// Boites
+		// Boxes
 		$this->boxes = array();
 		$this->boxes[0][1] = "box_services_vendus.php";
 
diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php
index a46bbf95ebd..cc2c9a328de 100644
--- a/htdocs/includes/modules/modSociete.class.php
+++ b/htdocs/includes/modules/modSociete.class.php
@@ -49,7 +49,7 @@ class modSociete extends DolibarrModules
 	function modSociete($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 1 ;
 
@@ -67,16 +67,17 @@ class modSociete extends DolibarrModules
 		$this->picto='company';
 
 		// Data directories to create when module is enabled
+		// TODO Replace with simple directories
 		$this->dirs = array();
 		$r=0;
-		
+
 		$this->dirs[$r][0] = "output";
 		$this->dirs[$r][1] = "/societe";
-		
+
 		$r++;
 		$this->dirs[$r][0] = "temp";
 		$this->dirs[$r][1] = "/societe/temp";
-		
+
 		$r++;
 		$this->dirs[$r][0] = "logos";
 		$this->dirs[$r][1] = "/societe/logos";
@@ -207,7 +208,7 @@ class modSociete extends DolibarrModules
 		$this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Effectif","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','fk_stcomm'=>'ProspectStatus');
 		$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.prefix_comm'=>"company",'s.client'=>"company",'s.fournisseur'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company",'t.libelle'=>"company",'ce.code'=>"company","cfj.libelle"=>"company",'s.fk_prospectlevel'=>'company','fk_stcomm'=>'company');
 		$this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>"name",'s.prefix_comm'=>"prefix",'s.client'=>"iscustomer",'s.fournisseur'=>"issupplier",'s.datec'=>"datecreation",'s.tms'=>"datelastmodification",'s.code_client'=>"customercode",'s.code_fournisseur'=>"suppliercode",'s.address'=>"address",'s.cp'=>"zip",'s.ville'=>"town",'p.libelle'=>"country",'p.code'=>"countrycode",'s.tel'=>"phone",'s.fax'=>"fax",'s.url'=>"url",'s.email'=>"email",'s.siret'=>"idprof1",'s.siren'=>"idprof2",'s.ape'=>"idprof3",'s.idprof4'=>"idprof4",'s.tva_intra'=>"vatintra",'s.capital'=>"capital",'s.note'=>"note",'t.libelle'=>"thirdpartytype",'ce.code'=>"effectif","cfj.libelle"=>"juridicalstatus",'s.fk_prospectlevel'=>'prospectlevel','fk_stcomm'=>'prospectstatus');
-		
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'societe as s';
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id';
@@ -225,7 +226,7 @@ class modSociete extends DolibarrModules
 		$this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civilite'=>"CivilityCode",'c.name'=>'Lastname','c.firstname'=>'Firstname','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.cp'=>"Zip",'c.ville'=>"Town",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.email'=>"EMail",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode");
 		$this->export_entities_array[$r]=array('c.rowid'=>"contact",'c.civilite'=>"contact",'c.name'=>'contact','c.firstname'=>'contact','c.datec'=>"contact",'c.tms'=>"contact",'c.priv'=>"contact",'c.address'=>"contact",'c.cp'=>"contact",'c.ville'=>"contact",'c.phone'=>"contact",'c.fax'=>"contact",'c.email'=>"contact",'p.libelle'=>"contact",'p.code'=>"contact",'s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company");
 		$this->export_alias_array[$r]=array('c.rowid'=>"contactid",'c.civilite'=>"civilitycode",'c.name'=>'lastname','c.firstname'=>'firstname','c.datec'=>"datecreation",'c.tms'=>"datelastmodification",'c.priv'=>"private",'c.address'=>"address",'c.cp'=>"zip",'c.ville'=>"town",'c.phone'=>"phone",'c.fax'=>"fax",'c.email'=>"email",'p.libelle'=>"country",'p.code'=>"countrycode",'s.rowid'=>"socid",'s.nom'=>"companyname",'s.code_client'=>"customercode",'s.code_fournisseur'=>"suppliercode");
-		
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'c_pays as p, '.MAIN_DB_PREFIX.'socpeople as c';
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON c.fk_soc = s.rowid';
diff --git a/htdocs/includes/modules/modStock.class.php b/htdocs/includes/modules/modStock.class.php
index 1ecdccfd692..828012e418d 100644
--- a/htdocs/includes/modules/modStock.class.php
+++ b/htdocs/includes/modules/modStock.class.php
@@ -47,7 +47,7 @@ class modStock extends DolibarrModules
 	function modStock($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 52 ;
 
@@ -58,12 +58,12 @@ class modStock extends DolibarrModules
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';
-		
+
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
 		$this->picto='stock';
 
-		// Dir
+		// Data directories to create when module is enabled
 		$this->dirs = array();
 
 		$this->config_page_url = array("stock.php");
@@ -73,7 +73,7 @@ class modStock extends DolibarrModules
 		$this->requiredby = array();
 		$this->langfiles = array("stocks");
 
-		// Constantes
+		// Constants
 		$this->const = array();
 
 		// Boxes
@@ -129,7 +129,7 @@ class modStock extends DolibarrModules
 		$this->export_fields_array[$r]=array('e.rowid'=>'IdWarehouse','e.label'=>'LabelWareHouse','e.label'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.cp'=>'Zip','e.ville'=>'Town','p.rowid'=>"ProductId",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"Price",'p.tva_tx'=>'VAT','p.envente'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification','ps.reel'=>'Stock');
 		$this->export_entities_array[$r]=array('e.rowid'=>'warehouse','e.label'=>'warehouse','e.label'=>'warehouse','e.lieu'=>'warehouse','e.address'=>'warehouse','e.cp'=>'warehouse','e.ville'=>'warehouse','p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.tva_tx'=>'product','p.envente'=>"product",'p.duration'=>"product",'p.datec'=>'product','p.tms'=>'product','ps.reel'=>'stock');
 		$this->export_alias_array[$r]=array('e.rowid'=>'idwarehouse','e.label'=>'labelwarehouse','e.label'=>'descwarehouse','e.lieu'=>'lieuwarehouse','e.address'=>'addresswarehouse','e.cp'=>'zipwarehouse','e.ville'=>'townwarehouse','p.rowid'=>"id",'p.ref'=>"ref",'p.fk_product_type'=>"type",'p.label'=>"label",'p.description'=>"description",'p.note'=>"note",'p.price'=>"price",'p.tva_tx'=>'vat','p.envente'=>"onsell",'p.duration'=>"duration",'p.datec'=>'datecreation','p.tms'=>'datemodification','ps.reel'=>'quantity');
-		
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e';
 		$this->export_sql_end[$r] .=' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid';
diff --git a/htdocs/includes/modules/modSyslog.class.php b/htdocs/includes/modules/modSyslog.class.php
index e82539c7110..062cc3ed05b 100644
--- a/htdocs/includes/modules/modSyslog.class.php
+++ b/htdocs/includes/modules/modSyslog.class.php
@@ -58,11 +58,6 @@ class modSyslog extends DolibarrModules
 
 		// Data directories to create when module is enabled
 		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/logs";
-		$this->dirs[$r][2] = 1;
 
 		// Config pages
 		$this->config_page_url = array("syslog.php");
diff --git a/htdocs/includes/modules/modTax.class.php b/htdocs/includes/modules/modTax.class.php
index 93ec37966a1..c19258d6431 100644
--- a/htdocs/includes/modules/modTax.class.php
+++ b/htdocs/includes/modules/modTax.class.php
@@ -21,8 +21,8 @@
  */
 
 /**     \defgroup   tax		Module taxes
-        \brief      Module pour inclure des fonctions de saisies des taxes (tva) et charges sociales
-*/
+ \brief      Module pour inclure des fonctions de saisies des taxes (tva) et charges sociales
+ */
 
 /**
  *      \file       htdocs/includes/modules/modTax.class.php
@@ -35,16 +35,16 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 
 
 /**
-		\class 		modTax
-        \brief      Classe de description et activation du module Tax
-*/
+ \class 		modTax
+ \brief      Classe de description et activation du module Tax
+ */
 class modTax extends DolibarrModules
 {
 
-   /**
-    *   \brief      Constructeur. Definit les noms, constantes et boites
-    *   \param      DB      handler d'acces base
-    */
+	/**
+	 *   \brief      Constructeur. Definit les noms, constantes et boites
+	 *   \param      DB      handler d'acces base
+	 */
 	function modTax($DB)
 	{
 		global $conf;
@@ -63,18 +63,10 @@ class modTax extends DolibarrModules
 
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
-    $this->picto='bill';
-    
-    // Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/taxes";
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/taxes/temp";
+		$this->picto='bill';
+
+		// Data directories to create when module is enabled
+		$this->dirs = array("/taxes/temp");
 
 		// Config pages
 		$this->config_page_url = array("taxes.php");
@@ -129,30 +121,30 @@ class modTax extends DolibarrModules
 		$this->rights[$r][5] = 'export';
 
 
-	    // Exports
-      //--------
-      $r=0;
-
-      $r++;
-      $this->export_code[$r]=$this->rights_class.'_'.$r;
-      $this->export_label[$r]='Taxes et charges sociales, et leurs reglements';
-      $this->export_permission[$r]=array(array("tax","charges","export"));
-      $this->export_fields_array[$r]=array('cc.libelle'=>"Type",'c.rowid'=>"IdSocialContribution",'c.libelle'=>"Label",'c.date_ech'=>'DateDue','c.periode'=>'Period','c.amount'=>"AmountExpected","c.paye"=>"Status",'p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero');
-      $this->export_entities_array[$r]=array('cc.libelle'=>"tax_type",'c.rowid'=>"tax",'c.libelle'=>'tax','c.date_ech'=>'tax','c.periode'=>'tax','c.amount'=>"tax","c.paye"=>"tax",'p.rowid'=>'payment','p.datep'=>'payment','p.amount'=>'payment','p.num_paiement'=>'payment');
-      $this->export_alias_array[$r]=array('cc.libelle'=>"type",'c.rowid'=>"idsocialcontrib",'c.libelle'=>'label','c.date_ech'=>'datedue','c.periode'=>'period','c.amount'=>"amount_clamed","c.paye"=>"status",'p.rowid'=>'paymentid','p.datep'=>'date_payment','p.amount'=>'amount_payment','p.num_paiement'=>'num_payment');
-        
-      $this->export_sql_start[$r]='SELECT DISTINCT ';
-      $this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'c_chargesociales as cc, '.MAIN_DB_PREFIX.'chargesociales as c';
-      $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementcharge as p ON p.fk_charge = c.rowid';
-      $this->export_sql_end[$r] .=' WHERE c.fk_type = cc.id';
-      $this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity;
+		// Exports
+		//--------
+		$r=0;
+
+		$r++;
+		$this->export_code[$r]=$this->rights_class.'_'.$r;
+		$this->export_label[$r]='Taxes et charges sociales, et leurs reglements';
+		$this->export_permission[$r]=array(array("tax","charges","export"));
+		$this->export_fields_array[$r]=array('cc.libelle'=>"Type",'c.rowid'=>"IdSocialContribution",'c.libelle'=>"Label",'c.date_ech'=>'DateDue','c.periode'=>'Period','c.amount'=>"AmountExpected","c.paye"=>"Status",'p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero');
+		$this->export_entities_array[$r]=array('cc.libelle'=>"tax_type",'c.rowid'=>"tax",'c.libelle'=>'tax','c.date_ech'=>'tax','c.periode'=>'tax','c.amount'=>"tax","c.paye"=>"tax",'p.rowid'=>'payment','p.datep'=>'payment','p.amount'=>'payment','p.num_paiement'=>'payment');
+		$this->export_alias_array[$r]=array('cc.libelle'=>"type",'c.rowid'=>"idsocialcontrib",'c.libelle'=>'label','c.date_ech'=>'datedue','c.periode'=>'period','c.amount'=>"amount_clamed","c.paye"=>"status",'p.rowid'=>'paymentid','p.datep'=>'date_payment','p.amount'=>'amount_payment','p.num_paiement'=>'num_payment');
+
+		$this->export_sql_start[$r]='SELECT DISTINCT ';
+		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'c_chargesociales as cc, '.MAIN_DB_PREFIX.'chargesociales as c';
+		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementcharge as p ON p.fk_charge = c.rowid';
+		$this->export_sql_end[$r] .=' WHERE c.fk_type = cc.id';
+		$this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity;
 	}
 
 
-   /**
-    *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
-    *               Definit egalement les repertoires de donnees a creer pour ce module.
-    */
+	/**
+	 *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
+	 *               Definit egalement les repertoires de donnees a creer pour ce module.
+	 */
 	function init()
 	{
 		global $conf;
@@ -163,10 +155,10 @@ class modTax extends DolibarrModules
 		return $this->_init($sql);
 	}
 
-  /**
-   *    \brief      Fonction appelee lors de la desactivation d'un module.
-   *                Supprime de la base les constantes, boites et permissions du module.
-   */
+	/**
+	 *    \brief      Fonction appelee lors de la desactivation d'un module.
+	 *                Supprime de la base les constantes, boites et permissions du module.
+	 */
 	function remove()
 	{
 		$sql = array();
diff --git a/htdocs/includes/modules/modTelephonie.class.php b/htdocs/includes/modules/modTelephonie.class.php
index 56ca3b17554..4bff8b90f0a 100644
--- a/htdocs/includes/modules/modTelephonie.class.php
+++ b/htdocs/includes/modules/modTelephonie.class.php
@@ -15,8 +15,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
  */
 
 /**
@@ -28,6 +26,7 @@
  \file       htdocs/includes/modules/modTelephonie.class.php
  \ingroup    telephonie
  \brief      Fichier de description et activation du module de Telephonie
+	\version	$Id$
  */
 
 include_once(DOL_DOCUMENT_ROOT."/includes/modules/DolibarrModules.class.php");
@@ -64,57 +63,23 @@ class modTelephonie extends DolibarrModules
 		$this->picto='phoning';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/telephonie";
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/telephonie/temp";
-		$r++;
-		$this->dirs[$r][0] = "graph";
-		$this->dirs[$r][1] = "/telephonie/graph";
-		$r++;
-		$this->dirs[$r][0] = "logs";
-		$this->dirs[$r][1] = "/telephonie/logs";
-		$r++;
-		$this->dirs[$r][0] = "client";
-		$this->dirs[$r][1] = "/telephonie/client";
-		$r++;
-		$this->dirs[$r][0] = "rapports";
-		$this->dirs[$r][1] = "/telephonie/rapports";
-		$r++;
-		$this->dirs[$r][0] = "ligne";
-		$this->dirs[$r][1] = "/telephonie/ligne";
-		$r++;
-		$this->dirs[$r][0] = "ligne_commande";
-		$this->dirs[$r][1] = "/telephonie/ligne/commande";
-		$r++;
-		$this->dirs[$r][0] = "ligne_commande_retour";
-		$this->dirs[$r][1] = "/telephonie/ligne/commande/retour";
-		$r++;
-		$this->dirs[$r][0] = "ligne_commande_retour_traite";
-		$this->dirs[$r][1] = "/telephonie/ligne/commande/retour/traite";
-		$r++;
-		$this->dirs[$r][0] = "cdr";
-		$this->dirs[$r][1] = "/telephonie/cdr";
-		$r++;
-		$this->dirs[$r][0] = "cdr_archive";
-		$this->dirs[$r][1] = "/telephonie/cdr_archive";
-		$r++;
-		$this->dirs[$r][0] = "cdr_atraiter";
-		$this->dirs[$r][1] = "/telephonie/cdr/atraiter";
-		
-
-		// Dependances
+		$this->dirs = array("/telephonie/temp",
+							"/telephonie/graph",
+							"/telephonie/logs",
+							"/telephonie/client",
+							"/telephonie/rapports",
+							"/telephonie/ligne/commande/retour/traite",
+							"/telephonie/cdr/archives",
+							"/telephonie/cdr/atraiter");
+
+		// Dependancies
 		$this->depends = array();
 		$this->requiredby = array();
 
-		// Constantes
+		// Constants
 		$this->const = array();
 
-		// Boites
+		// Boxes
 		$this->boxes = array();
 
 		// Permissions
diff --git a/htdocs/includes/modules/modUser.class.php b/htdocs/includes/modules/modUser.class.php
index c24f5205a51..e56e7f0751d 100644
--- a/htdocs/includes/modules/modUser.class.php
+++ b/htdocs/includes/modules/modUser.class.php
@@ -45,7 +45,7 @@ class modUser extends DolibarrModules
 	function modUser($DB)
 	{
 		global $conf;
-		
+
 		$this->db = $DB ;
 		$this->numero = 0;
 
@@ -63,30 +63,20 @@ class modUser extends DolibarrModules
 		$this->picto='group';
 
 		// Data directories to create when module is enabled
-		$this->dirs = array();
-		$r=0;
-		
-		$this->dirs[$r][0] = "output";
-		$this->dirs[$r][1] = "/users";
-		$this->dirs[$r][2] = 1;
-		
-		$r++;
-		$this->dirs[$r][0] = "temp";
-		$this->dirs[$r][1] = "/users/temp";
-		$this->dirs[$r][2] = 1;
+		$this->dirs = array("/users/temp");
 
 		// Config pages
 		// $this->config_page_url = array("/user/admin/index.php");
 
-		// Dependances
+		// Dependancies
 		$this->depends = array();
 		$this->requiredby = array();
 		$this->langfiles = array("main","users","companies");
 
-		// Constantes
+		// Constants
 		$this->const = array();
 
-		// Boites
+		// Boxes
 		$this->boxes = array();
 
 		// Permissions
@@ -162,7 +152,7 @@ class modUser extends DolibarrModules
 		$this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.name'=>"Lastname",'u.firstname'=>"Firstname",'u.office_phone'=>'Tel','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Admin",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_societe'=>"IdCompany",'u.fk_member'=>"MemberId");
 		$this->export_entities_array[$r]=array('u.rowid'=>"user",'u.login'=>"user",'u.name'=>"user",'u.firstname'=>"user",'u.office_phone'=>'user','u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_societe'=>"company",'u.fk_member'=>"member");
 		$this->export_alias_array[$r]=array('u.rowid'=>"rowid",'u.login'=>"login",'u.name'=>"name",'u.firstname'=>"firstname",'u.office_phone'=>'tel','u.office_fax'=>'fax','u.email'=>'email','u.datec'=>"datecreation",'u.tms'=>"datelastmodification",'u.admin'=>"admin",'u.statut'=>'status','u.note'=>"note",'u.datelastlogin'=>'datelastlogin','u.datepreviouslogin'=>'datepreviouslogin','u.fk_socpeople'=>"idcontact",'u.fk_societe'=>"idcompany",'u.fk_member'=>"idmember");
-		
+
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'user as u';
 		$this->export_sql_end[$r] .=' WHERE u.entity IN (0,'.$conf->entity.')';
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index 71072e12dec..7f47f9b5f75 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -225,7 +225,7 @@ if ($modulepart)
         $user->getrights('prelevement');
         if ($user->rights->prelevement->bons->lire) $accessallowed=1;
 
-        $original_file=$conf->prelevement->dir_bon.'/'.$original_file;
+        $original_file=$conf->prelevement->dir_output.'/receipts/'.$original_file;
     }
 
     // Wrapping pour les graph telephonie
@@ -236,14 +236,14 @@ if ($modulepart)
         {
             $accessallowed=1;
         }
-        $original_file=$conf->telephonie->dir_graph.'/'.$original_file;
+        $original_file=$conf->telephonie->dir_temp.'/'.$original_file;
     }
 
     // Wrapping pour les graph energie
     elseif ($modulepart == 'energie')
     {
       $accessallowed=1;
-      $original_file=$conf->energie->dir_graph.'/'.$original_file;
+      $original_file=$conf->energie->dir_temp.'/'.$original_file;
     }
 
     // Wrapping pour les graph bank
-- 
GitLab