diff --git a/htdocs/html.formcompany.class.php b/htdocs/html.formcompany.class.php index 6a5035b126a..bd5c52bac4c 100644 --- a/htdocs/html.formcompany.class.php +++ b/htdocs/html.formcompany.class.php @@ -188,9 +188,9 @@ class FormCompany function select_departement($selected='',$pays_code=0) { global $conf,$langs,$user; - + dol_syslog("Form::select_departement selected=$selected, pays_code=$pays_code",LOG_DEBUG); - + $langs->load("dict"); $htmlname='departement_id'; @@ -270,29 +270,32 @@ class FormCompany global $conf,$langs; $langs->load("dict"); - $sql = "SELECT r.rowid, r.code_region as code, r.nom as libelle, r.active, p.libelle as libelle_pays FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE r.fk_pays=p.rowid AND r.active = 1 and p.active = 1 ORDER BY libelle_pays, libelle ASC"; + $sql = "SELECT r.rowid, r.code_region as code, r.nom as libelle, r.active, p.code as pays_code, p.libelle as libelle_pays FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE r.fk_pays=p.rowid AND r.active = 1 and p.active = 1 ORDER BY pays_code, libelle ASC"; dol_syslog("Form::select_region sql=".$sql); - if ($this->db->query($sql)) + $resql=$this->db->query($sql); + if ($resql) { print '