}
}
if (isset($infos['sql']) && $infos['sql'])
- XDB::execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']);
+ XDB::execute("REPLACE INTO geoloc_city
+ VALUES ".$infos['sql']);
if (isset($infos['display']) && $infos['display'])
- XDB::execute("UPDATE geoloc_pays SET display = {?} WHERE a2 = {?}", $infos['display'], $infos['country']);
- if (isset($infos['cityid']))
+ XDB::execute("UPDATE geoloc_pays
+ SET display = {?}
+ WHERE a2 = {?}", $infos['display'], $infos['country']);
+ if (isset($infos['cityid'])) {
fix_cities_not_on_map(1, $infos['cityid']);
+ if (floatval($infos['precise_lat']) && floatval($infos['precise_lon'])) {
+ $res = XDB::query("SELECT c.lat / 100000, c.lon / 100000
+ FROM geoloc_city AS c
+ WHERE c.id = {?}", $infos['cityid']);
+ if ($res->numRows()) {
+ list($glat, $glng) = $res->fetchOneRow();
+ $infos['precise_lat'] = $glat;
+ $infos['precise_lon'] = $glng;
+ }
+ }
+ }
return $infos;
}
// }}}
"region" => "",
"regiontxt" => "",
"country" => "00",
- "countrytxt" => "");
+ "countrytxt" => "",
+ "precise_lat" => "",
+ "precise_lon" => "");
}
// create a simple address from a text without geoloc
postcode, city, cityid,
country, region, regiontxt,
pub, datemaj, statut,
- uid, adrid)
+ uid, adrid, glat, glng)
VALUES ({?}, {?}, {?},
{?}, {?}, {?},
{?}, {?}, {?},
{?}, FROM_UNIXTIME({?}), {?},
- {?}, {?})",
+ {?}, {?}, {?}, {?})",
$address['adr1'], $address['adr2'], $address['adr3'],
$address['postcode'], $address['city'], $address['cityid'],
$address['country'], $address['region'], $address['regiontxt'],
$address['pub'], $address['datemaj'], $flags,
- S::i('uid'), $adrid);
+ S::i('uid'), $adrid, $address['precise_lat'], $address['precise_lon']);
foreach ($address['tel'] as $telid=>&$tel) {
$this->saveTel($adrid, $telid, $tel);
}
FIND_IN_SET('res-secondaire', a.statut) AS secondaire,
FIND_IN_SET('courrier', a.statut) AS mail,
FIND_IN_SET('temporaire', a.statut) AS temporary,
- FIND_IN_SET('active', a.statut) AS current
+ FIND_IN_SET('active', a.statut) AS current,
+ a.glat AS precise_lat, a.glng AS precise_lon
FROM adresses AS a
INNER JOIN geoloc_pays AS gp ON(gp.a2 = a.country)
WHERE uid = {?} AND NOT FIND_IN_SET('pro', statut)
fonction, poste, adr1, adr2, adr3, postcode,
city, cityid, country, region, regiontxt,
tel, fax, mobile, email, web,
- pub, adr_pub, tel_pub, email_pub, flags)
+ pub, adr_pub, tel_pub, email_pub, flags,
+ glat, glng)
VALUES ({?}, {?}, {?}, {?}, {?},
{?}, {?}, {?}, {?}, {?}, {?},
{?}, {?}, {?}, {?}, {?},
{?}, {?}, {?}, {?}, {?},
- {?}, {?}, {?}, {?}, {?})",
+ {?}, {?}, {?}, {?}, {?},
+ {?}, {?})",
S::i('uid'), $i++, $job['name'], $job['secteur'], $job['ss_secteur'],
$job['fonction'], $job['poste'], $job['adr']['adr1'], $job['adr']['adr2'], $job['adr']['adr3'],
$job['adr']['postcode'],
$job['adr']['regiontxt'],
$job['tel'], $job['fax'], $job['mobile'], $job['email'], $job['web'],
$job['pub'], $job['adr']['pub'], $job['tel_pub'], $job['email_pub'],
- $job['adr']['checked'] ? 'geoloc' : '');
+ $job['adr']['checked'] ? 'geoloc' : '', $job['adr']['precise_lat'],
+ $job['adr']['precise_lon']);
}
}
}
e.country, gp.pays, gp.display,
FIND_IN_SET('geoloc', flags),
e.tel, e.fax, e.mobile, e.email, e.web, e.pub,
- e.adr_pub, e.tel_pub, e.email_pub
+ e.adr_pub, e.tel_pub, e.email_pub,
+ e.glat AS precise_lat, e.glng AS precise_lon
FROM entreprises AS e
INNER JOIN geoloc_pays AS gp ON(gp.a2 = e.country)
WHERE uid = {?} AND entreprise != ''
$adr1, $adr2, $adr3, $postcode, $city, $cityid,
$region, $regiontxt, $country, $countrytxt, $display,
$checked, $tel, $fax, $mobile, $email, $web,
- $pub, $adr_pub, $tel_pub, $email_pub) = $res->next()) {
+ $pub, $adr_pub, $tel_pub, $email_pub, $glat, $glng) = $res->next()) {
$this->values['jobs'][] = array('name' => $name,
'secteur' => $secteur,
'ss_secteur' => $ss_secteur,
'countrytxt' => $countrytxt,
'display' => $display,
'pub' => $adr_pub,
- 'checked' => $checked),
+ 'checked' => $checked,
+ 'precise_lat'=> $glat,
+ 'precise_lon'=> $glng),
'tel' => $tel,
'fax' => $fax,
'mobile' => $mobile,