forked from Wavyzz/dolibarr
New: An external module can force the third party code to be required whatever is the rule of third party code module.
This commit is contained in:
@@ -38,6 +38,8 @@ For translators:
|
||||
- Update some language files.
|
||||
|
||||
For developers:
|
||||
- An external module can force the third party code to be required whatever is the rule of
|
||||
third party code module.
|
||||
- Update fckeditor to 2.6.4.
|
||||
- Removed some deprecated files.
|
||||
- Creation of directory in module descriptor is simpler.
|
||||
|
||||
@@ -197,12 +197,16 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
|
||||
|
||||
/**
|
||||
* \brief Verifie la validite du code
|
||||
* \param $db Handler acces base
|
||||
* \param $code Code a verifier/corriger
|
||||
* \param $soc Objet societe
|
||||
* \param $type 0 = client/prospect , 1 = fournisseur
|
||||
* \return int <0 if KO, 0 if OK
|
||||
* \brief Check validity of code according to its rules
|
||||
* \param $db Database handler
|
||||
* \param $code Code to check/correct
|
||||
* \param $soc Object third party
|
||||
* \param $type 0 = customer/prospect , 1 = supplier
|
||||
* \return int 0 if OK
|
||||
* -1 ErrorBadCustomerCodeSyntax
|
||||
* -2 ErrorCustomerCodeRequired
|
||||
* -3 ErrorCustomerCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
*/
|
||||
function verif($db, &$code, $soc, $type)
|
||||
{
|
||||
@@ -213,10 +217,14 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
$result=0;
|
||||
$code = strtoupper(trim($code));
|
||||
|
||||
if (! $code && $this->code_null)
|
||||
if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
$result=0;
|
||||
}
|
||||
else if (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) )
|
||||
{
|
||||
$result=-2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get Mask value
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/includes/modules/societe/modules_societe.class.
|
||||
/**
|
||||
\class mod_codeclient_leopard
|
||||
\brief Classe permettant la gestion leopard des codes tiers
|
||||
*/
|
||||
*/
|
||||
class mod_codeclient_leopard extends ModeleThirdPartyCode
|
||||
{
|
||||
/*
|
||||
@@ -85,17 +85,35 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
|
||||
|
||||
|
||||
/**
|
||||
* \brief check validity of code
|
||||
* \param $db Handler acces base
|
||||
* \param $code Code to check
|
||||
* \param $soc Objet societe
|
||||
* \brief Check validity of code according to its rules
|
||||
* \param $db Database handler
|
||||
* \param $code Code to check/correct
|
||||
* \param $soc Object third party
|
||||
* \param $type 0 = customer/prospect , 1 = supplier
|
||||
* \return int 0 if OK
|
||||
* -1 ErrorBadCustomerCodeSyntax
|
||||
* -2 ErrorCustomerCodeRequired
|
||||
* -3 ErrorCustomerCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
*/
|
||||
function verif($db, &$code, $soc)
|
||||
function verif($db, &$code, $soc, $type)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$result=0;
|
||||
$code = strtoupper(trim($code));
|
||||
|
||||
// Renvoie toujours ok
|
||||
return 0;
|
||||
if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
$result=0;
|
||||
}
|
||||
else if (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) )
|
||||
{
|
||||
$result=-2;
|
||||
}
|
||||
|
||||
dol_syslog("mod_codeclient_leopard::verif type=".$type." result=".$result);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/includes/modules/societe/modules_societe.class.
|
||||
/**
|
||||
\class mod_codeclient_monkey
|
||||
\brief Classe permettant la gestion monkey des codes tiers
|
||||
*/
|
||||
*/
|
||||
class mod_codeclient_monkey extends ModeleThirdPartyCode
|
||||
{
|
||||
var $nom; // Nom du modele
|
||||
@@ -135,21 +135,32 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
|
||||
|
||||
|
||||
/**
|
||||
* \brief Verifie la validite du code
|
||||
* \param $db Handler acces base
|
||||
* \param $code Code a verifier/corriger
|
||||
* \param $soc Objet societe
|
||||
* \return int <0 si KO, 0 si OK
|
||||
* \brief Check validity of code according to its rules
|
||||
* \param $db Database handler
|
||||
* \param $code Code to check/correct
|
||||
* \param $soc Object third party
|
||||
* \param $type 0 = customer/prospect , 1 = supplier
|
||||
* \return int 0 if OK
|
||||
* -1 ErrorBadCustomerCodeSyntax
|
||||
* -2 ErrorCustomerCodeRequired
|
||||
* -3 ErrorCustomerCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
*/
|
||||
function verif($db, &$code, $soc)
|
||||
function verif($db, &$code, $soc, $type)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$result=0;
|
||||
$code = strtoupper(trim($code));
|
||||
|
||||
if (! $code && $this->code_null)
|
||||
if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
$result=0;
|
||||
}
|
||||
else if (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) )
|
||||
{
|
||||
$result=-2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->verif_syntax($code) >= 0)
|
||||
@@ -176,7 +187,8 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
|
||||
}
|
||||
}
|
||||
}
|
||||
dol_syslog("mod_codeclient_monkey::verif result=".$result);
|
||||
|
||||
dol_syslog("mod_codeclient_monkey::verif type=".$type." result=".$result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,10 +147,11 @@ class Societe extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// For automatic creation during create action (not used by Dolibarr)
|
||||
// For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts)
|
||||
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
|
||||
if ($this->code_fournisseur == -1) $this->get_codefournisseur($this->prefix_comm,1);
|
||||
|
||||
// Check more parameters
|
||||
$result = $this->verify();
|
||||
|
||||
if ($result >= 0)
|
||||
@@ -229,7 +230,7 @@ class Societe extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check properties of third party are ok
|
||||
* \brief Check properties of third party are ok (like name, third party codes, ...)
|
||||
* \return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function verify()
|
||||
@@ -1553,8 +1554,12 @@ class Societe extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Verifie code client
|
||||
* \return int <0 si KO, 0 si OK, peut modifier le code client suivant le module utilise
|
||||
* \brief Check customer code
|
||||
* \return int 0 if OK
|
||||
* -1 ErrorBadCustomerCodeSyntax
|
||||
* -2 ErrorCustomerCodeRequired
|
||||
* -3 ErrorCustomerCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
*/
|
||||
function check_codeclient()
|
||||
{
|
||||
@@ -1578,8 +1583,12 @@ class Societe extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Verifie code fournisseur
|
||||
* \return int <0 si KO, 0 si OK, peut modifier le code client suivant le module utilise
|
||||
* \brief Check supplier code
|
||||
* \return int 0 if OK
|
||||
* -1 ErrorBadCustomerCodeSyntax
|
||||
* -2 ErrorCustomerCodeRequired
|
||||
* -3 ErrorCustomerCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
*/
|
||||
function check_codefournisseur()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user