diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index aa4d44d00a3..182b46f085d 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -36,8 +36,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
$langs->load("admin");
$langs->load("companies");
-if (!$user->admin)
-accessforbidden();
+if (!$user->admin) accessforbidden();
/*
@@ -49,11 +48,11 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["c
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
- $new_pays_id=$_POST["pays_id"];
- $new_pays_code=getCountry($new_pays_id,2);
- $new_pays_label=getCountry($new_pays_id,0);
+ $new_country_id=$_POST["country_id"];
+ $new_country_code=getCountry($new_country_id,2);
+ $new_country_label=getCountry($new_country_id,0);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS", $new_pays_id.':'.$new_pays_code.':'.$new_pays_label,'chaine',0,'',$conf->entity);
+ 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_NOM",$_POST["nom"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"],'chaine',0,'',$conf->entity);
@@ -233,27 +232,28 @@ $formcompany=new FormCompany($db);
$countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
-// We define pays_id, pays_code and pays_label
+// We define country_id, country_code and pays_label
if (! empty($conf->global->MAIN_INFO_SOCIETE_PAYS))
{
$tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS);
- $pays_id=$tmp[0];
+ $country_id=$tmp[0];
if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_PAYS is "id:code:label"
{
- $pays_code=$tmp[1];
- $pays_label=$tmp[2];
+ $country_code=$tmp[1];
+ $country=$tmp[2];
}
else
{
- $pays_code=getCountry($pays_id,2);
- $pays_label=getCountry($pays_id,0);
+ $tmparray=getCountry($country_id,'all');
+ $country_code=$tmparray['code'];
+ $country=$tmparray['label'];
}
}
else
{
- $pays_id=0;
- $pays_code='';
- $pays_label='';
+ $country_id=0;
+ $country_code='';
+ $country='';
}
@@ -270,7 +270,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
*/
print "\n".'