Update due to changes to profile_display's schema.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 31 Dec 2008 10:44:28 +0000 (11:44 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 31 Dec 2008 10:44:28 +0000 (11:44 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/user.php
include/user.func.inc.php
include/userset.inc.php
include/validations.inc.php
modules/events.php
modules/profile.php
modules/profile/general.inc.php

index f817026..394cfd1 100644 (file)
@@ -117,7 +117,7 @@ class User extends PlUser
         }
 
         global $globals;
-        $res = XDB::query("SELECT  u.hruid, d.promo_display AS promo,
+        $res = XDB::query("SELECT  u.hruid, d.promo,
                                    CONCAT(af.alias, '@{$globals->mail->domain}') AS forlife,
                                    CONCAT(ab.alias, '@{$globals->mail->domain}') AS bestalias,
                                    CONCAT(u.prenom, ' ', IF(u.nom_usage <> '', u.nom_usage, u.nom)) AS full_name,
@@ -126,7 +126,7 @@ class User extends PlUser
                                    q.core_mail_fmt AS email_format,
                                    u.perms
                              FROM  auth_user_md5 AS u
-                       INNER JOIN  profile_display AS d ON (d.uid = u.user_id)
+                       INNER JOIN  profile_display AS d ON (d.pid = u.user_id)
                         LEFT JOIN  auth_user_quick AS q ON (q.user_id = u.user_id)
                         LEFT JOIN  aliases AS af ON (af.id = u.user_id AND af.type = 'a_vie')
                         LEFT JOIN  aliases AS ab ON (ab.id = u.user_id AND FIND_IN_SET('bestalias', ab.flags))
index 780b539..09cc874 100644 (file)
@@ -257,7 +257,7 @@ function get_user_details_adr($uid, $view = 'private') {
 
 function &get_user_details($login, $from_uid = '', $view = 'private')
 {
-    $reqsql = "SELECT  u.user_id, d.promo_display, u.prenom, u.nom, u.nom_usage, u.date, u.cv,
+    $reqsql = "SELECT  u.user_id, d.promo, u.prenom, u.nom, u.nom_usage, u.date, u.cv,
                        u.perms IN ('admin','user','disabled') AS inscrit,  FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces,
                        q.profile_nick AS nickname, q.profile_from_ax, q.profile_freetext AS freetext,
                        q.profile_freetext_pub AS freetext_pub,
@@ -286,7 +286,7 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
             LEFT JOIN  profile_mentor        AS m   ON (m.uid = u.user_id)
             LEFT JOIN  emails                AS e   ON (e.uid = u.user_id AND e.flags='active')
            INNER JOIN  profile_names_display AS nd  ON (nd.user_id = u.user_id)
-           INNER JOIN  profile_display       AS d   ON (d.uid = u.user_id)
+           INNER JOIN  profile_display       AS d   ON (d.pid = u.user_id)
                 WHERE  a.alias = {?}
              GROUP BY  u.user_id";
     $res  = XDB::query($reqsql, $from_uid, $login);
index f725210..6167647 100644 (file)
@@ -172,7 +172,7 @@ class MinificheView extends MultipageView
     public function fields()
     {
         global $globals;
-        return "u.user_id AS id, u.*, d.promo_display,
+        return "u.user_id AS id, u.*, d.promo,
                 CONCAT(a.alias, '@{$globals->mail->domain}') AS bestemail,
                 u.perms != 'pending' AS inscrit,
                 u.perms != 'pending' AS wasinscrit,
@@ -233,7 +233,7 @@ class MinificheView extends MultipageView
                  LEFT JOIN  geoloc_region                 AS gr   ON (adr.country = gr.a2 AND adr.region = gr.region)
                  LEFT JOIN  emails                        AS em   ON (em.uid = u.user_id AND em.flags = 'active')
                 INNER JOIN  profile_names_display         AS nd   ON (nd.user_id = u.user_id)
-                INNER JOIN  profile_display               AS d    ON (d.uid = u.user_id)" . (S::logged() ?
+                INNER JOIN  profile_display               AS d    ON (d.pid = u.user_id)" . (S::logged() ?
                 "LEFT JOIN  contacts                      AS c    ON (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")"
                  : "");
     }
@@ -275,7 +275,7 @@ class MentorView extends MultipageView
 
     public function fields()
     {
-        return "m.uid, d.promo_display, u.hruid,
+        return "m.uid, d.promo, u.hruid,
                 m.expertise, mp.country, ms.sectorid, ms.subsectorid,
                 nd.display AS name_display, nd.tooltip AS name_tooltip, nd.sort AS name_sort";
     }
@@ -283,7 +283,7 @@ class MentorView extends MultipageView
     public function joins()
     {
         return "INNER JOIN  profile_names_display AS nd ON (nd.user_id = u.user_id)
-                INNER JOIN  profile_display       AS d  ON (d.uid = u.user_id)";
+                INNER JOIN  profile_display       AS d  ON (d.pid = u.user_id)";
     }
 
     public function bounds()
@@ -325,13 +325,13 @@ class TrombiView extends MultipageView
 
     public function fields()
     {
-        return "u.user_id, nd.display AS name_display, nd.tooltip AS name_tooltip, nd.sort AS name_sort, u.promo, d.promo_display, u.hruid ";
+        return "u.user_id, nd.display AS name_display, nd.tooltip AS name_tooltip, nd.sort AS name_sort, u.promo, d.promo, u.hruid ";
     }
 
     public function joins()
     {
         return "INNER JOIN  photo                 AS p  ON (p.uid = u.user_id)
-                INNER JOIN  profile_display       AS d  ON (d.uid = u.user_id)
+                INNER JOIN  profile_display       AS d  ON (d.pid = u.user_id)
                 INNER JOIN  profile_names_display AS nd ON (nd.user_id = u.user_id)";
     }
 
@@ -426,9 +426,9 @@ class GeolocView implements PlView
             header('Content-Type: text/xml');
             header('Pragma:');
             $only_current = Env::v('only_current', false)? ' AND FIND_IN_SET(\'active\', adrf.statut)' : '';
-            $it =& $this->set->get('u.user_id AS id, u.prenom, u.nom, d.promo_display, al.alias',
+            $it =& $this->set->get('u.user_id AS id, u.prenom, u.nom, d.promo, al.alias',
                                    "INNER JOIN  adresses        AS adrf ON (adrf.uid = u.user_id $only_current)
-                                    INNER JOIN  profile_display AS d    ON (d.uid = u.user_id)
+                                    INNER JOIN  profile_display AS d    ON (d.pid = u.user_id)
                                      LEFT JOIN  aliases         AS al   ON (u.user_id = al.id
                                                                             AND FIND_IN_SET('bestalias', al.flags))
                                     INNER JOIN  adresses        AS avg  ON (" . getadr_join('avg') . ")",
index d72ec3d..ce0b12d 100644 (file)
@@ -85,9 +85,9 @@ abstract class Validate
         $this->stamp  = date('YmdHis');
         $this->unique = $_unique;
         $this->type   = $_type;
-        $res = XDB::query("SELECT  promo_display AS promo
+        $res = XDB::query("SELECT  promo
                              FROM  profile_display
-                            WHERE  uid={?}", $this->user->id());
+                            WHERE  pid={?}", $this->user->id());
         $this->promo = $res->fetchOneCell();
     }
 
index 4a106e1..4c4f192 100644 (file)
@@ -159,7 +159,7 @@ class EventsModule extends PLModule
 
         // Fetch the events to display, along with their metadata.
         $array = array();
-        $it = XDB::iterator("SELECT  e.id, e.titre, e.texte, e.post_id, a.user_id, a.nom, a.prenom, d.promo_display ,a.hruid,
+        $it = XDB::iterator("SELECT  e.id, e.titre, e.texte, e.post_id, a.user_id, a.nom, a.prenom, d.promo AS promo_display ,a.hruid,
                                      p.x, p.y, p.attach IS NOT NULL AS img, FIND_IN_SET('wiki', e.flags) AS wiki,
                                      FIND_IN_SET('important', e.flags) AS important,
                                      e.creation_date > DATE_SUB(CURDATE(), INTERVAL 2 DAY) AS news,
@@ -168,7 +168,7 @@ class EventsModule extends PLModule
                                FROM  evenements       AS e
                           LEFT JOIN  evenements_photo AS p  ON (e.id = p.eid)
                          INNER JOIN  auth_user_md5    AS a  ON (e.user_id = a.user_id)
-                         INNER JOIN  profile_display  AS d  ON (d.uid = a.user_id)
+                         INNER JOIN  profile_display  AS d  ON (d.pid = a.user_id)
                           LEFT JOIN  evenements_vus   AS ev ON (e.id = ev.evt_id AND ev.user_id = {?})
                               WHERE  FIND_IN_SET('valide', e.flags) AND peremption >= NOW()
                                      AND (e.promo_min = 0 || e.promo_min <= {?})
index 293f3a6..05af457 100644 (file)
@@ -539,9 +539,9 @@ class ProfileModule extends PLModule
 
         require_once 'validations.inc.php';
 
-        $res = XDB::query("SELECT  e.entry_year, e.grad_year, d.promo_display, FIND_IN_SET('femme', u.flags) AS sexe
+        $res = XDB::query("SELECT  e.entry_year, e.grad_year, d.promo, FIND_IN_SET('femme', u.flags) AS sexe
                              FROM  auth_user_md5     AS u
-                       INNER JOIN  profile_display   AS d ON (d.uid = u.user_id)
+                       INNER JOIN  profile_display   AS d ON (d.pid = u.user_id)
                        INNER JOIN  profile_education AS e ON (e.uid = u.user_id AND FIND_IN_SET('primary', e.flags))
                             WHERE  u.user_id = {?}", S::v('uid'));
 
index ecb18b3..945c54f 100644 (file)
@@ -290,7 +290,7 @@ class ProfileGeneral extends ProfilePage
     protected function _fetchData()
     {
         // Checkout all data...
-        $res = XDB::query("SELECT  p.promo_display, e.entry_year AS entry_year, e.grad_year AS grad_year,
+        $res = XDB::query("SELECT  p.promo AS promo_display, e.entry_year AS entry_year, e.grad_year AS grad_year,
                                    u.nom_usage, u.nationalite, u.nationalite2, u.nationalite3, u.naissance,
                                    t.display_tel as mobile, t.pub as mobile_pub,
                                    d.email_directory as email_directory,
@@ -301,7 +301,7 @@ class ProfileGeneral extends ProfilePage
                              FROM  auth_user_md5         AS u
                        INNER JOIN  auth_user_quick       AS q ON (u.user_id = q.user_id)
                        INNER JOIN  profile_names_display AS n ON (n.user_id = u.user_id)
-                       INNER JOIN  profile_display       AS p ON (p.uid = u.user_id)
+                       INNER JOIN  profile_display       AS p ON (p.pid = u.user_id)
                        INNER JOIN  profile_education     AS e ON (e.uid = u.user_id AND FIND_IN_SET('primary', e.flags))
                         LEFT JOIN  profile_phones        AS t ON (u.user_id = t.uid AND link_type = 'user')
                         LEFT JOIN  profile_directory     AS d ON (d.uid = u.user_id)
@@ -407,8 +407,8 @@ class ProfileGeneral extends ProfilePage
         }
         if ($this->changed['promo_display']) {
             XDB::execute("UPDATE  profile_display
-                             SET  promo_display = {?}
-                           WHERE  uid = {?}",
+                             SET  promo = {?}
+                           WHERE  pid = {?}",
                          $this->values['promo_display'], S::v('uid'));
         }
     }