From cc7f40f4170950afb0710104be327960e53d2c57 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Tue, 2 Nov 2004 16:37:19 +0000 Subject: [PATCH] now it's almost perfect --- scripts/cron/send_nl.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/cron/send_nl.php b/scripts/cron/send_nl.php index b30cdce..51a1e34 100755 --- a/scripts/cron/send_nl.php +++ b/scripts/cron/send_nl.php @@ -19,7 +19,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: send_nl.php,v 1.6 2004-11-02 14:13:13 x2000habouzit Exp $ + $Id: send_nl.php,v 1.7 2004-11-02 16:37:19 x2000habouzit Exp $ ***************************************************************************/ require('./connect.db.inc.php'); @@ -47,9 +47,11 @@ $nl = new NewsLetter($id); $nl->setSent(); while(true) { - $sql = mysql_query("SELECT ni.user_id,ni.pref, a.alias, u.prenom,u.nom, FIND_IN_SET(u.flags, 'femme') + $sql = mysql_query("SELECT ni.user_id,ni.pref, IF(e.alias IS NULL,a.alias,e.alias), + u.prenom, IF(u.epouse='', u.nom, u.epouse) FROM newsletter_ins AS ni INNER JOIN auth_user_md5 AS u USING(user_id) + LEFT JOIN aliases AS e ON(u.user_id=e.id AND e.type='epouse') INNER JOIN aliases AS a ON(u.user_id=a.id AND a.type!='homonyme') LEFT JOIN aliases AS b ON(u.user_id=b.id AND a.type!='homonyme' AND LENGTH(a.alias)>LENGTH(b.alias)) -- 2.1.4