X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fmarketing.php;h=8c648d0b2a86d53e6d0ac9eac1c65361ab998a47;hb=c7a553bf94456f51acd8750b426fd01da3a13a3a;hp=70d0c122588e5596573ea487b82f88c139a3065f;hpb=799cdbcdfea53397d3bde1b145cdc018d21d6f5a;p=platal.git diff --git a/modules/marketing.php b/modules/marketing.php index 70d0c12..8c648d0 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -178,7 +178,8 @@ class MarketingModule extends PLModule } $res = Xdb::query("SELECT u.nom, u.prenom, u.promo, FIND_IN_SET('femme', u.flags) AS sexe, - a.alias AS forlife, b.alias AS bestalias, e.email, e.last + u.deces = '0000-00-00' AS alive, a.alias AS forlife, b.alias AS bestalias, + e.email, e.last FROM auth_user_md5 AS u INNER JOIN aliases AS a ON (a.id = u.user_id AND a.type = 'a_vie') INNER JOIN aliases AS b ON (b.id = u.user_id AND FIND_IN_SET('bestalias', b.flags)) @@ -261,16 +262,21 @@ class MarketingModule extends PLModule if (Post::has('valide')) { require_once('xorg.misc.inc.php'); $email = trim(Post::v('mail')); - $market = Marketing::get($uid, $email); + if (!isvalid_email_redirection($email)) { $page->trig("Email invalide !"); - } elseif ($market) { - $page->assign('already', true); } else { - $page->assign('ok', true); - check_email($email, "Une adresse surveillée est proposée au marketing par " . S::v('forlife')); - $market = new Marketing($uid, $email, 'default', null, Post::v('origine'), S::v('uid')); - $market->add(); + // On cherche les marketings précédents sur cette adresse + // email, en se restreignant au dernier mois + + if (Marketing::get($uid, $email, true)) { + $page->assign('already', true); + } else { + $page->assign('ok', true); + check_email($email, "Une adresse surveillée est proposée au marketing par " . S::v('forlife')); + $market = new Marketing($uid, $email, 'default', null, Post::v('origine'), S::v('uid')); + $market->add(); + } } } }