From 7688e44b2a258bd8bc76c8c9a68630e91e198d61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2011 18:34:56 +0100 Subject: [PATCH] Uniformize field country_id, country_code, country --- htdocs/admin/company.php | 170 +++++++++++++++++----------------- htdocs/compta/dons/fiche.php | 8 +- htdocs/core/ajax/ziptown.php | 1 - htdocs/core/lib/ajax.lib.php | 2 +- htdocs/public/members/new.php | 30 +++--- 5 files changed, 105 insertions(+), 106 deletions(-) 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".'