From: x2001corpet Date: Mon, 18 Sep 2006 18:15:45 +0000 (+0000) Subject: mettre a jour la table des cartes de chaque ville quand on en introduit une nouvelle... X-Git-Tag: xorg/0.9.11~70 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=7f3ac0073be0e173f9271ad31c207444b3c6a1ff;p=platal.git mettre a jour la table des cartes de chaque ville quand on en introduit une nouvelle (evite de faire de l'admin a la main regulierement) git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@849 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php index 77399e5..4ba4410 100644 --- a/include/geoloc.inc.php +++ b/include/geoloc.inc.php @@ -89,7 +89,8 @@ function get_address_infos($txt) { if ($infos['sql']) XDB::execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']); if ($infos['display']) - XDB::execute("UPDATE geoloc_pays SET display = {?} WHERE a2 = {?}", $infos['display'], $infos['country']); + XDB::execute("UPDATE geoloc_pays SET display = {?} WHERE a2 = {?}", $infos['display'], $infos['country']); + fix_cities_not_on_map(1, $infos['cityid']); return $infos; } // }}} @@ -268,9 +269,9 @@ function localize_addresses($uid) { // }}} // {{{ function fix_cities_not_on_map($limit) -function fix_cities_not_on_map($limit=false) +function fix_cities_not_on_map($limit=false, $cityid=false) { - $missing = XDB::query("SELECT c.id FROM geoloc_city AS c LEFT JOIN geoloc_city_in_maps AS m ON(c.id = m.city_id) WHERE m.city_id IS NULL".($limit?" LIMIT $limit":"")); + $missing = XDB::query("SELECT c.id FROM geoloc_city AS c LEFT JOIN geoloc_city_in_maps AS m ON(c.id = m.city_id) WHERE m.city_id IS NULL".($cityid?(" AND c.id = '".$cityid."'"):"").($limit?" LIMIT $limit":"")); $maps = get_cities_maps($missing->fetchColumn()); if ($maps) {