adds the 'bestalias' email address
authorx2000chevalier <x2000chevalier>
Sun, 10 Oct 2004 08:38:58 +0000 (08:38 +0000)
committerx2000chevalier <x2000chevalier>
Sun, 10 Oct 2004 08:38:58 +0000 (08:38 +0000)
htdocs/fiche.php
templates/fiche.tpl

index bb23c0d..83a44df 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: fiche.php,v 1.12 2004-10-06 13:25:40 x2000habouzit Exp $
+        $Id: fiche.php,v 1.13 2004-10-10 08:38:59 x2000chevalier Exp $
  ***************************************************************************/
 
 
@@ -44,23 +44,25 @@ else
     $where_clause = " WHERE u.matricule = '{$_REQUEST['mat']}'";
 
 $reqsql = "SELECT  u.prenom, u.nom, u.epouse, nationalites.text,
-                  u.user_id, a.alias, u.matricule, i.deces != 0 as dcd,
+                  u.user_id, a.alias, a2.alias, u.matricule, i.deces != 0 as dcd,
                   i.deces, u.date, u.cv, sections.text, u.mobile, u.web,
                   u.libre, u.promo, c.uid IS NOT NULL, p.x, p.y
             FROM  auth_user_md5 AS u
        INNER JOIN  aliases       AS a ON (u.user_id=a.id AND a.type='a_vie')
+       INNER JOIN  aliases       AS a2 ON (u.user_id=a2.id AND (a2.type='alias' OR a2.type='epouse') AND a2.alias LIKE '%.%')
         LEFT JOIN  contacts      AS c ON (c.uid = {$_SESSION['uid']} and c.contact = u.user_id)
        INNER JOIN  nationalites ON(nationalites.id = u.nationalite)
        INNER JOIN  sections ON(sections.id = u.section)
        INNER JOIN  identification AS i ON(u.matricule = i.matricule)
-        LEFT JOIN  photo as p ON(p.uid = u.user_id)".$where_clause;
+        LEFT JOIN  photo as p ON(p.uid = u.user_id)".$where_clause."
+        ORDER BY  a2.type != 'epouse', LENGTH(a2.alias) LIMIT 1";
 $result = $globals->db->query($reqsql);
 
 if (mysql_num_rows($result)!=1)
         exit;
 
 if (list($prenom, $nom, $epouse, $nationalite, 
-        $user_id, $forlife, $matricule, $dcd, $deces, 
+        $user_id, $forlife, $bestalias, $matricule, $dcd, $deces, 
         $date,
         $cv, $section, 
         $mobile, $web, $libre, $promo,
@@ -72,6 +74,7 @@ $page->assign('nom', $nom);
 $page->assign('promo', $promo);
 $page->assign('cv', $cv);
 $page->assign('forlife', $forlife);
+$page->assign('bestalias', $bestalias);
 $page->assign('epouse', $epouse);
 $page->assign('nationalite', $nationalite);
 $page->assign('user_id', $user_id);
index 59e0cb3..4607fdc 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: fiche.tpl,v 1.12 2004-09-19 10:41:08 x2000coic Exp $
+        $Id: fiche.tpl,v 1.13 2004-10-10 08:38:58 x2000chevalier Exp $
  ***************************************************************************}
 
 
@@ -33,7 +33,8 @@
   </div>
   <div class='right' style="font-size: smaller; width:100%">(Fiche mise à jour le {$date|date_format:"%d %B %Y"})</div>
   <div>
-    <a href="mailto:{$forlife}@polytechnique.org">{$forlife}@polytechnique.org</a><br />
+    <a href="mailto:{$bestalias}@polytechnique.org">{$bestalias}@polytechnique.org</a><br />
+    <a href="mailto:{$forlife}@polytechnique.org">{$forlife}@polytechnique.org</a>
   </div>
   <div><em>{$nationalite}</em> - X {$promo}&nbsp;-&nbsp;Formation&nbsp;: {$applis|smarty:nodefaults}</div>
   {if $is_referent}