diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 789d4f7361d..e44274a94c2 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -51,11 +51,11 @@ if ( ($action == 'update' && empty($_POST["cancel"])) { require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); - $new_country_id=$_POST["country_id"]; - $new_country_code=getCountry($new_country_id,2); - $new_country_label=getCountry($new_country_id,0); + $mysoc->country_id=$_POST["country_id"]; + $mysoc->country_code=getCountry($mysoc->country_id,2); + $mysoc->country_label=getCountry($mysoc->country_id,0); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS", $new_country_id.':'.$new_country_code.':'.$new_country_label,'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS", $mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"],'chaine',0,'',$conf->entity); @@ -236,31 +236,6 @@ $formcompany=new FormCompany($db); $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -// We define country_id, country_code and country -if (! empty($conf->global->MAIN_INFO_SOCIETE_PAYS)) -{ - $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS); - $country_id=$tmp[0]; - if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_PAYS is "id:code:label" - { - $country_code=$tmp[1]; - $country=$tmp[2]; - } - else - { - $tmparray=getCountry($country_id,'all'); - $country_code=$tmparray['code']; - $country=$tmparray['label']; - } -} -else -{ - $country_id=0; - $country_code=''; - $country=''; -} - - print_fiche_titre($langs->trans("CompanyFoundation"),'','setup'); print $langs->trans("CompanyFundationDesc")."
\n"; @@ -307,15 +282,14 @@ if ($action == 'edit' || $action == 'updateedit') // Country $var=!$var; print ''.$langs->trans("Country").''; - $pays_selected=$country_id; //if (empty($pays_selected)) $pays_selected=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation - print $form->select_country($pays_selected,'country_id'); + print $form->select_country($mysoc->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''."\n"; $var=!$var; print ''.$langs->trans("State").''; - $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT,$country_code,'departement_id'); + $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT,$mysoc->country_code,'departement_id'); print ''."\n"; $var=!$var; @@ -400,9 +374,9 @@ if ($action == 'edit' || $action == 'updateedit') // Forme juridique $var=!$var; print ''.$langs->trans("JuridicalStatus").''; - if ($country_code) + if ($mysoc->country_code) { - $formcompany->select_forme_juridique($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,$country_code); + $formcompany->select_forme_juridique($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,$mysoc->country_code); } else { @@ -411,11 +385,11 @@ if ($action == 'edit' || $action == 'updateedit') print ''; // ProfID1 - if ($langs->transcountry("ProfId1",$country_code) != '-') + if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId1",$country_code).''; - if ($country_code) + print ''.$langs->transcountry("ProfId1",$mysoc->country_code).''; + if ($mysoc->country_code) { print ''; } @@ -427,11 +401,11 @@ if ($action == 'edit' || $action == 'updateedit') } // ProfId2 - if ($langs->transcountry("ProfId2",$country_code) != '-') + if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId2",$country_code).''; - if ($country_code) + print ''.$langs->transcountry("ProfId2",$mysoc->country_code).''; + if ($mysoc->country_code) { print ''; } @@ -443,11 +417,11 @@ if ($action == 'edit' || $action == 'updateedit') } // ProfId3 - if ($langs->transcountry("ProfId3",$country_code) != '-') + if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId3",$country_code).''; - if ($country_code) + print ''.$langs->transcountry("ProfId3",$mysoc->country_code).''; + if ($mysoc->country_code) { print ''; } @@ -459,11 +433,11 @@ if ($action == 'edit' || $action == 'updateedit') } // ProfId4 - if ($langs->transcountry("ProfId4",$country_code) != '-') + if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId4",$country_code).''; - if ($country_code) + print ''.$langs->transcountry("ProfId4",$mysoc->country_code).''; + if ($mysoc->country_code) { print ''; } @@ -475,11 +449,11 @@ if ($action == 'edit' || $action == 'updateedit') } // ProfId5 - if ($langs->transcountry("ProfId5",$country_code) != '-') + if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId5",$country_code).''; - if ($country_code) + print ''.$langs->transcountry("ProfId5",$mysoc->country_code).''; + if ($mysoc->country_code) { print ''; } @@ -491,11 +465,11 @@ if ($action == 'edit' || $action == 'updateedit') } // ProfId6 - if ($langs->transcountry("ProfId6",$country_code) != '-') + if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId6",$country_code).''; - if ($country_code) + print ''.$langs->transcountry("ProfId6",$mysoc->country_code).''; + if ($mysoc->country_code) { print ''; } @@ -566,32 +540,32 @@ if ($action == 'edit' || $action == 'updateedit') /* * Local Taxes */ - if ($country_code=='ES') + if ($mysoc->country_code=='ES') { // Local Tax 1 print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; $var=true; $var=!$var; - print ""; + print ""; print '\n"; $var=!$var; - print ""; + print ""; print '\n"; print "
'.$langs->transcountry("LocalTax1Management",$country_code).''.$langs->trans("Description").''.$langs->transcountry("LocalTax1Management",$mysoc->country_code).''.$langs->trans("Description").' 
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax1IsUsedDesc",$country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$country_code)."
".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."
"; print "
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax1IsNotUsedDesc",$country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$country_code)."
".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."
"; print "
"; @@ -600,26 +574,26 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; $var=true; $var=!$var; - print ""; + print ""; print '\n"; $var=!$var; - print ""; + print ""; print '\n"; print "
'.$langs->transcountry("LocalTax2Management",$country_code).''.$langs->trans("Description").''.$langs->transcountry("LocalTax2Management",$mysoc->country_code).''.$langs->trans("Description").' 
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax2IsUsedDesc",$country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$country_code)."
".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."
"; print "
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax2IsNotUsedDesc",$country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$country_code)."
".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."
"; print "
"; @@ -669,11 +643,11 @@ else $var=!$var; print ''.$langs->trans("CompanyCountry").''; - if ($country_code) + if ($mysoc->country_code) { - $img=picto_from_langcode($country_code); + $img=picto_from_langcode($mysoc->country_code); print $img?$img.' ':''; - print getCountry($country_code,1); + print getCountry($mysoc->country_code,1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; print ''; @@ -763,24 +737,24 @@ else print ''; // ProfId1 - if ($langs->transcountry("ProfId1",$country_code) != '-') + if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId1",$country_code).''; - if ($langs->transcountry("ProfId1",$country_code) != '-') + print ''.$langs->transcountry("ProfId1",$mysoc->country_code).''; + if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { print $conf->global->MAIN_INFO_SIREN; - if ($conf->global->MAIN_INFO_SIREN && $country_code == 'FR') print '   '.$langs->trans("Check").''; + if ($conf->global->MAIN_INFO_SIREN && $mysoc->country_code == 'FR') print '   '.$langs->trans("Check").''; } print ''; } // ProfId2 - if ($langs->transcountry("ProfId2",$country_code) != '-') + if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId2",$country_code).''; - if ($langs->transcountry("ProfId2",$country_code) != '-') + print ''.$langs->transcountry("ProfId2",$mysoc->country_code).''; + if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { print $conf->global->MAIN_INFO_SIRET; } @@ -788,11 +762,11 @@ else } // ProfId3 - if ($langs->transcountry("ProfId3",$country_code) != '-') + if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId3",$country_code).''; - if ($langs->transcountry("ProfId3",$country_code) != '-') + print ''.$langs->transcountry("ProfId3",$mysoc->country_code).''; + if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { print $conf->global->MAIN_INFO_APE; } @@ -800,11 +774,11 @@ else } // ProfId4 - if ($langs->transcountry("ProfId4",$country_code) != '-') + if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId4",$country_code).''; - if ($langs->transcountry("ProfId4",$country_code) != '-') + print ''.$langs->transcountry("ProfId4",$mysoc->country_code).''; + if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { print $conf->global->MAIN_INFO_RCS; } @@ -812,11 +786,11 @@ else } // ProfId5 - if ($langs->transcountry("ProfId5",$country_code) != '-') + if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId5",$country_code).''; - if ($langs->transcountry("ProfId5",$country_code) != '-') + print ''.$langs->transcountry("ProfId5",$mysoc->country_code).''; + if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { print $conf->global->MAIN_INFO_PROFID5; } @@ -824,11 +798,11 @@ else } // ProfId6 - if ($langs->transcountry("ProfId6",$country_code) != '-') + if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { $var=!$var; - print ''.$langs->transcountry("ProfId6",$country_code).''; - if ($langs->transcountry("ProfId6",$country_code) != '-') + print ''.$langs->transcountry("ProfId6",$mysoc->country_code).''; + if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { print $conf->global->MAIN_INFO_PROFID6; } @@ -928,32 +902,32 @@ else /* * Local Taxes */ - if ($country_code=='ES') + if ($mysoc->country_code=='ES') { // Local Tax 1 print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; $var=true; $var=!$var; - print ""; + print ""; print '\n"; $var=!$var; - print ""; + print ""; print '\n"; @@ -963,26 +937,26 @@ else print '
'; print '
'.$langs->transcountry("LocalTax1Management",$country_code).''.$langs->trans("Description").''.$langs->transcountry("LocalTax1Management",$mysoc->country_code).''.$langs->trans("Description").' 
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax1IsUsedDesc",$country_code)."
".$langs->trans("Example",$country_code).': '.$langs->transcountry("LocalTax1IsUsedExample",$country_code)."
".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."
".$langs->trans("Example",$mysoc->country_code).': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."
"; print "
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax1IsNotUsedDesc",$country_code)."
".$langs->trans("Example",$country_code).': '.$langs->transcountry("LocalTax1IsNotUsedExample",$country_code)."
".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."
".$langs->trans("Example",$mysoc->country_code).': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."
"; print "
'; print ''; - print ''; + print ''; print ''; print "\n"; $var=true; $var=!$var; - print ""; + print ""; print '\n"; $var=!$var; - print ""; + print ""; print '\n";
'.$langs->transcountry("LocalTax2Management",$country_code).''.$langs->trans("Description").''.$langs->transcountry("LocalTax2Management",$mysoc->country_code).''.$langs->trans("Description").' 
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax2IsUsedDesc",$country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$country_code)."
".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."
"; print "
'; print ""; - print ""; - print "\n"; + print ""; + print "\n"; print "
".$langs->transcountry("LocalTax2IsNotUsedDesc",$country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$country_code)."
".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."
"; print "