Fixes an "undefined variable" error in modules/email.php.
[platal.git] / modules / axletter / axletter.inc.php
index f8c7ca1..385365e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -48,8 +48,7 @@ class AXLetter extends MassMailer
                                     WHERE  id = {?} OR short_name = {?}", $id, $id);
             }
             if (!$res->numRows()) {
-                $this->_id = null;
-                return;
+                throw new MailNotFound();
             }
             $id = $res->fetchOneRow();
         }
@@ -99,7 +98,9 @@ class AXLetter extends MassMailer
 
     protected function getAllRecipients()
     {
-        return "SELECT  ni.user_id, IF(ni.user_id = 0, ni.email, a.alias) AS alias,
+        global $globals;
+        return "SELECT  ni.user_id, IF(ni.user_id = 0, NULL, u.hruid) AS hruid,
+                        IF(ni.user_id = 0, ni.email, CONCAT(a.alias, '@{$globals->mail->domain}')) AS alias,
                         IF(ni.user_id = 0, ni.prenom, u.prenom) AS prenom,
                         IF(ni.user_id = 0, ni.nom, IF(u.nom_usage='', u.nom, u.nom_usage)) AS nom,
                         FIND_IN_SET('femme', IF(ni.user_id = 0, ni.flag, u.flags)) AS sexe,