From: x2000habouzit Date: Wed, 17 Nov 2004 11:06:46 +0000 (+0000) Subject: use bestalias X-Git-Tag: xorg/old~919 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=b95999cd29fcf2c7a786b608cc12bec76ec81874;p=platal.git use bestalias --- diff --git a/htdocs/fiche.php b/htdocs/fiche.php index b084968..eeaa6ed 100644 --- a/htdocs/fiche.php +++ b/htdocs/fiche.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: fiche.php,v 1.21 2004-11-17 10:12:44 x2000habouzit Exp $ + $Id: fiche.php,v 1.22 2004-11-17 11:06:46 x2000habouzit Exp $ ***************************************************************************/ @@ -49,12 +49,11 @@ $reqsql = "SELECT u.prenom, u.nom, u.epouse, IF(gp.nat='',gp.pays,gp.nat) AS te 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' AND a2.alias LIKE '%.%') + INNER JOIN aliases AS a2 ON (u.user_id=a2.id AND FIND_IN_SET('bestalias',a2.flags)) LEFT JOIN contacts AS c ON (c.uid = {$_SESSION['uid']} and c.contact = u.user_id) LEFT JOIN geoloc_pays AS gp ON (gp.a2 = u.nationalite) INNER JOIN sections ON(sections.id = u.section) - LEFT JOIN photo as p ON(p.uid = u.user_id)".$where_clause." - ORDER BY !FIND_IN_SET('epouse',a2.flags), LENGTH(a2.alias) LIMIT 1"; + LEFT JOIN photo AS p ON(p.uid = u.user_id) ".$where_clause; $result = $globals->db->query($reqsql); diff --git a/scripts/migration/0.9.3/10_aliases.sql b/scripts/migration/0.9.3/10_aliases.sql index 197936f..ee78f77 100644 --- a/scripts/migration/0.9.3/10_aliases.sql +++ b/scripts/migration/0.9.3/10_aliases.sql @@ -3,3 +3,8 @@ update aliases set flags='epouse' where type='epouse'; update aliases set type='epouse' where type='epouse'; alter table aliases change column type type enum('a_vie','alias','homonyme','liste') not null; alter table aliases add index (flags); + + update aliases AS a +left join aliases AS b ON(a.id=b.id and b.alias like '%.%' and length(b.alias)