Ajout module numrotation automatique tigre

This commit is contained in:
Regis Houssin 2007-11-06 23:14:59 +00:00
parent 090bf60f15
commit 9540dfb03d
2 changed files with 13 additions and 12 deletions

View File

@ -159,8 +159,8 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
$result=$oldsoc->fetch($socid);
// On vérifie si un tiers devient client ou fournisseur pour l'obtention d'un code automatiqe
if (!$soc->client && $soc->code_client == "automaticCode") $soc->code_client = '';
if (!$soc->fournisseur && $soc->code_fournisseur == "automaticCode") $soc->code_fournisseur = '';
if (!$soc->client && $soc->code_client == -1) $soc->code_client = '';
if (!$soc->fournisseur && $soc->code_fournisseur == -1) $soc->code_fournisseur = '';
$result = $soc->update($socid,$user,1,$oldsoc->codeclient_modifiable(),$oldsoc->codefournisseur_modifiable());
if ($result >= 0)
@ -346,7 +346,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
print '<table class="nobordernopadding"><tr><td>';
if ($modCodeClient->code_auto == 1)
{
if ($soc->client == 1 || $soc->client == 2) print '<input type="hidden" name="code_client" value="automaticCode">';
if ($soc->client == 1 || $soc->client == 2) print '<input type="hidden" name="code_client" value="-1">';
print $langs->trans('AutomaticallyGenerated').'&nbsp;';
}
else
@ -369,7 +369,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
print '<table class="nobordernopadding"><tr><td>';
if ($modCodeFournisseur->code_auto == 1)
{
if ($soc->fournisseur == 1) print '<input type="hidden" name="code_fournisseur" value="automaticCode">';
if ($soc->fournisseur == 1) print '<input type="hidden" name="code_fournisseur" value="-1">';
print $langs->trans('AutomaticallyGenerated').'&nbsp;';
}
else
@ -672,9 +672,9 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '<td width="25%">'.$langs->trans('CustomerCode').'</td><td width="25%">';
print '<table class="nobordernopadding"><tr><td>';
if (!$soc->code_client && $modCodeClient->code_auto == 1)
if (((!$soc->client && !$soc->code_client)|| $soc->code_client == -1) && $modCodeClient->code_auto == 1)
{
if (!$soc->client) print '<input type="hidden" name="code_client" value="automaticCode">';
print '<input type="hidden" name="code_client" value="-1">';
print $langs->trans('AutomaticallyGenerated').'&nbsp;';
}
else if ($soc->codeclient_modifiable())
@ -701,9 +701,9 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '<td>'.$langs->trans('SupplierCode').'</td><td>';
print '<table class="nobordernopadding"><tr><td>';
if (!$soc->code_fournisseur && $modCodeFournisseur->code_auto == 1)
if (((!$soc->fournisseur && !$soc->code_fournisseur) || $soc->code_fournisseur == -1) && $modCodeFournisseur->code_auto == 1)
{
if (!$soc->fournisseur) print '<input type="hidden" name="code_fournisseur" value="automaticCode">';
print '<input type="hidden" name="code_fournisseur" value="-1">';
print $langs->trans('AutomaticallyGenerated').'&nbsp;';
}
else if ($soc->codefournisseur_modifiable())

View File

@ -115,6 +115,7 @@ class Societe
$this->typent_id = 0;
$this->effectif_id = 0;
$this->forme_juridique_code = 0;
$this->prefixIsRequired = 0;
return 1;
}
@ -137,8 +138,8 @@ class Societe
$this->db->begin();
// Pour code automatique
if ($this->code_client == "automaticCode") $this->get_codeclient($this->prefix_comm,0);
if ($this->code_fournisseur == "automaticCode") $this->get_codefournisseur($this->prefix_comm,1);
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
if ($this->code_fournisseur == -1) $this->get_codefournisseur($this->prefix_comm,1);
$result = $this->verify();
@ -331,8 +332,8 @@ class Societe
$this->forme_juridique_code=trim($this->forme_juridique_code);
// Pour code client/fournisseur automatique
if ($this->code_client == "automaticCode") $this->get_codeclient($this->prefix_comm,0);
if ($this->code_fournisseur == "automaticCode") $this->get_codefournisseur($this->prefix_comm,1);
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
if ($this->code_fournisseur == -1) $this->get_codefournisseur($this->prefix_comm,1);
$result = $this->verify(); // Verifie que nom obligatoire et code client ok et unique