Don't propose promotion ml subscription if the list does not exist.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 6 Feb 2011 20:54:51 +0000 (21:54 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 6 Feb 2011 20:55:30 +0000 (21:55 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/reminder/promotion_ml.inc.php

index 8176320..5900a00 100644 (file)
@@ -79,7 +79,16 @@ class ReminderPromotionMl extends Reminder
         if ($mlCount) {
             Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
         }
-        return ($mlCount == 0);
+        if ($mlCount == 0) {
+            $mmlist = new MMList($user);
+            try {
+                $mmlist->get_members_limit('promo' + $user->profile()->yearPromo(),
+                                           0, 0);
+            } catch (Exception $e) {
+                return false;
+            }
+        }
+        return false;
     }
 }