Fxi: Translate country in region list.
This commit is contained in:
parent
a97d0941a9
commit
c6c1e1f993
@ -270,29 +270,32 @@ class FormCompany
|
|||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
$langs->load("dict");
|
$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 = "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 libelle_pays, libelle ASC";
|
$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);
|
dol_syslog("Form::select_region sql=".$sql);
|
||||||
if ($this->db->query($sql))
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
print '<select class="flat" name="'.$htmlname.'">';
|
||||||
$num = $this->db->num_rows();
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$pays='';
|
$pays='';
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object();
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($obj->code == 0) {
|
if ($obj->code == 0) {
|
||||||
print '<option value="0"> </option>';
|
print '<option value="0"> </option>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($pays == '' || $pays != $obj->libelle_pays)
|
if ($pays == '' || $pays != $obj->libelle_pays)
|
||||||
{
|
{
|
||||||
// Affiche la rupture
|
// Show break
|
||||||
print '<option value="-1" disabled="disabled">----- '.$obj->libelle_pays." -----</option>\n";
|
$key=$langs->trans("Country".strtoupper($obj->pays_code));
|
||||||
|
$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->libelle_pays;
|
||||||
|
print '<option value="-1" disabled="disabled">----- '.$valuetoshow." -----</option>\n";
|
||||||
$pays=$obj->libelle_pays;
|
$pays=$obj->libelle_pays;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user