Fixes a SQL query in modules/axletter/axletter.inc.php.
[platal.git] / modules / profile / jobs.inc.php
index 1777498..d629711 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -130,6 +130,7 @@ class ProfileJobs extends ProfilePage
         parent::__construct($wiz);
         $this->settings['cv'] = null;
         $this->settings['jobs'] = new ProfileJob();
+        $this->watched['cv'] = $this->watched['jobs'] = true;
     }
 
     protected function _fetchData()
@@ -151,7 +152,7 @@ class ProfileJobs extends ProfilePage
                                      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)
+                          LEFT JOIN  geoloc_pays AS gp ON(gp.a2 = e.country)
                               WHERE  uid = {?} AND entreprise != ''
                            ORDER BY  entrid", S::i('uid'));
         $this->values['jobs'] = array();
@@ -186,7 +187,6 @@ class ProfileJobs extends ProfilePage
                                             'email'      => $email,
                                             'web'        => $web,
                                             'pub'        => $pub,
-                                            'adr_pub'    => $adr_pub,
                                             'tel_pub'    => $tel_pub,
                                             'email_pub'  => $email_pub);
         }
@@ -202,13 +202,15 @@ class ProfileJobs extends ProfilePage
         }
     }
 
-    public function _prepare(PlatalPage &$page, $id)
+    public function _prepare(PlPage &$page, $id)
     {
-        $page->assign('secteurs', XDB::iterator("SELECT  id, label
-                                                   FROM  emploi_secteur"));
-        $page->assign('fonctions', XDB::iterator("SELECT  id, fonction_fr, FIND_IN_SET('titre', flags) AS title
-                                                    FROM  fonctions_def
-                                                ORDER BY  id"));
+        $res = XDB::query("SELECT  id, label
+                             FROM  emploi_secteur");
+        $page->assign('secteurs', $res->fetchAllAssoc());
+        $res = XDB::query("SELECT  id, fonction_fr, FIND_IN_SET('titre', flags) AS title
+                             FROM  fonctions_def
+                         ORDER BY  id");
+        $page->assign('fonctions', $res->fetchAllAssoc());
     }
 }