Fix select zip/town
This commit is contained in:
parent
f96dd391fa
commit
33f0172603
@ -120,6 +120,7 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
|
|||||||
$row_array['selectcountry_id'] = $row['fk_country'];
|
$row_array['selectcountry_id'] = $row['fk_country'];
|
||||||
$row_array['state_id'] = $row['fk_county'];
|
$row_array['state_id'] = $row['fk_county'];
|
||||||
|
|
||||||
|
// TODO Use a cache here to avoid to make select_state in each pass (this make a SQL and lot of logs)
|
||||||
$row_array['states'] = $formcompany->select_state('',$row['fk_country'],'');
|
$row_array['states'] = $formcompany->select_state('',$row['fk_country'],'');
|
||||||
|
|
||||||
array_push($return_arr,$row_array);
|
array_push($return_arr,$row_array);
|
||||||
|
|||||||
@ -203,7 +203,7 @@ class FormCompany
|
|||||||
*
|
*
|
||||||
* @param string $selected Code state preselected (mus be state id)
|
* @param string $selected Code state preselected (mus be state id)
|
||||||
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
|
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
|
||||||
* @param string $htmlname Id of department
|
* @param string $htmlname Id of department. If '', we want only the string with <option>
|
||||||
* @return string String with HTML select
|
* @return string String with HTML select
|
||||||
* @see select_country
|
* @see select_country
|
||||||
*/
|
*/
|
||||||
@ -217,7 +217,7 @@ class FormCompany
|
|||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
// On recherche les departements/cantons/province active d'une region et pays actif
|
// Serch departements/cantons/province active d'une region et pays actif
|
||||||
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
|
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
|
||||||
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
|
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
|
||||||
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
|
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
|
||||||
@ -226,7 +226,6 @@ class FormCompany
|
|||||||
if ($country_codeid && ! is_numeric($country_codeid)) $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
|
if ($country_codeid && ! is_numeric($country_codeid)) $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
|
||||||
$sql .= " ORDER BY c.code, d.code_departement";
|
$sql .= " ORDER BY c.code, d.code_departement";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_departement", LOG_DEBUG);
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -298,9 +297,12 @@ class FormCompany
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make select dynamic
|
// Make select dynamic
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
if (! empty($htmlname))
|
||||||
$out .= ajax_combobox($htmlname);
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
|
$out .= ajax_combobox($htmlname);
|
||||||
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user