diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php
index d97114c34680acabdb9e15c087c5e03e32f280d3..7a64b607c511582ec854e1060cf4e13f15ac255c 100644
--- a/htdocs/admin/societe.php
+++ b/htdocs/admin/societe.php
@@ -126,39 +126,39 @@ if ($handle)
 	{
 		if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
 		{
-	  $file = substr($file, 0, strlen($file)-4);
-
-	  require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
-
-	  $modCodeTiers = new $file;
-
-	  // Show modules according to features level
-	  if ($modCodeTiers->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
-	  if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
-
-	  $var = !$var;
-	  print "<tr ".$bc[$var].">\n  <td width=\"140\">".$modCodeTiers->nom."</td>\n  <td>";
-	  print $modCodeTiers->info($langs);
-	  print "</td>\n";
-	  print '<td nowrap="nowrap">'.$modCodeTiers->getExample($langs)."</td>\n";
-
-	  if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
-	  {
-	  	print "<td align=\"center\">\n";
-	  	print img_tick();
-	  	print "</td>\n";
-	  }
-	  else
-	  {
-	  	print '<td align="center"><a href="societe.php?action=setcodeclient&amp;value='.$file.'">'.$langs->trans("Activate").'</a></td>';
-	  }
-
-	  print '<td align="center">';
-	  $s=$modCodeTiers->getToolTip($langs,$soc,-1);
-	  print $form->textwithpicto('',$s,1);
-	  print '</td>';
-
-	  print '</tr>';
+			$file = substr($file, 0, strlen($file)-4);
+
+			require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
+
+			$modCodeTiers = new $file;
+
+			// Show modules according to features level
+			if ($modCodeTiers->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
+			if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
+
+			$var = !$var;
+			print "<tr ".$bc[$var].">\n  <td width=\"140\">".$modCodeTiers->nom."</td>\n  <td>";
+			print $modCodeTiers->info($langs);
+			print "</td>\n";
+			print '<td nowrap="nowrap">'.$modCodeTiers->getExample($langs)."</td>\n";
+
+			if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
+			{
+				print "<td align=\"center\">\n";
+				print img_tick();
+				print "</td>\n";
+			}
+			else
+			{
+				print '<td align="center"><a href="societe.php?action=setcodeclient&amp;value='.$file.'">'.$langs->trans("Activate").'</a></td>';
+			}
+
+			print '<td align="center">';
+			$s=$modCodeTiers->getToolTip($langs,$soc,-1);
+			print $form->textwithpicto('',$s,1);
+			print '</td>';
+
+			print '</tr>';
 		}
 	}
 	closedir($handle);
diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php
index dce5cc0c8d924bd61fe33d5987d60db2af8fb803..721805db99d608d63d42c41b1df48a81528dc57b 100644
--- a/htdocs/includes/modules/DolibarrModules.class.php
+++ b/htdocs/includes/modules/DolibarrModules.class.php
@@ -178,8 +178,12 @@ class DolibarrModules
 		{
 			if (! $err)
 			{
-				if (!$this->db->query($array_sql[$i]))
+				dol_syslog("DolibarrModules::_remove sql=".$array_sql[$i], LOG_DEBUG);
+				$result=$this->db->query($array_sql[$i]);
+				if (! $result)
 				{
+					$this->error=$this->db->error();
+					dol_syslog("DolibarrModules::_remove Error ".$this->error, LOG_ERR);
 					$err++;
 				}
 			}
diff --git a/htdocs/includes/modules/modAccounting.class.php b/htdocs/includes/modules/modAccounting.class.php
index 0b18ad6e4a736811601c470ca05930bbe48bc743..a8e2f84030fe4ddcd3cda6ae3cd35ea74ce4c2e7 100644
--- a/htdocs/includes/modules/modAccounting.class.php
+++ b/htdocs/includes/modules/modAccounting.class.php
@@ -54,7 +54,7 @@ class modAccounting extends DolibarrModules
 		$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 compl�te de comptabilite (doubles parties)";
+		$this->description = "Gestion complete de comptabilite (doubles parties)";
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		//$this->version = 'dolibarr';
@@ -66,14 +66,14 @@ class modAccounting extends DolibarrModules
 		// Config pages
 		$this->config_page_url = array("accounting.php");
 
-		// Dependances
+		// Dependancies
 		$this->depends = array("modFacture","modBanque");
 		$this->requiredby = array();
 		$this->conflictwith = array("modComptabilite");
 		$this->langfiles = array("compta");
 
-		// Constantes
-		$this->const = array();
+		// Constants
+		$this->const = array(0=>array('MAIN_COMPANY_CODE_ALWAYS_REQUIRED','chaine','1','With this constants on, third party codes are always required whatever is numbering module behaviour',0));			// List of particular constants to add when module is enabled
 
 		// Data directories to create when module is enabled
 		$this->dirs = array("/accounting/temp");
@@ -134,25 +134,27 @@ class modAccounting extends DolibarrModules
 	 *   \brief      Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
 	 *               Definit egalement les repertoires de donnees e creer pour ce module.
 	 */
-	function init()
+	function init($options='')
 	{
-		global $conf;
+		// Prevent pb of modules not correctly disabled
+		//$this->remove($options);
 
-		// Nettoyage avant activation
-		$this->remove();
+		$sql = array();
 
-		return $this->_init($sql);
+		return $this->_init($sql,$options);
 	}
 
 	/**
 	 *    \brief      Fonction appelee lors de la desactivation d'un module.
 	 *                Supprime de la base les constantes, boites et permissions du module.
 	 */
-	function remove()
+	function remove($options='')
 	{
-		$sql = array();
+		global $conf;
+
+		$sql = array("DELETE FROM ".MAIN_DB_PREFIX."const where name='MAIN_COMPANY_CODE_ALWAYS_REQUIRED' and entity IN ('0','".$conf->entity."')");
 
-		return $this->_remove($sql);
+		return $this->_remove($sql,$options);
 	}
 }
 ?>
diff --git a/htdocs/includes/modules/societe/mod_codeclient_elephant.php b/htdocs/includes/modules/societe/mod_codeclient_elephant.php
index cd24c654df4e84b5354f731df7309abcd04793d7..618eb067f0e2be64d7d46fe252c6c851ebb117fc 100644
--- a/htdocs/includes/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/includes/modules/societe/mod_codeclient_elephant.php
@@ -55,7 +55,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
 		$this->nom = "Elephant";
 		$this->version = "dolibarr";
 		$this->code_null = 0;
-		$this->code_modifiable = 0;
+		$this->code_modifiable = 1;
 		$this->code_modifiable_invalide = 1;
 		$this->code_modifiable_null = 1;
 		$this->code_auto = 1;
diff --git a/htdocs/includes/modules/societe/mod_codeclient_monkey.php b/htdocs/includes/modules/societe/mod_codeclient_monkey.php
index 7d8ce030abac1a63394f0897117197df6b5b004c..0b7b8cd47f28346c66aa5de6c8ba9e4bd7279bcb 100644
--- a/htdocs/includes/modules/societe/mod_codeclient_monkey.php
+++ b/htdocs/includes/modules/societe/mod_codeclient_monkey.php
@@ -19,7 +19,7 @@
  */
 
 /**
- *       \file       htdocs/includes/modules/societe/mod_codeclient_lion.class.php
+ *       \file       htdocs/includes/modules/societe/mod_codeclient_monkey.class.php
  *       \ingroup    societe
  *       \brief      Fichier de la classe des gestion lion des codes clients
  *       \version    $Id$
@@ -105,7 +105,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
 		if ($type == 0) $prefix=$this->prefixcustomer;
 		if ($type == 1) $prefix=$this->prefixsupplier;
 
-        // D'abord on r�cup�re la valeur max (r�ponse imm�diate car champ ind�x�)
+        // D'abord on r�cup�re la valeur max (r�ponse imm�diate car champ ind�x�)
         $posindice=8;
         $sql = "SELECT MAX(0+SUBSTRING(".$field.",".$posindice.")) as max";
         $sql.= " FROM ".MAIN_DB_PREFIX."societe";
diff --git a/htdocs/includes/modules/societe/modules_societe.class.php b/htdocs/includes/modules/societe/modules_societe.class.php
index 928a03c02157708dba0f2bb5e90e925c682feb5f..32b88f19a396f093aeba24aa5de53643ce27d603 100644
--- a/htdocs/includes/modules/societe/modules_societe.class.php
+++ b/htdocs/includes/modules/societe/modules_societe.class.php
@@ -134,6 +134,8 @@ class ModeleThirdPartyCode
      */
     function getToolTip($langs,$soc,$type)
     {
+    	global $conf;
+
     	$langs->load("admin");
 
 		$s='';
@@ -144,10 +146,33 @@ class ModeleThirdPartyCode
 		if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
 		$s.='<br>';
 		$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
-		if ($type == 0)  $s.=$langs->trans("RequiredIfCustomer").': '.yn(!$this->code_null,1,2).'<br>';
-		if ($type == 1)  $s.=$langs->trans("RequiredIfSupplier").': '.yn(!$this->code_null,1,2).'<br>';
-		if ($type == -1) $s.=$langs->trans("Required").': '.yn(!$this->code_null,1,2).'<br>';
-		$s.=$langs->trans("CanBeModifiedIfOk").': '.yn($this->code_modifiable,1,2).'<br>';
+		if ($type == 0)
+		{
+			$s.=$langs->trans("RequiredIfCustomer").': ';
+			if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='<strike>';
+			$s.=yn(!$this->code_null,1,2);
+			if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+			$s.='<br>';
+		}
+		if ($type == 1)
+		{
+			$s.=$langs->trans("RequiredIfSupplier").': ';
+			if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='<strike>';
+			$s.=yn(!$this->code_null,1,2);
+			if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+			$s.='<br>';
+		}
+		if ($type == -1)
+		{
+			$s.=$langs->trans("Required").': ';
+			if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='<strike>';
+			$s.=yn(!$this->code_null,1,2);
+			if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+			$s.='<br>';
+		}
+		$s.=$langs->trans("CanBeModifiedIfOk").': ';
+		$s.=yn($this->code_modifiable,1,2);
+		$s.='<br>';
 		$s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide,1,2).'<br>';
 		$s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto,1,2).'<br>';
 		$s.='<br>';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index afb70d4ee9818405c2827ea69b0a1ee3078f2300..e12113c6a52e18b95065cccd81bde3493a2047e5 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -691,6 +691,8 @@ BackupDescY=The generated dump file should be stored in a secure place.
 RestoreDesc=To restore a Dolibarr backup, you must:
 RestoreDesc2=* Restore archive file (zip file for example) of documents directory to extract tree of files in documents directory of a new Dolibarr installation or into this current documents directoy (<b>%s</b>).
 RestoreDesc3=* Restore the data, from a backup dump file, into the database of the new Dolibarr installation or into the database of this current installation. Warning, once restore is finished, you must use a login/password, that existed when backup was made, to connect again. To restore a backup database into this current installation, you can follow this assistant.
+ForcedToByAModule = This rule is forced to <b>%s</b> by an activated module
+
 ##### Module password generation
 PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
 PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index a7ed078310972cc9212d37ad29e4e56ba04feed4..e3e972ae9ac35c02abfa6d15424ad030bc2b13b5 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -690,6 +690,8 @@ BackupDescY = Le fichier dump généré devra être placé en lieu sur.
 RestoreDesc = Pour restaurer une sauvegarde de Dolibarr, vous devez:
 RestoreDesc2 = * Reprendre le fichier archive (fichier zip par exemple) du répertoire documents et en extraire l'arborescence dans le répertoire documents d'une nouvelle installation de dolibarr ou dans le répertoire documents de cette installation (<b>%s</b>).
 RestoreDesc3 = * Recharger depuis le fichier dump sauvegardé, la base de donnée d'une nouvelle installation de Dolibarr ou de cette installation. Attention, une fois la restauration faite, il faudra utiliser un login/mot de passe administrateur existant à l'époque de la sauvegarde pour se connecter. Pour restaurer la base dans l'installation actuelle, vous pouvez utilisez l'assistant suivant.
+ForcedToByAModule = Cette règle est forcée à <b>%s</b> par un des modules activés
+
 ##### Module password generation = undefined
 PasswordGenerationStandard = Renvoie un mot de passe généré selon algorithme interne Dolibarr: 8 caractères, chiffres et caractères en minuscules mélangés.
 PasswordGenerationNone = Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 9a90ea61f18e66beaf1fbc1d846ca669340b6636..7af1993798c9a4db06687db4a84229d066587655 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -2349,7 +2349,7 @@ function get_default_npr($societe_vendeuse, $societe_acheteuse, $taux_produit)
  *	\brief  Renvoie oui ou non dans la langue choisie
  *	\param	yesno			Variable pour test si oui ou non
  *	\param	case			1=Yes/No, 0=yes/no
- *	\param	color			0=texte only, 1=Text is formated with a color font style (red or blue), 2=Text is formated with blue color.
+ *	\param	color			0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
  */
 function yn($yesno, $case=1, $color=0)
 {