Fix: change the content of county select if country is different
This commit is contained in:
parent
049a32312e
commit
bbbad66194
@ -30,7 +30,7 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
|||||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||||
|
|
||||||
require('../main.inc.php');
|
require('../main.inc.php');
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -52,6 +52,7 @@ dol_syslog(join(',',$_GET));
|
|||||||
if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
|
if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
|
||||||
{
|
{
|
||||||
$return_arr = array();
|
$return_arr = array();
|
||||||
|
$formcompany = new FormCompany($db);
|
||||||
|
|
||||||
// Define filter on text typed
|
// Define filter on text typed
|
||||||
$zipcode = $_GET['zipcode']?$_GET['zipcode']:'';
|
$zipcode = $_GET['zipcode']?$_GET['zipcode']:'';
|
||||||
@ -121,6 +122,8 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
|
|||||||
$row_array['selectpays_id'] = $row['fk_country'];
|
$row_array['selectpays_id'] = $row['fk_country'];
|
||||||
$row_array['departement_id'] = $row['fk_county'];
|
$row_array['departement_id'] = $row['fk_county'];
|
||||||
|
|
||||||
|
$row_array['countydata'] = $formcompany->select_state('',$row['fk_country'],'');
|
||||||
|
|
||||||
array_push($return_arr,$row_array);
|
array_push($return_arr,$row_array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -223,7 +223,7 @@ class FormCompany
|
|||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
|
if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
|
||||||
if ($pays_code) $out.= '<option value="0"> </option>';
|
if ($pays_code) $out.= '<option value="0"> </option>';
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -264,8 +264,9 @@ class FormCompany
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.= '</select>';
|
$noselect.=$out;
|
||||||
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
if (!empty($htmlname)) $out.= '</select>';
|
||||||
|
if (!empty($htmlname) && $user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -172,9 +172,12 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='')
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
|
if (ui.item.countydata) {
|
||||||
|
jQuery("#departement_id").html(ui.item.countydata);
|
||||||
|
}
|
||||||
for (i=0;i<length;i++) {
|
for (i=0;i<length;i++) {
|
||||||
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
||||||
if (ui.item[fields[i]]) {
|
if (ui.item[fields[i]]) {
|
||||||
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
|
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user