diff --git a/htdocs/soc.php b/htdocs/soc.php index 0eceb060d9a..78f66fa522c 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -488,61 +488,48 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || print ''.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->monnaie).''; - if ($soc->pays_code == 'FR') - { - $maxlength1=9; - $maxlength2=14; - $maxlength3=5; - $maxlength4=12; - } - - // Id prof - print ''.($langs->transcountry("ProfId1",$soc->pays_code) != '-'?$langs->transcountry('ProfId1',$soc->pays_code):'').''; - if ($soc->pays_id) - { - if ($langs->transcountry("ProfId1",$soc->pays_code) != '-') print ''; - else print ' '; - } - else - { - print $countrynotdefined; - } - print ''; - print ''.($langs->transcountry("ProfId2",$soc->pays_code) != '-'?$langs->transcountry('ProfId2',$soc->pays_code):'').''; - if ($soc->pays_id) - { - if ($langs->transcountry("ProfId2",$soc->pays_code) != '-') print ''; - else print ' '; - } - else - { - print $countrynotdefined; - } - print ''; - - print ''.($langs->transcountry("ProfId3",$soc->pays_code) != '-'?$langs->transcountry('ProfId3',$soc->pays_code):'').''; - if ($soc->pays_id) - { - if ($langs->transcountry("ProfId3",$soc->pays_code) != '-') print ''; - else print ' '; - } - else - { - print $countrynotdefined; - } - print ''; - print ''.($langs->transcountry("ProfId4",$soc->pays_code) != '-'?$langs->transcountry('ProfId4',$soc->pays_code):'').''; - if ($soc->pays_id) - { - if ($langs->transcountry("ProfId4",$soc->pays_code) != '-') print ''; - else print ' '; - } - else - { - print $countrynotdefined; - } - print ''; + print ''; + // IdProf1 (SIREN pour France) + $idprof=$langs->transcountry('ProfId1',$soc->pays_code); + if ($idprof!='-') + { + print ''.$idprof.''; + $soc->show_input_id_prof(1,'idprof1',$soc->siren); + print ''; + } + else print '  '; + // IdProf2 (SIRET pour France) + $idprof=$langs->transcountry('ProfId2',$soc->pays_code); + if ($idprof!='-') + { + print ''.$idprof.''; + $soc->show_input_id_prof(2,'idprof2',$soc->siret); + print ''; + } + else print '  '; + print ''; + print ''; + // IdProf3 (APE pour France) + $idprof=$langs->transcountry('ProfId3',$soc->pays_code); + if ($idprof!='-') + { + print ''.$idprof.''; + $soc->show_input_id_prof(3,'idprof3',$soc->ape); + print ''; + } + else print '  '; + // IdProf4 (NU pour France) + $idprof=$langs->transcountry('ProfId4',$soc->pays_code); + if ($idprof!='-') + { + print ''.$idprof.''; + $soc->show_input_id_prof(4,'idprof4',$soc->idprof4); + print ''; + } + else print '  '; + print ''; + // Forme juridique print ''.$langs->trans('JuridicalStatus').''; print ''; diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index d2779dd3fe6..75f9b0192da 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -1835,8 +1835,9 @@ class Societe extends CommonObject * \brief Retourne le formulaire de saisie d'un identifiant professionnel (siren, siret, etc...) * \param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) * \param htmlname Nom de la zone input + * \param preselected Default value to show */ - function show_input_id_prof($idprof,$htmlname) + function show_input_id_prof($idprof,$htmlname,$preselected) { global $langs; @@ -1848,11 +1849,11 @@ class Societe extends CommonObject if ($idprof==3) $formlength=5; // 4 chiffres et 1 lettre depuis janvier if ($idprof==4) $formlength=12; } - $selected=''; - if ($idprof==1) $selected=$soc->siren; - if ($idprof==2) $selected=$soc->siret; - if ($idprof==3) $selected=$soc->ape; - if ($idprof==4) $selected=$soc->idprof4; + $selected=$preselected; + if (! $selected && $idprof==1) $selected=$this->siren; + if (! $selected && $idprof==2) $selected=$this->siret; + if (! $selected && $idprof==3) $selected=$this->ape; + if (! $selected && $idprof==4) $selected=$this->idprof4; print ''; }