Not groups managers on member unsubscription (Closes #807)
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 15 Jun 2008 16:52:38 +0000 (18:52 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 15 Jun 2008 16:52:38 +0000 (18:52 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
configs/mails.conf
modules/xnetgrp.php
templates/xnetgrp/unsubscription-notif.mail.tpl [new file with mode: 0644]

index ebe4725..3f75eac 100644 (file)
@@ -51,3 +51,6 @@ from="Carnet Polytechnicien <support_carnet@polytechnique.org>"
 [googleapps]
 from="Polytechnique.org" <support@polytechnique.org>
 cc=validation+googleapps@polytechnique.org
+
+[xnet_unsubscription]
+from="Gestion des groupes X sur Polytechnique.net" <support@polytechnique.org>
index 270a010..c6cc7e0 100644 (file)
@@ -771,6 +771,23 @@ class XnetGrpModule extends PLModule
                 "DELETE FROM  groupex.membres WHERE uid={?} AND asso_id={?}",
                 $user['uid'], $globals->asso('id'));
 
+        $mailer = new PlMailer('xnetgrp/unsubscription-notif.mail.tpl');
+        $res = XDB::iterRow("SELECT  a.alias, u.prenom, IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom
+                               FROM  groupex.membres AS m
+                         INNER JOIN  aliases AS a ON (m.uid = a.id AND FIND_IN_SET('bestalias', a.flags))
+                         INNER JOIn  auth_user_md5 AS u ON (u.user_id = a.id)
+                              WHERE  m.asso_id = {?} AND m.perms = 'admin'",
+                              $globals->asso('id'));
+        while (list($alias, $prenom, $nom) = $res->next()) {
+            $mailer->addTo("\"$prenom $nom\" <$alias@{$globals->mail->domain}>");
+        }
+        $mailer->assign('group', $globals->asso('nom'));
+        $mailer->assign('prenom', $user['prenom']);
+        $mailer->assign('nom', $user['nom']);
+        $mailer->assign('mail', $user['email2']);
+        $mailer->assign('selfdone', $user['uid'] == S::i('uid'));
+        $mailer->send();
+
         $user_same_email = get_infos($user['email']);
         $domain = $globals->asso('mail_domain');
 
diff --git a/templates/xnetgrp/unsubscription-notif.mail.tpl b/templates/xnetgrp/unsubscription-notif.mail.tpl
new file mode 100644 (file)
index 0000000..6067133
--- /dev/null
@@ -0,0 +1,39 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.org/                                  *}
+{*                                                                        *}
+{*  This program is free software; you can redistribute it and/or modify  *}
+{*  it under the terms of the GNU General Public License as published by  *}
+{*  the Free Software Foundation; either version 2 of the License, or     *}
+{*  (at your option) any later version.                                   *}
+{*                                                                        *}
+{*  This program is distributed in the hope that it will be useful,       *}
+{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
+{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
+{*  GNU General Public License for more details.                          *}
+{*                                                                        *}
+{*  You should have received a copy of the GNU General Public License     *}
+{*  along with this program; if not, write to the Free Software           *}
+{*  Foundation, Inc.,                                                     *}
+{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="xnet_unsubscription"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{subject text="[`$group`] Désinscription de `$prenom` `$nom`"}
+{elseif $mail_part eq 'wiki'}
+Chers animateurs du groupe {$group},
+
+{if $selfdone}
+{$prenom} {$nom} ({$mail}) vient de se désinscrire du groupe.
+{else}
+{$prenom} {$nom} ({$mail}) vient d'être désinscrit du groupe par {$smarty.session.prenom} {$smarty.session.nom}.
+{/if}
+
+Cordialement,\\
+L'Equipe de Polytechnique.org
+{/if}
+{* vim:set et sw=2 sts=2 sws=2: *}