feat: gestione geolocalizzazione
This commit is contained in:
parent
68643ab1be
commit
f5244ff946
|
@ -23,6 +23,7 @@ if (!function_exists('geolocalizzazione')) {
|
|||
function geolocalizzazione($id_record, $is_sede = false)
|
||||
{
|
||||
$dbo = database();
|
||||
$lang = \Models\Locale::find(setting('Lingua'))->language_code;
|
||||
|
||||
if ($is_sede) {
|
||||
$sede = $dbo->table('an_sedi')->where('id', $id_record)->first();
|
||||
|
@ -69,6 +70,7 @@ if (!function_exists('geolocalizzazione')) {
|
|||
} else {
|
||||
$ch = curl_init();
|
||||
}
|
||||
|
||||
$url = 'https://nominatim.openstreetmap.org/search.php?q='.$indirizzo.'&format=jsonv2&accept-language='.$lang;
|
||||
$user_agent = 'traccar';
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
||||
|
|
|
@ -462,6 +462,8 @@ class Anagrafica extends Model
|
|||
} else {
|
||||
$ch = curl_init();
|
||||
}
|
||||
|
||||
$lang = \Models\Locale::find(setting('Lingua'))->language_code;
|
||||
$url = 'https://nominatim.openstreetmap.org/search.php?q='.$indirizzo.'&format=jsonv2&accept-language='.$lang;
|
||||
$user_agent = 'traccar';
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
||||
|
|
|
@ -106,6 +106,8 @@ class Sede extends Model
|
|||
} else {
|
||||
$ch = curl_init();
|
||||
}
|
||||
|
||||
$lang = \Models\Locale::find(setting('Lingua'))->language_code;
|
||||
$url = 'https://nominatim.openstreetmap.org/search.php?q='.$indirizzo.'&format=jsonv2&accept-language='.$lang;
|
||||
$user_agent = 'traccar';
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
||||
|
|
Loading…
Reference in New Issue