X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fmarketing.php;h=23593c073fb8475921ad639d9ec3b16ac48fa50a;hb=734e15dc6a0039706148c833168713dec4789260;hp=bbf98080791667eea4b565e9b7de3423b6ec649f;hpb=1d55fe45fa148bbe6209f82f97d19dcd26455eeb;p=platal.git diff --git a/modules/marketing.php b/modules/marketing.php index bbf9808..23593c0 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -1,6 +1,6 @@ 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(); + } } } }