Gets rid of all references to the old geoloc_* and adresses tables.
[platal.git] / modules / profile.php
index 4583907..60747e5 100644 (file)
@@ -650,11 +650,11 @@ class ProfileModule extends PLModule
         $page->assign_by_ref('secteurs', $secteurs);
         $page->assign_by_ref('ss_secteurs', $ss_secteurs);
 
-        //pays
+        // Countries.
         $res = XDB::query(
-                "SELECT  gp.pays
+                "SELECT  gc.countryFR
                    FROM  profile_mentor_country AS m
-              LEFT JOIN  geoloc_pays            AS gp ON (m.country = gp.a2)
+              LEFT JOIN  geoloc_countries       AS gc ON (m.country = gc.iso_3166_1_a2)
                   WHERE  uid = {?}", $user->id());
         $page->assign('pays', $res->fetchColumn());
 
@@ -735,13 +735,13 @@ class ProfileModule extends PLModule
         $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('name', 'pays_sel');
         $where = ($ssect ? ' AND ms.subsectorid = {?}' : '');
-        $it = XDB::iterator("SELECT  a2 AS id, pays AS field
-                               FROM  geoloc_pays            AS g
-                         INNER JOIN  profile_mentor_country AS mp ON (mp.country = g.a2)
+        $it = XDB::iterator("SELECT  gc.iso_3166_1_a2 AS id, gc.countryFR AS field
+                               FROM  geoloc_countries       AS gc
+                         INNER JOIN  profile_mentor_country AS mp ON (mp.country = gc.iso_3166_1_a2)
                          INNER JOIN  profile_mentor_sector  AS ms ON (ms.uid = mp.uid)
-                              WHERE  ms.sectorid = {?} $where
-                           GROUP BY  a2
-                           ORDER BY  pays", $sect, $ssect);
+                              WHERE  ms.sectorid = {?} " . $where . "
+                           GROUP BY  iso_3166_1_a2
+                           ORDER BY  countryFR", $sect, $ssect);
         $page->assign('list', $it);
     }