Ajout module numrotation automatique tigre

This commit is contained in:
Regis Houssin 2007-11-06 23:50:32 +00:00
parent 55567a161e
commit 6350848ec5
3 changed files with 10 additions and 7 deletions

View File

@ -383,9 +383,10 @@ class mod_codeclient_tigre extends ModeleThirdPartyCode
* \param $db Handler acces base * \param $db Handler acces base
* \param $code Code a vérifier/corriger * \param $code Code a vérifier/corriger
* \param $soc Objet societe * \param $soc Objet societe
* \param $type 0 = client/prospect , 1 = fournisseur
* \return int <0 si KO, 0 si OK * \return int <0 si KO, 0 si OK
*/ */
function verif($db, &$code, $soc) function verif($db, &$code, $soc, $type)
{ {
$result=0; $result=0;
$code = strtoupper(trim($code)); $code = strtoupper(trim($code));
@ -403,11 +404,11 @@ class mod_codeclient_tigre extends ModeleThirdPartyCode
{ {
$result=-3; $result=-3;
} }
else if ($soc->prefixCustomerIsRequired && !$soc->prefix_comm) else if ($type == 0 && $soc->prefixCustomerIsRequired && !$soc->prefix_comm)
{ {
$result=-4; $result=-4;
} }
else if ($soc->prefixSupplierIsRequired && !$soc->prefix_comm) else if ($type == 1 && $soc->prefixSupplierIsRequired && !$soc->prefix_comm)
{ {
$result=-5; $result=-5;
} }

View File

@ -672,7 +672,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '<td width="25%">'.$langs->trans('CustomerCode').'</td><td width="25%">'; print '<td width="25%">'.$langs->trans('CustomerCode').'</td><td width="25%">';
print '<table class="nobordernopadding"><tr><td>'; print '<table class="nobordernopadding"><tr><td>';
if (((!$soc->client && !$soc->code_client)|| $soc->code_client == -1) && $modCodeClient->code_auto == 1) if ((!$soc->code_client || $soc->code_client == -1) && $modCodeClient->code_auto == 1)
{ {
print '<input type="hidden" name="code_client" value="-1">'; print '<input type="hidden" name="code_client" value="-1">';
print $langs->trans('AutomaticallyGenerated').'&nbsp;'; print $langs->trans('AutomaticallyGenerated').'&nbsp;';
@ -701,7 +701,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '<td>'.$langs->trans('SupplierCode').'</td><td>'; print '<td>'.$langs->trans('SupplierCode').'</td><td>';
print '<table class="nobordernopadding"><tr><td>'; print '<table class="nobordernopadding"><tr><td>';
if (((!$soc->fournisseur && !$soc->code_fournisseur) || $soc->code_fournisseur == -1) && $modCodeFournisseur->code_auto == 1) if ((!$soc->code_fournisseur || $soc->code_fournisseur == -1) && $modCodeFournisseur->code_auto == 1)
{ {
print '<input type="hidden" name="code_fournisseur" value="-1">'; print '<input type="hidden" name="code_fournisseur" value="-1">';
print $langs->trans('AutomaticallyGenerated').'&nbsp;'; print $langs->trans('AutomaticallyGenerated').'&nbsp;';

View File

@ -1549,7 +1549,8 @@ class Societe
$mod = new $var; $mod = new $var;
dolibarr_syslog("Societe::check_codeclient code_client=".$this->code_client." module=".$var); dolibarr_syslog("Societe::check_codeclient code_client=".$this->code_client." module=".$var);
return $mod->verif($this->db, $this->code_client, $this); $result = $mod->verif($this->db, $this->code_client, $this, 0);
return $result;
} }
else else
{ {
@ -1573,7 +1574,8 @@ class Societe
$mod = new $var; $mod = new $var;
dolibarr_syslog("Societe::check_codefournisseur code_fournisseur=".$this->code_fournisseur." module=".$var); dolibarr_syslog("Societe::check_codefournisseur code_fournisseur=".$this->code_fournisseur." module=".$var);
return $mod->verif($this->db, $this->code_fournisseur, $this); $result = $mod->verif($this->db, $this->code_fournisseur, $this ,1);
return $result;
} }
else else
{ {