X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetevents.php;h=0dc18e3fe0d62ae435698915e20539733cca0bb7;hb=c9566e01c2add8f12a858abe0fbb0bc6b8e3c0d4;hp=ba0a8154b433abb1495e668b4b8a8003e8b99144;hpb=bfe9f4c752e8889ab5a269bddd27ea43b31d567e;p=platal.git diff --git a/modules/xnetevents.php b/modules/xnetevents.php index ba0a815..0dc18e3 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -297,21 +297,54 @@ class XnetEventsModule extends PLModule return PL_NOT_FOUND; } - pl_cached_content_headers('text/x-csv', 1); + pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1); $page->changeTpl('xnetevents/csv.tpl', NO_SKIN); $admin = may_update(); - $tri = (Env::v('order') == 'alpha' ? UserFilter::sortByPromo() : UserFilter::sortByName()); + $all = !Env::v('item_id', false); - $page->assign('participants', - get_event_participants($evt, $item_id, $tri)); + $participants = get_event_participants($evt, $item_id, $tri); + $title = 'Nom;Prénom;Promotion'; + if ($all) { + foreach ($evt['moments'] as $moment) { + $title .= ';' . $moment['titre']; + } + } + if ($admin && $evt['money']) { + $title .= ';À payer;'; + if ($evt['paiement_id']) { + $title .= 'Télépaiement;Liquide/Chèque;'; + } + $title .= 'Payé'; + } else { + $title .= ';Nombre'; + } + echo utf8_decode($title) . "\n"; + + if ($participants) { + foreach ($participants as $participant) { + $user = $participant['user']; + $line = $user->lastName() . ';' . $user->firstName() . ';' . $user->promo(); + if ($all) { + foreach ($evt['moments'] as $moment) { + $line .= ';' . $participant[$moment['item_id']]; + } + } + if ($admin && $evt['money']) { + $line .= ';' . $participant['montant'] . ';'; + if ($evt['paiement_id']) { + $line .= $participant['telepayment'] . ';' . $participant['adminpaid'] . ';'; + } + $line .= $participant['paid']; + } else { + $line .= ';' . $participant['nb']; + } - $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)); + echo utf8_decode($line) . "\n"; + } + } + exit(); } function handler_ical($page, $eid = null) @@ -463,12 +496,14 @@ class XnetEventsModule extends PLModule Post::v('intitule')." - ".$globals->asso('nom'), Post::v('site'), $money_defaut, Post::v('confirmation'), 0, 999, - $globals->asso('id'), $eid, Post::b('donation')); + $globals->asso('id'), $eid, Post::v('payment_public') == 'yes'); if ($p->accept()) { $p->submit(); } else { - $page->assign('paiement_message', Post::v('confirmation')); - $page->assign('paiement_site', Post::v('site')); + $page->assign('payment_message', Post::v('confirmation')); + $page->assign('payment_site', Post::v('site')); + $page->assign('payment_public', Post::v('payment_public') == 'yes'); + $page->assign('error', true); $error = true; } } @@ -485,9 +520,10 @@ class XnetEventsModule extends PLModule } // get a list of all the payment for this asso - $res = XDB::iterator("SELECT id, text - FROM payments - WHERE asso_id = {?}", $globals->asso('id')); + $res = XDB::iterator("SELECT id, text + FROM payments + WHERE asso_id = {?} AND NOT FIND_IN_SET('old', flags)", + $globals->asso('id')); $paiements = array(); while ($a = $res->next()) $paiements[$a['id']] = $a['text']; { $page->assign('paiements', $paiements); @@ -506,7 +542,7 @@ class XnetEventsModule extends PLModule $res = XDB::query("SELECT stamp FROM requests WHERE type = 'paiements' AND data LIKE {?}", - PayReq::same_event($eid, $globals->asso('id'))); + PayReq::same_event($eid, $globals->asso('id'))); $stamp = $res->fetchOneCell(); if ($stamp) { $evt['paiement_id'] = -2;