From 96074354c699ab702dd06bce01130046fd8ea339 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 3 Jan 2011 19:28:46 +0100 Subject: [PATCH] Gives choice for event subscribtion notification: event creator, group animators, both or nobody (Closes #1233). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/xnetevents.php | 40 ++++++++++++++++++++--------------- modules/xnetevents/xnetevents.inc.php | 3 ++- templates/xnetevents/edit.tpl | 13 ++++++++++++ upgrade/1.1.0/05_xnetevents.sql | 3 +++ 4 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 upgrade/1.1.0/05_xnetevents.sql diff --git a/modules/xnetevents.php b/modules/xnetevents.php index 6bc99b1..f0bb1c1 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -268,18 +268,24 @@ class XnetEventsModule extends PLModule $page->trigSuccess('Ton inscription à l\'événement a été mise à jour avec succès.'); subscribe_lists_event(S::i('uid'), $evt, ($total > 0 ? 1 : 0), 0); - $mailer = new PlMailer('xnetevents/subscription-notif.mail.tpl'); - $admins = $globals->asso()->iterAdmins(); - while ($admin = $admins->next()) { - $mailer->addTo($admin); + if ($evt['subscription_notification'] != 'nobody') { + $mailer = new PlMailer('xnetevents/subscription-notif.mail.tpl'); + if ($evt['subscription_notification'] != 'creator') { + $admins = $globals->asso()->iterAdmins(); + while ($admin = $admins->next()) { + $mailer->addTo($admin); + } + } + if ($evt['subscription_notification'] != 'animator') { + $mailer->addTo($evt['organizer']); + } + $mailer->assign('group', $globals->asso('nom')); + $mailer->assign('event', $evt['intitule']); + $mailer->assign('subs', $subs); + $mailer->assign('moments', $evt['moments']); + $mailer->assign('name', S::user()->fullName('promo')); + $mailer->send(); } - $mailer->addTo($evt['organizer']); - $mailer->assign('group', $globals->asso('nom')); - $mailer->assign('event', $evt['intitule']); - $mailer->assign('subs', $subs); - $mailer->assign('moments', $evt['moments']); - $mailer->assign('name', S::user()->fullName('promo')); - $mailer->send(); } $page->assign('event', get_event_detail($eid)); } @@ -403,7 +409,7 @@ class XnetEventsModule extends PLModule 'short_name' => $short_name, ); - $trivial = array('intitule', 'descriptif', 'noinvite', + $trivial = array('intitule', 'descriptif', 'noinvite', 'subscription_notification', 'show_participants', 'accept_nonmembre', 'uid'); foreach ($trivial as $k) { $evt[$k] = Post::v($k); @@ -424,18 +430,18 @@ class XnetEventsModule extends PLModule XDB::execute('INSERT INTO group_events (eid, asso_id, uid, intitule, paiement_id, descriptif, debut, fin, show_participants, short_name, deadline_inscription, noinvite, - accept_nonmembre) - VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}) + accept_nonmembre, subscription_notification) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}) ON DUPLICATE KEY UPDATE asso_id = VALUES(asso_id), uid = VALUES(uid), intitule = VALUES(intitule), paiement_id = VALUES(paiement_id), descriptif = VALUES(descriptif), debut = VALUES(debut), fin = VALUES(fin), show_participants = VALUES(show_participants), short_name = VALUES(short_name), deadline_inscription = VALUES(deadline_inscription), noinvite = VALUES(noinvite), - accept_nonmembre = VALUES(accept_nonmembre)', + accept_nonmembre = VALUES(accept_nonmembre), subscription_notification = VALUES(subscription_notification)', $evt['eid'], $evt['asso_id'], $evt['uid'], $evt['intitule'], $evt['paiement_id'], $evt['descriptif'], $evt['debut'], $evt['fin'], $evt['show_participants'], $evt['short_name'], $evt['deadline_inscription'], - $evt['noinvite'], $evt['accept_nonmembre']); + $evt['noinvite'], $evt['accept_nonmembre'], $evt['subscription_notification']); // if new event, get its id if (!$eid) { @@ -498,7 +504,7 @@ class XnetEventsModule extends PLModule $res = XDB::query( "SELECT eid, intitule, descriptif, debut, fin, uid, show_participants, paiement_id, short_name, - deadline_inscription, noinvite, accept_nonmembre + deadline_inscription, noinvite, accept_nonmembre, subscription_notification FROM group_events WHERE eid = {?}", $eid); $evt = $res->fetchOneAssoc(); diff --git a/modules/xnetevents/xnetevents.inc.php b/modules/xnetevents/xnetevents.inc.php index a4ba097..8e069dc 100644 --- a/modules/xnetevents/xnetevents.inc.php +++ b/modules/xnetevents/xnetevents.inc.php @@ -34,7 +34,8 @@ function get_event_detail($eid, $item_id = false, $asso_id = null) LEFT(10, e.debut) AS start_day, LEFT(10, e.fin) AS last_day, LEFT(NOW(), 10) AS now, ei.titre, al.vid AS absent_list, pl.vid AS participant_list, - pyl.vid AS payed_list, bl.vid AS booked_unpayed_list + pyl.vid AS payed_list, bl.vid AS booked_unpayed_list, + e.subscription_notification FROM group_events AS e INNER JOIN group_event_items AS ei ON (e.eid = ei.eid) LEFT JOIN group_event_participants AS ep ON(e.eid = ep.eid AND ei.item_id = ep.item_id) diff --git a/templates/xnetevents/edit.tpl b/templates/xnetevents/edit.tpl index 909470b..8751833 100644 --- a/templates/xnetevents/edit.tpl +++ b/templates/xnetevents/edit.tpl @@ -123,6 +123,19 @@ function deadlineChange(box) + + Notifier lors d'une inscriptions : + + + + + + Options : diff --git a/upgrade/1.1.0/05_xnetevents.sql b/upgrade/1.1.0/05_xnetevents.sql new file mode 100644 index 0000000..d67ad18 --- /dev/null +++ b/upgrade/1.1.0/05_xnetevents.sql @@ -0,0 +1,3 @@ +ALTER TABLE group_events ADD COLUMN subscription_notification ENUM('nobody', 'creator', 'animator', 'both') NOT NULL DEFAULT 'nobody'; + +-- vim:set syntax=mysql: -- 2.1.4