geolocation: don't empty housenumber if not found in reverse (#50709)
This commit is contained in:
parent
09b7161ae9
commit
5d03ea1f89
|
@ -24,10 +24,12 @@ function geoloc_prefill(element_type, element_value)
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('set-geolocation', function(event, coords) {
|
||||
$(document).on('set-geolocation', function(event, coords, options) {
|
||||
$.getJSON(WCS_ROOT_URL + '/api/reverse-geocoding?lat=' + coords.lat + '&lon=' + coords.lng, function(data) {
|
||||
unset_sync_callback()
|
||||
geoloc_prefill('house', data.address.house_number);
|
||||
if (typeof(options) == 'undefined' || !options.force_house_number === false || data.address.house_number) {
|
||||
geoloc_prefill('house', data.address.house_number);
|
||||
}
|
||||
var number_and_street = null;
|
||||
var street = data.address.road;
|
||||
if (!street && data.address.pedestrian) {
|
||||
|
@ -149,7 +151,7 @@ function geoloc_prefill(element_type, element_value)
|
|||
map.marker = L.marker([0, 0]);
|
||||
map.marker.addTo(map);
|
||||
}
|
||||
$map.trigger('set-geolocation', coords, {'trigger': false});
|
||||
$map.trigger('set-geolocation', [coords, {'trigger': false, 'force_house_number': false}]);
|
||||
$form[0].wait_for_changes = false;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue