diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php
index d97114c3468..7a64b607c51 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);
+ $file = substr($file, 0, strlen($file)-4);
- require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
+ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
- $modCodeTiers = new $file;
+ $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;
+ // 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 "
\n | ".$modCodeTiers->nom." | \n ";
- print $modCodeTiers->info($langs);
- print " | \n";
- print ''.$modCodeTiers->getExample($langs)." | \n";
+ $var = !$var;
+ print "
\n | ".$modCodeTiers->nom." | \n ";
+ print $modCodeTiers->info($langs);
+ print " | \n";
+ print ''.$modCodeTiers->getExample($langs)." | \n";
- if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
- {
- print "\n";
- print img_tick();
- print " | \n";
- }
- else
- {
- print ''.$langs->trans("Activate").' | ';
- }
+ if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
+ {
+ print "\n";
+ print img_tick();
+ print " | \n";
+ }
+ else
+ {
+ print ''.$langs->trans("Activate").' | ';
+ }
- print '';
- $s=$modCodeTiers->getToolTip($langs,$soc,-1);
- print $form->textwithpicto('',$s,1);
- print ' | ';
+ print '';
+ $s=$modCodeTiers->getToolTip($langs,$soc,-1);
+ print $form->textwithpicto('',$s,1);
+ print ' | ';
- print '
';
+ print '';
}
}
closedir($handle);
diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php
index dce5cc0c8d9..721805db99d 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 0b18ad6e4a7..a8e2f84030f 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;
- return $this->_remove($sql);
+ $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,$options);
}
}
?>
diff --git a/htdocs/includes/modules/societe/mod_codeclient_elephant.php b/htdocs/includes/modules/societe/mod_codeclient_elephant.php
index cd24c654df4..618eb067f0e 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 7d8ce030aba..0b7b8cd47f2 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 928a03c0215..32b88f19a39 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").': '.$this->getNom($langs).'
';
$s.='
';
$s.=''.$langs->trans("ThisIsModuleRules").':
';
- if ($type == 0) $s.=$langs->trans("RequiredIfCustomer").': '.yn(!$this->code_null,1,2).'
';
- if ($type == 1) $s.=$langs->trans("RequiredIfSupplier").': '.yn(!$this->code_null,1,2).'
';
- if ($type == -1) $s.=$langs->trans("Required").': '.yn(!$this->code_null,1,2).'
';
- $s.=$langs->trans("CanBeModifiedIfOk").': '.yn($this->code_modifiable,1,2).'
';
+ if ($type == 0)
+ {
+ $s.=$langs->trans("RequiredIfCustomer").': ';
+ if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null,1,2);
+ if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+ $s.='
';
+ }
+ if ($type == 1)
+ {
+ $s.=$langs->trans("RequiredIfSupplier").': ';
+ if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null,1,2);
+ if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+ $s.='
';
+ }
+ if ($type == -1)
+ {
+ $s.=$langs->trans("Required").': ';
+ if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null,1,2);
+ if ($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED && !empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+ $s.='
';
+ }
+ $s.=$langs->trans("CanBeModifiedIfOk").': ';
+ $s.=yn($this->code_modifiable,1,2);
+ $s.='
';
$s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide,1,2).'
';
$s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto,1,2).'
';
$s.='
';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index afb70d4ee98..e12113c6a52 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 (%s).
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 %s 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 a7ed0783109..e3e972ae9ac 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 (%s).
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 à %s 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 9a90ea61f18..7af1993798c 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)
{