diff --git a/application/WarehouseShippingNote/WarehouseShippingNoteController.php b/application/WarehouseShippingNote/WarehouseShippingNoteController.php index 084e286ff..f5136e396 100644 --- a/application/WarehouseShippingNote/WarehouseShippingNoteController.php +++ b/application/WarehouseShippingNote/WarehouseShippingNoteController.php @@ -438,11 +438,10 @@ class WarehouseShippingNoteController extends TTCrud { protected function geoAutocompleteAction() { $search = $this->request->q; $search = urlencode($search); - $url = "https://nominatim.haid.in/search?q=$search&format=json"; + $url = "https://nominatim.haid.in/search?q=$search&format=json&addressdetails=1"; $data = json_decode(file_get_contents($url), true); $out = []; - foreach ($data as $entry) { $parsedDisplayNameParts = []; foreach (explode(',', $entry['display_name']) as $part) { @@ -460,7 +459,7 @@ class WarehouseShippingNoteController extends TTCrud { } } } - $out[] = ['value' => $entry['lat'] . "," . $entry['lon'] . (!isset($entry['house_number']) ? ", area" : ""), 'text' => implode(',', $parsedDisplayNameParts)]; + $out[] = ['value' => $entry['lat'] . "," . $entry['lon'] . (!isset($entry['address']['house_number']) ? ", area" : ""), 'text' => implode(',', $parsedDisplayNameParts)]; }