Uniformisation du code

This commit is contained in:
Regis Houssin 2007-11-06 15:29:55 +00:00
parent 84a2167c5c
commit 0f9e8b22ab
4 changed files with 17 additions and 14 deletions

View File

@ -103,19 +103,19 @@ class mod_codeclient_tigre extends ModeleThirdPartyCode
* \param $type Client ou fournisseur (1:client, 2:fournisseur)
* \return string Texte descripif
*/
function getExample($langs,$objsoc=0,$type=0)
function getExample($langs,$objsoc=0,$type=-1)
{
if ($type == 1)
if ($type == 0)
{
$example = $this->getNextValue($objsoc,0);
}
else if ($type == 1)
{
$example = $this->getNextValue($objsoc,1);
}
else if ($type == 2)
{
$example = $this->getNextValue($objsoc,2);
}
else
{
$example = $this->getNextValue($objsoc,1)."<br>".$this->getNextValue($objsoc,2);
$example = $this->getNextValue($objsoc,0)."<br>".$this->getNextValue($objsoc,1);
}
return $example;
}
@ -124,18 +124,18 @@ class mod_codeclient_tigre extends ModeleThirdPartyCode
* \param $type Client ou fournisseur (1:client, 2:fournisseur)
* \return string Valeur
*/
function getNextValue($objsoc=0,$type=0)
function getNextValue($objsoc=0,$type=-1)
{
global $db,$conf;
$mask = $this->buildMask($objsoc,$type);
$count = 0;
if ($type == 1)
if ($type == 0)
{
$field = 'code_client';
}
else if ($type == 2)
else if ($type == 1)
{
$field = 'code_fournisseur';
}
@ -172,15 +172,15 @@ class mod_codeclient_tigre extends ModeleThirdPartyCode
* \param $type Client ou fournisseur (1:client, 2:fournisseur)
* \return string Valeur
*/
function buildMask($objsoc=0,$type='')
function buildMask($objsoc=0,$type=-1)
{
global $conf;
if ($type==1)
if ($type==0)
{
$mask = $conf->global->CODE_TIGRE_MASK_CUSTOMER;
}
else if ($type==2)
else if ($type==1)
{
$mask = $conf->global->CODE_TIGRE_MASK_SUPPLIER;
}

View File

@ -132,7 +132,8 @@ class ModeleThirdPartyCode
$s.=$langs->trans("CanBeModifiedIfOk").': <b>'.yn($this->code_modifiable).'</b><br>';
$s.=$langs->trans("CanBeModifiedIfKo").': <b>'.yn($this->code_modifiable_invalide).'</b><br>';
$s.=$langs->trans("AutomaticCode").': <b>'.yn($this->code_auto).'</b><br>';
if ($type != -1) $s.=$langs->trans("Example").': <b>'.$this->getExample($langs,$soc,1).'</b>';
if ($type == 0) $s.=$langs->trans("Example").': <b>'.$this->getExample($langs,$soc,0).'</b>';
if ($type == 1) $s.=$langs->trans("Example").': <b>'.$this->getExample($langs,$soc,1).'</b>';
return $s;
}
}

View File

@ -228,6 +228,7 @@ AllocateCommercial=Allocate a commercial
SelectCountry=Select a country
SelectCompany=Select a third party
Organization=Organization
AutomaticallyGenerated=Automatically generated
# Tigre
TigreNumRefModelDesc1=Return a customizable customer/supplier number according to a defined mask.

View File

@ -231,6 +231,7 @@ AllocateCommercial=Affecter un commercial
SelectCountry=Sélectionner un pays
SelectCompany=Sélectionner un tiers
Organization=Organisme
AutomaticallyGenerated=Généré automatiquement
# Tigre
TigreNumRefModelDesc1=Renvoie un code client/fournisseur personnalisable selon un masque à définir.