New: A module can set option to force third parties code to be required whatever is numbering module.
This commit is contained in:
parent
ae67640f6c
commit
e9785c4d6d
@ -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 "<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";
|
||||
$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&value='.$file.'">'.$langs->trans("Activate").'</a></td>';
|
||||
}
|
||||
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&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 '<td align="center">';
|
||||
$s=$modCodeTiers->getToolTip($langs,$soc,-1);
|
||||
print $form->textwithpicto('',$s,1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<EFBFBD>cup<EFBFBD>re la valeur max (r<>ponse imm<6D>diate car champ ind<6E>x<EFBFBD>)
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(0+SUBSTRING(".$field.",".$posindice.")) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user