diff --git a/htdocs/includes/modules/modAdherent.class.php b/htdocs/includes/modules/modAdherent.class.php
index dd859d9a2ace1fdf98d3e5c03f6e3efaabc5a37a..c207f4c125e7b3bfe10b41d54a5f17076c7a8fdf 100644
--- a/htdocs/includes/modules/modAdherent.class.php
+++ b/htdocs/includes/modules/modAdherent.class.php
@@ -136,21 +136,25 @@ class modAdherent extends DolibarrModules
     $this->rights[1][1] = 'Lire les fiche adherents'; // libelle de la permission
     $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 72; // id de la permission
     $this->rights[2][1] = 'Cr�er modifier des adherents'; // libelle de la permission
     $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 73; // id de la permission
     $this->rights[3][1] = 'Modifier les adherents'; // libelle de la permission
     $this->rights[3][2] = 'm'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'modifier';
 
     $this->rights[4][0] = 74; // id de la permission
     $this->rights[4][1] = 'Supprimer les adherents'; // libelle de la permission
     $this->rights[4][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[4][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[4][4] = 'supprimer';
 
     // Dir
     $this->dirs[0] = $conf->adherent->dir_output;
diff --git a/htdocs/includes/modules/modBanque.class.php b/htdocs/includes/modules/modBanque.class.php
index d9300e2a0fb6cebe650e1f5ff0452b6fbb767f25..b1196f052942db0811fb1b1f38399de1d405f33f 100644
--- a/htdocs/includes/modules/modBanque.class.php
+++ b/htdocs/includes/modules/modBanque.class.php
@@ -93,16 +93,19 @@ class modBanque extends DolibarrModules
     $this->rights[1][1] = 'Lire les comptes bancaires'; // libelle de la permission
     $this->rights[1][2] = 'a'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[1][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 112; // id de la permission
     $this->rights[2][1] = 'Cr�er modifier rapprocher transactions'; // libelle de la permission
     $this->rights[2][2] = 'a'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'modifier';
 
     $this->rights[3][0] = 113; // id de la permission
     $this->rights[3][1] = 'Configurer les comptes bancaires (cr�er, g�rer cat�gories)'; // libelle de la permission
     $this->rights[3][2] = 'a'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'configurer';
 
     $sql = array();
     
diff --git a/htdocs/includes/modules/modCommande.class.php b/htdocs/includes/modules/modCommande.class.php
index dd60ef8e8a695ebd41e8020804feb6cb52cf8735..cae7f0b9ca4b70aa1c00bedeabf66d7c7eba2dbd 100644
--- a/htdocs/includes/modules/modCommande.class.php
+++ b/htdocs/includes/modules/modCommande.class.php
@@ -103,21 +103,25 @@ class modCommande extends DolibarrModules
     $this->rights[1][1] = 'Lire les commandes';
     $this->rights[1][2] = 'r';
     $this->rights[1][3] = 1;
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 82;
     $this->rights[2][1] = 'Cr�er modifier les commandes';
     $this->rights[2][2] = 'w';
     $this->rights[2][3] = 0;
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 84;
     $this->rights[3][1] = 'Valider les commandes';
     $this->rights[3][2] = 'd';
     $this->rights[3][3] = 0;    
+    $this->rights[3][4] = 'valider';
 
     $this->rights[4][0] = 89;
     $this->rights[4][1] = 'Supprimer les commandes';
     $this->rights[4][2] = 'd';
     $this->rights[4][3] = 0;
+    $this->rights[4][4] = 'supprimer';
 
     // Dir
     $this->dirs[0] = $conf->commande->dir_output;
diff --git a/htdocs/includes/modules/modComptabilite.class.php b/htdocs/includes/modules/modComptabilite.class.php
index ba90ced60437f94aa86fcd5f1ce6be0b665328e7..5c1d7314811518c4e7175f54455756610892d1e6 100644
--- a/htdocs/includes/modules/modComptabilite.class.php
+++ b/htdocs/includes/modules/modComptabilite.class.php
@@ -98,31 +98,43 @@ class modComptabilite extends DolibarrModules
     $this->rights[1][1] = 'Lire les charges';
     $this->rights[1][2] = 'r';
     $this->rights[1][3] = 1;
+    $this->rights[1][4] = 'charges';
+    $this->rights[1][5] = 'lire';
 
     $this->rights[2][0] = 92;
     $this->rights[2][1] = 'Cr�er modifier les charges';
     $this->rights[2][2] = 'w';
     $this->rights[2][3] = 0;
+    $this->rights[2][4] = 'charges';
+    $this->rights[2][5] = 'creer';
 
     $this->rights[3][0] = 93;
     $this->rights[3][1] = 'Supprimer les charges';
     $this->rights[3][2] = 'd';
     $this->rights[3][3] = 0;
+    $this->rights[3][4] = 'charges';
+    $this->rights[3][5] = 'supprimer';
 
     $this->rights[4][0] = 95;
     $this->rights[4][1] = 'Lire CA, bilans, r�sultats';
     $this->rights[4][2] = 'r';
     $this->rights[4][3] = 1;
+    $this->rights[4][4] = 'resultat';
+    $this->rights[4][5] = 'lire';
 
     $this->rights[5][0] = 96;
     $this->rights[5][1] = 'Param�trer la ventilation';
     $this->rights[5][2] = 'r';
     $this->rights[5][3] = 0;
+    $this->rights[5][4] = 'ventilation';
+    $this->rights[5][5] = 'parametrer';
 
     $this->rights[6][0] = 97;
     $this->rights[6][1] = 'Ventiler les lignes de facture';
     $this->rights[6][2] = 'r';
     $this->rights[6][3] = 0;
+    $this->rights[6][4] = 'ventilation';
+    $this->rights[6][5] = 'creer';
 
     // Dir
     $this->dirs[0] = $conf->compta->dir_output;
diff --git a/htdocs/includes/modules/modContrat.class.php b/htdocs/includes/modules/modContrat.class.php
index 52fd5cacf2c5cfb76413c11cb6e67c4a36e3cd1d..08387ff580f06b66597ce44a293097447fd74f13 100644
--- a/htdocs/includes/modules/modContrat.class.php
+++ b/htdocs/includes/modules/modContrat.class.php
@@ -93,21 +93,25 @@ class modContrat extends DolibarrModules
     $this->rights[1][1] = 'Consulter 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] = 'Cr�er / modifier les contrats';
     $this->rights[2][2] = 'r';
     $this->rights[2][3] = 0;
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 163;
-    $this->rights[3][1] = 'Activer les services des contrats';
+    $this->rights[3][1] = 'Activer les contrats de services';
     $this->rights[3][2] = 'r';
     $this->rights[3][3] = 0;    
+    $this->rights[3][4] = 'activer';
 
     $this->rights[4][0] = 164;
-    $this->rights[4][1] = 'D�sactiver les services des contrats';
+    $this->rights[4][1] = 'D�sactiver les contrats de services';
     $this->rights[4][2] = 'r';
     $this->rights[4][3] = 0;
+    $this->rights[4][4] = 'desactiver';
 
     $sql = array();
 
diff --git a/htdocs/includes/modules/modExpedition.class.php b/htdocs/includes/modules/modExpedition.class.php
index 5877f6e7666eb0c026db00b44242a7a400c3e9e1..b538ced8ee1069ae86fed38009144751817dc912 100644
--- a/htdocs/includes/modules/modExpedition.class.php
+++ b/htdocs/includes/modules/modExpedition.class.php
@@ -96,21 +96,25 @@ class modExpedition extends DolibarrModules
     $this->rights[1][1] = 'Lire les expeditions';
     $this->rights[1][2] = 'r';
     $this->rights[1][3] = 1;
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 102;
     $this->rights[2][1] = 'Cr�er modifier les expeditions';
     $this->rights[2][2] = 'w';
     $this->rights[2][3] = 0;
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 104;
     $this->rights[3][1] = 'Valider les expeditions';
     $this->rights[3][2] = 'd';
     $this->rights[3][3] = 0;    
+    $this->rights[3][4] = 'valider';
 
     $this->rights[4][0] = 109;
     $this->rights[4][1] = 'Supprimer les expeditions';
     $this->rights[4][2] = 'd';
     $this->rights[4][3] = 0;
+    $this->rights[4][4] = 'supprimer';
 
     $sql = array();
 
diff --git a/htdocs/includes/modules/modFacture.class.php b/htdocs/includes/modules/modFacture.class.php
index 7e5195edb6aa31ed7517db2db14cc15b08fa6b8d..3af4777b1368a1176607a7b4801ee9e67882d2f5 100644
--- a/htdocs/includes/modules/modFacture.class.php
+++ b/htdocs/includes/modules/modFacture.class.php
@@ -141,31 +141,37 @@ class modFacture extends DolibarrModules
     $this->rights[1][1] = 'Consulter les factures';
     $this->rights[1][2] = 'a';
     $this->rights[1][3] = 0;
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 12;
     $this->rights[2][1] = 'Cr�er/modifier les factures';
     $this->rights[2][2] = 'a';
     $this->rights[2][3] = 0;
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 14;
     $this->rights[3][1] = 'Valider les factures';
     $this->rights[3][2] = 'a';
     $this->rights[3][3] = 0;
+    $this->rights[3][4] = 'valider';
 
     $this->rights[4][0] = 15;
     $this->rights[4][1] = 'Envoyer les factures aux clients';
     $this->rights[4][2] = 'a';
     $this->rights[4][3] = 0;
+    $this->rights[4][4] = 'envoyer';
 
     $this->rights[5][0] = 16;
     $this->rights[5][1] = 'Emettre des paiements sur les factures';
     $this->rights[5][2] = 'a';
     $this->rights[5][3] = 0;
+    $this->rights[5][4] = 'paiement';
 
     $this->rights[6][0] = 19;
     $this->rights[6][1] = 'Supprimer les factures';
     $this->rights[6][2] = 'a';
     $this->rights[6][3] = 0;
+    $this->rights[6][4] = 'supprimer';
 
     // Dir
     $this->dirs[0] = $conf->facture->dir_output;
diff --git a/htdocs/includes/modules/modProduit.class.php b/htdocs/includes/modules/modProduit.class.php
index 2d69b206b5c1ca506c0212a6d0c35ac8f761ff54..f7904624595f42177a1b166549f4920690d1b411 100644
--- a/htdocs/includes/modules/modProduit.class.php
+++ b/htdocs/includes/modules/modProduit.class.php
@@ -99,16 +99,25 @@ class modProduit extends DolibarrModules
     $this->rights[1][1] = 'Lire les produits/services'; // libelle de la permission
     $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 32; // id de la permission
     $this->rights[2][1] = 'Cr�er modifier les produits/services'; // libelle de la permission
     $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'creer';
 
-    $this->rights[3][0] = 34; // id de la permission
-    $this->rights[3][1] = 'Supprimer les produits/services'; // libelle de la permission
-    $this->rights[3][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[3][0] = 33; // id de la permission
+    $this->rights[3][1] = 'Commander les produits/services'; // libelle de la permission
+    $this->rights[3][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'commander';
+
+    $this->rights[4][0] = 34; // id de la permission
+    $this->rights[4][1] = 'Supprimer les produits/services'; // libelle de la permission
+    $this->rights[4][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[4][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[4][4] = 'supprimer';
 
     $sql = array();
 
diff --git a/htdocs/includes/modules/modProjet.class.php b/htdocs/includes/modules/modProjet.class.php
index 974ac615a8387caf6f84ba2486ceb10b6466d1c8..ae50afe946a3209de4bc68763da83bf724551bcd 100644
--- a/htdocs/includes/modules/modProjet.class.php
+++ b/htdocs/includes/modules/modProjet.class.php
@@ -91,16 +91,19 @@ class modProjet extends DolibarrModules
     $this->rights[1][1] = 'Lire les projets'; // libelle de la permission
     $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 42; // id de la permission
     $this->rights[2][1] = 'Cr�er modifier les projets'; // libelle de la permission
     $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 44; // id de la permission
     $this->rights[3][1] = 'Supprimer les projets'; // libelle de la permission
     $this->rights[3][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'supprimer';
     
     return $this->_init($sql);
   }
diff --git a/htdocs/includes/modules/modPropale.class.php b/htdocs/includes/modules/modPropale.class.php
index e663e37ab0e6a29ee4aea4675ac936d8b8dc0562..9f0c820a844f105626b992be98de47b334d80fb8 100644
--- a/htdocs/includes/modules/modPropale.class.php
+++ b/htdocs/includes/modules/modPropale.class.php
@@ -110,32 +110,37 @@ class modPropale extends DolibarrModules
     $this->rights[1][1] = 'Lire les propositions commerciales'; // libelle de la permission
     $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 22; // id de la permission
     $this->rights[2][1] = 'Cr�er modifier les propositions commerciales'; // libelle de la permission
     $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 24; // id de la permission
     $this->rights[3][1] = 'Valider les propositions commerciales'; // libelle de la permission
     $this->rights[3][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'valider';
 
     $this->rights[4][0] = 25; // id de la permission
     $this->rights[4][1] = 'Envoyer les propositions commerciales aux clients'; // libelle de la permission
     $this->rights[4][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[4][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[4][4] = 'envoyer';
 
     $this->rights[5][0] = 26; // id de la permission
     $this->rights[5][1] = 'Cl�turer les propositions commerciales'; // libelle de la permission
     $this->rights[5][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[5][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[5][4] = 'cloturer';
 
     $this->rights[6][0] = 27; // id de la permission
     $this->rights[6][1] = 'Supprimer les propositions commerciales'; // libelle de la permission
     $this->rights[6][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[6][3] = 0; // La permission est-elle une permission par d�faut
-
+    $this->rights[6][4] = 'supprimer';
 
 
     $sql = array(
diff --git a/htdocs/includes/modules/modService.class.php b/htdocs/includes/modules/modService.class.php
index ee170bd8a1904531fb534f4febbf738629325b53..7f88c75d272592ec81e5039b90497c6edaad1dcd 100644
--- a/htdocs/includes/modules/modService.class.php
+++ b/htdocs/includes/modules/modService.class.php
@@ -96,16 +96,25 @@ class modService extends DolibarrModules
     $this->rights[1][1] = 'Lire les produits/services'; // libelle de la permission
     $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 32; // id de la permission
     $this->rights[2][1] = 'Cr�er modifier les produits/services'; // libelle de la permission
     $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'creer';
 
-    $this->rights[3][0] = 34; // id de la permission
-    $this->rights[3][1] = 'Supprimer les produits/services'; // libelle de la permission
-    $this->rights[3][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[3][0] = 33; // id de la permission
+    $this->rights[3][1] = 'Commander les produits/services'; // libelle de la permission
+    $this->rights[3][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'commander';
+
+    $this->rights[4][0] = 34; // id de la permission
+    $this->rights[4][1] = 'Supprimer les produits/services'; // libelle de la permission
+    $this->rights[4][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
+    $this->rights[4][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[4][4] = 'supprimer';
 
     $sql = array();
 
diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php
index 29a56c39f7fe198aa2b11bfec51d16ca60e4dea4..7fe422a58f4d38979e5e279ed89481d8f278253f 100644
--- a/htdocs/includes/modules/modSociete.class.php
+++ b/htdocs/includes/modules/modSociete.class.php
@@ -98,16 +98,19 @@ class modSociete extends DolibarrModules
     $this->rights[1][1] = 'Lire les societes'; // libelle de la permission
     $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 122; // id de la permission
     $this->rights[2][1] = 'Cr�er modifier les societes'; // libelle de la permission
     $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'creer';
 
     $this->rights[3][0] = 129; // id de la permission
     $this->rights[3][1] = 'Supprimer les soci�t�s'; // libelle de la permission
     $this->rights[3][2] = 'd'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'supprimer';
 
     // Dir
     $this->dirs[0] = $conf->societe->dir_output;
diff --git a/htdocs/includes/modules/modTelephonie.class.php b/htdocs/includes/modules/modTelephonie.class.php
index 1cf8cebcfea9f1edff4b85febe91cdd8f13e3bad..6f720e6e16539ddc5c06323f3abe73a1954f97d2 100644
--- a/htdocs/includes/modules/modTelephonie.class.php
+++ b/htdocs/includes/modules/modTelephonie.class.php
@@ -93,17 +93,20 @@ class modTelephonie extends DolibarrModules
     $this->rights[1][0] = 141; // id de la permission
     $this->rights[1][1] = 'Consulter la telephonie'; // libelle de la permission
     $this->rights[1][2] = 'r'; // type de la permission (d�pr�ci� � ce jour)
-    $this->rights[1][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[1][3] = 1; // La permission est-elle une permission par d�faut
+    $this->rights[1][4] = 'lire';
 
     $this->rights[2][0] = 142; // id de la permission
     $this->rights[2][1] = 'Commander les lignes'; // libelle de la permission
     $this->rights[2][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[2][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[2][4] = 'ligne_commander';
 
     $this->rights[3][0] = 143; // id de la permission
     $this->rights[3][1] = 'Activer une ligne'; // libelle de la permission
     $this->rights[3][2] = 'w'; // type de la permission (d�pr�ci� � ce jour)
     $this->rights[3][3] = 0; // La permission est-elle une permission par d�faut
+    $this->rights[3][4] = 'ligne_activer';
 
     $this->rights[4][0] = 144; // id de la permission
     $this->rights[4][1] = 'Configurer la telephonie'; // libelle de la permission
diff --git a/htdocs/user.class.php b/htdocs/user.class.php
index 44fd49b30864f386d40eb520d756f9d190a45da8..90396ac97ba9723b30188f507f3d67d0c4ac93d0 100644
--- a/htdocs/user.class.php
+++ b/htdocs/user.class.php
@@ -248,266 +248,14 @@ class User
 	 
   function getrights($module='')
     {
-      if ($this->all_permissions_are_loaded) {
+      if ($this->all_permissions_are_loaded)
+      {
         // Si les permissions ont d�ja �t� charg� pour ce user, on quitte
-        // Cela �vite de faire n fois le select quand la fonction est appel�e plusieurs fois
-        // pour charger les droits de diff�rents modules. On les charges tous la
-        // premi�re fois, puis on ne fait plus rien.
         return;
       }
 
       /*
-       * Ancienne m�thode
-       * Ne pas supprimer tant que tous les modules n'ont pas �t� migr�s !
-       *
-       */
-
-      $sql = "SELECT u.fk_user, u.fk_id";
-      $sql .= " FROM ".MAIN_DB_PREFIX."user_rights as u, ".MAIN_DB_PREFIX."rights_def as r";
-      $sql .= " WHERE r.id = u.fk_id AND u.fk_user= $this->id AND r.perms IS NULL";
-
-      if ($this->db->query($sql))
-	{
-	  $num = $this->db->num_rows();
-	  $i = 0;
-	  while ($i < $num)
-	    {
-	      $obj = $this->db->fetch_object();
-	      
-	      if ($module == 'facture' or $module == '')
-		{
-		  if ($obj->fk_id == 11)
-		    $this->rights->facture->lire = 1;
-		  
-		  if ($obj->fk_id == 12)
-		    $this->rights->facture->creer = 1;
-		  
-		  if ($obj->fk_id == 13)
-		    $this->rights->facture->modifier = 1;
-		  
-		  if ($obj->fk_id == 14)
-		    $this->rights->facture->valider = 1;
-
-		  if ($obj->fk_id == 15)
-		    $this->rights->facture->envoyer = 1;
-
-		  if ($obj->fk_id == 16)
-		    $this->rights->facture->paiement = 1;
-
-		  if ($obj->fk_id == 19)
-		    $this->rights->facture->supprimer = 1;
-		  
-		}
-	      if ($module == 'propale' or $module == '')
-		{
-		  if ($obj->fk_id == 21)
-		    $this->rights->propale->lire = 1;
-		  
-		  if ($obj->fk_id == 22)
-		    $this->rights->propale->creer = 1;
-		  
-		  if ($obj->fk_id == 23)
-		    $this->rights->propale->modifier = 1;
-		  
-		  if ($obj->fk_id == 24)
-		    $this->rights->propale->valider = 1;
-		  
-		  if ($obj->fk_id == 25)
-		    $this->rights->propale->envoyer = 1;
-		  
-		  if ($obj->fk_id == 26)
-		    $this->rights->propale->cloturer = 1;
-		  
-		  if ($obj->fk_id == 27)
-		    $this->rights->propale->supprimer = 1;
-		}
-	    
-	      if ($module == 'produit' or $module == '')
-		{
-
-		  if ($obj->fk_id == 31)
-		    $this->rights->produit->lire = 1;
-			
-		  if ($obj->fk_id == 32)
-		    $this->rights->produit->creer = 1;
-			
-		  if ($obj->fk_id == 33)
-		    $this->rights->produit->commander = 1;
-			
-		  if ($obj->fk_id == 34)
-		    $this->rights->produit->supprimer = 1;
-
-		}
-	      if ($module == 'projet' or $module == '')
-		{
-
-		  if ($obj->fk_id == 41)
-		    $this->rights->projet->lire = 1;
-			
-		  if ($obj->fk_id == 42)
-		    $this->rights->projet->creer = 1;
-			
-		  if ($obj->fk_id == 43)
-		    $this->rights->projet->modifier = 1;
-			
-		  if ($obj->fk_id == 44)
-		    $this->rights->projet->supprimer = 1;
-		}
-
-	      if ($module == 'commande' or $module == '')
-		{
-
-		  if ($obj->fk_id == 81)
-		    $this->rights->commande->lire = 1;
-			
-		  if ($obj->fk_id == 82)
-		    $this->rights->commande->creer = 1;
-						
-		  if ($obj->fk_id == 84)
-		    $this->rights->commande->valider = 1;
-
-		  if ($obj->fk_id == 89)
-		    $this->rights->commande->supprimer = 1;
-		}
-
-	      if ($module == 'expedition' or $module == '')
-		{
-
-		  if ($obj->fk_id == 101)
-		    $this->rights->expedition->lire = 1;
-			
-		  if ($obj->fk_id == 102)
-		    $this->rights->expedition->creer = 1;
-						
-		  if ($obj->fk_id == 104)
-		    $this->rights->expedition->valider = 1;
-
-		  if ($obj->fk_id == 109)
-		    $this->rights->expedition->supprimer = 1;
-		}
-
-	      if ($module == 'adherent' or $module == '')
-		{
-
-		  if ($obj->fk_id == 71)
-		    $this->rights->adherent->lire = 1;
-			
-		  if ($obj->fk_id == 72)
-		    $this->rights->adherent->creer = 1;
-			
-		  if ($obj->fk_id == 73)
-		    $this->rights->adherent->modifier = 1;
-			
-		  if ($obj->fk_id == 74)
-		    $this->rights->adherent->supprimer = 1;
-
-		}
-
-	      if ($module == 'compta' or $module == '')
-		{
-		  if ($obj->fk_id == 91)
-		    $this->rights->compta->charges->lire = 1;
-
-		  if ($obj->fk_id == 92)
-		    $this->rights->compta->charges->creer = 1;
-		    
-		  if ($obj->fk_id == 93)
-		    $this->rights->compta->charges->supprimer = 1;
-
-		  if ($obj->fk_id == 95)
-		    $this->rights->compta->resultat->lire = 1;
-
-		}
-		
-	      if ($module == 'banque' or $module == '')
-		{
-		  if ($obj->fk_id == 111)
-		    $this->rights->banque->lire = 1;
-
-		  if ($obj->fk_id == 112)
-		    $this->rights->banque->modifier = 1;
-
-		  if ($obj->fk_id == 113)
-		    $this->rights->banque->configurer = 1;
-		}
-
-	      if ($module == 'societe' or $module == '')
-		{
-		  if ($obj->fk_id == 121)
-		    $this->rights->societe->lire = 1;
-
-		  if ($obj->fk_id == 122)
-		    $this->rights->societe->creer = 1;
-
-		  if ($obj->fk_id == 129)
-		    $this->rights->societe->supprimer = 1;
-		}
-
-	      if ($module == 'caisse' or $module == '')
-		{
-		  if ($obj->fk_id == 131)
-		    $this->rights->caisse->lire = 1;
-
-		  if ($obj->fk_id == 132)
-		    $this->rights->caisse->modifier = 1;
-
-		  if ($obj->fk_id == 133)
-		    $this->rights->caisse->configurer = 1;
-		}
-
-	      if ($module == 'telephonie' or $module == '')
-		{
-		  if ($obj->fk_id == 141)
-		    $this->rights->telephonie->lire = 1;
-
-		  if ($obj->fk_id == 142)
-		    $this->rights->telephonie->ligne_commander = 1;
-
-		  if ($obj->fk_id == 143)
-		    $this->rights->telephonie->ligne_activer = 1;
-
-		}
-
-	      if ($module == 'prelevement' or $module == '')
-		{
-		  if ($obj->fk_id == 151)
-		    $this->rights->prelevement->lire = 1;
-
-		  if ($obj->fk_id == 152)
-		    $this->rights->prelevement->configurer = 1;
-
-		}
-
-	      if ($module == 'contrat' or $module == '')
-		{
-		  if ($obj->fk_id == 161)
-		    $this->rights->contrat->lire = 1;
-
-		  if ($obj->fk_id == 162)
-		    $this->rights->contrat->creer = 1;
-
-		  if ($obj->fk_id == 163)
-		    $this->rights->contrat->activer = 1;
-
-		  if ($obj->fk_id == 164)
-		    $this->rights->contrat->desactiver = 1;
-		}
-
-
-	      $i++;
-	    }
-
-	  $this->db->free();	    
-	}
-      else
-	{
-    	  dolibarr_print_error($this->db);
-	}
-
-      /*
-       * Nouvelle m�thode 
-       * Compatible avec l'ancienne
-       *
+       * R�cup�ration des droits
        */
       $sql = "SELECT r.module, r.perms, r.subperms ";
       $sql .= " FROM ".MAIN_DB_PREFIX."user_rights as u, ".MAIN_DB_PREFIX."rights_def as r";
diff --git a/mysql/migration/1.1.0-1.2.0-RC1.sql b/mysql/migration/1.1.0-1.2.0-RC1.sql
index 527eb589b4029905a8802bb0a9eb841f09a6afec..732a1d5988f1e7582beaf9485d752e588b5858de 100644
--- a/mysql/migration/1.1.0-1.2.0-RC1.sql
+++ b/mysql/migration/1.1.0-1.2.0-RC1.sql
@@ -29,6 +29,88 @@ alter table llx_paiement add fk_export_compta integer DEFAULT 0 NOT NULL ;
 
 alter table llx_rights_def add perms varchar(255) after module;
 alter table llx_rights_def add subperms varchar(255) after perms;
+UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="10";
+UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="11";
+UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="12";
+UPDATE llx_rights_def set perms="valider", subperms=NULL               where id="14";
+UPDATE llx_rights_def set perms="envoyer", subperms=NULL               where id="15";
+UPDATE llx_rights_def set perms="paiement", subperms=NULL              where id="16";
+UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="19";
+UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="20";
+UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="21";
+UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="22";
+UPDATE llx_rights_def set perms="valider", subperms=NULL               where id="24";
+UPDATE llx_rights_def set perms="envoyer", subperms=NULL               where id="25";
+UPDATE llx_rights_def set perms="cloturer", subperms=NULL              where id="26";
+UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="27";
+UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="30";
+UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="31";
+UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="32";
+UPDATE llx_rights_def set perms="commander", subperms=NULL             where id="33";
+UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="34";
+UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="40";
+UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="41";
+UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="42";
+UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="44";
+UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="70";
+UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="71";
+UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="72";
+UPDATE llx_rights_def set perms="modifier", subperms=NULL              where id="73";
+UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="74";
+UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="80";
+UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="81";
+UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="82";
+UPDATE llx_rights_def set perms="valider", subperms=NULL               where id="84";
+UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="89";
+UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="90";
+UPDATE llx_rights_def set perms="charges", subperms="lire"             where id="91";
+UPDATE llx_rights_def set perms="charges", subperms="creer"            where id="92";
+UPDATE llx_rights_def set perms="charges", subperms="supprimer"        where id="93";
+UPDATE llx_rights_def set perms="resultat", subperms="lire"            where id="95";
+UPDATE llx_rights_def set perms="ventilation", subperms="parametrer"   where id="96";
+UPDATE llx_rights_def set perms="ventilation", subperms="creer"        where id="97";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="100";
+UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="101";
+UPDATE llx_rights_def set perms= "creer", subperms=NULL                where id="102";
+UPDATE llx_rights_def set perms= "valider", subperms=NULL              where id="104";
+UPDATE llx_rights_def set perms= "supprimer", subperms=NULL            where id="109";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="110";
+UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="111";
+UPDATE llx_rights_def set perms= "modifier", subperms=NULL             where id="112";
+UPDATE llx_rights_def set perms= "configurer", subperms=NULL           where id="113";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="120";
+UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="121";
+UPDATE llx_rights_def set perms= "creer", subperms=NULL                where id="122";
+UPDATE llx_rights_def set perms= "supprimer", subperms=NULL            where id="129";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="140";
+UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="141";
+UPDATE llx_rights_def set perms= "ligne_commander", subperms=NULL      where id="142";
+UPDATE llx_rights_def set perms= "ligne_activer", subperms=NULL        where id="143";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="144";
+UPDATE llx_rights_def set perms= "fournisseur", subperms="config"      where id="145";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="150";
+UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="151";
+UPDATE llx_rights_def set perms= "configurer", subperms=NULL           where id="152";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="160";
+UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="161";
+UPDATE llx_rights_def set perms= "creer", subperms=NULL                where id="162";
+UPDATE llx_rights_def set perms= "activer", subperms=NULL              where id="163";
+UPDATE llx_rights_def set perms= "desactiver", subperms=NULL           where id="164";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="170";
+UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="180";
+UPDATE llx_rights_def set perms= "commande", subperms="lire"           where id="181";
+UPDATE llx_rights_def set perms= "commande", subperms="creer"          where id="182";
+UPDATE llx_rights_def set perms= "commande", subperms="valider"        where id="183";
+UPDATE llx_rights_def set perms= "commande", subperms="approuver"      where id="184";
+UPDATE llx_rights_def set perms= "commande", subperms="commander"      where id="185";
+UPDATE llx_rights_def set perms= "commande", subperms="cloturer"       where id="186";
+UPDATE llx_rights_def set perms= "ligne", subperms="creer"             where id="192";
+UPDATE llx_rights_def set perms= "adsl", subperms="creer"              where id="202";
+UPDATE llx_rights_def set perms= "adsl", subperms="requete"            where id="203";
+UPDATE llx_rights_def set perms= "adsl", subperms="commander"          where id="204";
+UPDATE llx_rights_def set perms= "adsl", subperms="gerer"              where id="205";
+UPDATE llx_rights_def set perms= "contrat", subperms="paiement"        where id="215";
+
 
 alter table llx_facturedet add fk_code_ventilation integer NOT NULL DEFAULT 0;