| ';
if ($modCodeFournisseur->code_auto == 1)
{
- if ($soc->fournisseur == 1) print '';
+ if ($soc->fournisseur == 1) print '';
print $langs->trans('AutomaticallyGenerated').' ';
}
else
@@ -672,9 +672,9 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print ' | '.$langs->trans('CustomerCode').' | ';
print '| ';
- 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 '';
+ print '';
print $langs->trans('AutomaticallyGenerated').' ';
}
else if ($soc->codeclient_modifiable())
@@ -701,9 +701,9 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print ' | '.$langs->trans('SupplierCode').' | ';
print '| ';
- 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 '';
+ print '';
print $langs->trans('AutomaticallyGenerated').' ';
}
else if ($soc->codefournisseur_modifiable())
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 7b73c8b4d7d..c403815b516 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -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
|
|
|