From 0f9e8b22abb0d70a8573a13161436cc12527ce32 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 6 Nov 2007 15:29:55 +0000 Subject: [PATCH] Uniformisation du code --- .../modules/societe/mod_codeclient_tigre.php | 26 +++++++++---------- .../modules/societe/modules_societe.class.php | 3 ++- htdocs/langs/en_US/companies.lang | 1 + htdocs/langs/fr_FR/companies.lang | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/htdocs/includes/modules/societe/mod_codeclient_tigre.php b/htdocs/includes/modules/societe/mod_codeclient_tigre.php index d7900c8e06f..8902370b12a 100644 --- a/htdocs/includes/modules/societe/mod_codeclient_tigre.php +++ b/htdocs/includes/modules/societe/mod_codeclient_tigre.php @@ -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)."
".$this->getNextValue($objsoc,2); + $example = $this->getNextValue($objsoc,0)."
".$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; } diff --git a/htdocs/includes/modules/societe/modules_societe.class.php b/htdocs/includes/modules/societe/modules_societe.class.php index fbefae34f80..8dcbf1cb601 100644 --- a/htdocs/includes/modules/societe/modules_societe.class.php +++ b/htdocs/includes/modules/societe/modules_societe.class.php @@ -132,7 +132,8 @@ class ModeleThirdPartyCode $s.=$langs->trans("CanBeModifiedIfOk").': '.yn($this->code_modifiable).'
'; $s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide).'
'; $s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto).'
'; - if ($type != -1) $s.=$langs->trans("Example").': '.$this->getExample($langs,$soc,1).''; + if ($type == 0) $s.=$langs->trans("Example").': '.$this->getExample($langs,$soc,0).''; + if ($type == 1) $s.=$langs->trans("Example").': '.$this->getExample($langs,$soc,1).''; return $s; } } diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 95f201bbb9e..dd622dc5c9c 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -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. diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 761ee42db94..c2d4c439e15 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -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.