X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetevents.php;h=056ca5a9ed79677899f15fd18946f84cbfee2c60;hb=a5878ac19cc6ea75a753470cf68b7d2180d6cd51;hp=e7e939eb672beb622d2bea26b5ec1c59b5e357ae;hpb=ab02e9bc608e3154f7fc0f1383defc7f365d7b9f;p=platal.git diff --git a/modules/xnetevents.php b/modules/xnetevents.php index e7e939e..056ca5a 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -1,6 +1,6 @@ asso('id'))); + update_NbValid(); } if ($action == 'archive') { @@ -126,13 +127,18 @@ class XnetEventsModule extends PLModule LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?}) WHERE asso_id = {?} AND archive = " . ($archive ? "1 " : "0 ") - . (is_member() || may_update() ? "" : " AND accept_nonmembre != 0 ") . "GROUP BY e.eid ORDER BY inscr_open DESC, debut DESC", S::v('uid'), $globals->asso('id')); $evts = array(); + $undisplayed_events = 0; while ($e = $evenements->next()) { + if (!is_member() && !may_update() && !$e['accept_nonmembre']) { + $undisplayed_events ++; + continue; + } + $e['show_participants'] = ($e['show_participants'] && (is_member() || may_update())); $res = XDB::query( "SELECT titre, details, montant, ei.item_id, nb, ep.paid @@ -167,6 +173,7 @@ class XnetEventsModule extends PLModule } $page->assign('evenements', $evts); + $page->assign('undisplayed_events', $undisplayed_events); } function handler_sub(&$page, $eid = null) @@ -186,6 +193,11 @@ class XnetEventsModule extends PLModule $page->kill('Cet événement est fermé aux non-membres du groupe'); } + global $globals; + $res = XDB::query("SELECT stamp FROM requests + WHERE type = 'paiements' AND data LIKE {?}", + PayReq::same_event($evt['eid'], $globals->asso('id'))); + $page->assign('validation', $res->numRows()); $page->assign('event', $evt); if (!Post::has('submit')) { @@ -225,18 +237,20 @@ class XnetEventsModule extends PLModule $updated = false; $total = 0; $paid = $evt['paid'] ? $evt['paid'] : 0; + $telepaid= $evt['telepaid'] ? $evt['telepaid'] : 0; foreach ($subs as $j => $nb) { if ($nb >= 0) { XDB::execute( "REPLACE INTO groupex.evenements_participants - VALUES ({?}, {?}, {?}, {?}, {?})", - $eid, S::v('uid'), $j, $nb, $paid); + VALUES ({?}, {?}, {?}, {?}, {?}, {?})", + $eid, S::v('uid'), $j, $nb, Env::has('notify_payment') ? 'notify_payment' : '', + $j == 1 ? $paid - $telepaid : 0); $updated = $eid; } else { XDB::execute( "DELETE FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?} AND item_id = {?}", - $eid, S::v("uid"), $j); + $eid, S::v("uid"), $j); $updated = $eid; } $total += $nb; @@ -276,6 +290,7 @@ class XnetEventsModule extends PLModule $page->assign('admin', $admin); $page->assign('moments', $evt['moments']); $page->assign('money', $evt['money']); + $page->assign('telepayment', $evt['paiement_id']); $page->assign('tout', !Env::v('item_id', false)); } @@ -347,7 +362,8 @@ class XnetEventsModule extends PLModule if (Post::v('intitule')) { require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php'; - $short_name = event_change_shortname($page, $infos['short_name'], + $short_name = event_change_shortname($page, $eid, + $infos['short_name'], Env::v('short_name', '')); if ($short_name != Env::v('short_name')) { $error = true; @@ -518,7 +534,7 @@ class XnetEventsModule extends PLModule if (Env::v('adm') == 'prix' && $member) { XDB::execute("UPDATE groupex.evenements_participants SET paid = IF(paid + {?} > 0, paid + {?}, 0) - WHERE uid = {?} AND eid = {?}", + WHERE uid = {?} AND eid = {?} AND item_id = 1", strtr(Env::v('montant'), ',', '.'), strtr(Env::v('montant'), ',', '.'), $member['uid'], $evt['eid']); @@ -537,8 +553,8 @@ class XnetEventsModule extends PLModule foreach ($nbs as $id => $nb) { $nb = max(intval($nb), 0); XDB::execute("REPLACE INTO groupex.evenements_participants - VALUES ({?}, {?}, {?}, {?}, {?})", - $evt['eid'], $member['uid'], $id, $nb, $paid); + VALUES ({?}, {?}, {?}, {?}, {?}, {?})", + $evt['eid'], $member['uid'], $id, $nb, '', $id == 1 ? $paid : 0); } $res = XDB::query("SELECT COUNT(uid) AS cnt, SUM(nb) AS nb @@ -547,14 +563,14 @@ class XnetEventsModule extends PLModule GROUP BY uid", $member['uid'], $evt['eid']); $u = $res->fetchOneAssoc(); - $u = $u['cnt'] ? null : $u['nb']; + $u = $u['cnt'] ? $u['nb'] : null; subscribe_lists_event($u, $member['uid'], $evt); } $evt = get_event_detail($eid, $item_id); } - $page->assign('evt', $evt); + $page->assign_by_ref('evt', $evt); $page->assign('tout', is_null($item_id)); if (count($evt['moments'])) {