X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetevents.php;h=0523d5e54dd922fc87e52d41de2137cbc49fbdc1;hb=28c20b86be8b40cecba0d83080879f81c49e07ad;hp=f99e8e8bce7e4c3991ff1e3cd9fadd6d23d9149b;hpb=4bf9726269902e05e8400fcba1f9ef27d9b6d2d8;p=platal.git diff --git a/modules/xnetevents.php b/modules/xnetevents.php index f99e8e8..0523d5e 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -154,8 +154,8 @@ class XnetEventsModule extends PLModule } $query = XDB::query( - "SELECT montant - FROM {$globals->money->mpay_tprefix}transactions AS t + "SELECT amount + FROM payment_transactions AS t WHERE ref = {?} AND uid = {?}", $e['paiement_id'], S::v('uid')); $montants = $query->fetchColumn(); @@ -477,7 +477,7 @@ class XnetEventsModule extends PLModule // get a list of all the payment for this asso $res = XDB::iterator("SELECT id, text - FROM {$globals->money->mpay_tprefix}paiements + FROM payments WHERE asso_id = {?}", $globals->asso('id')); $paiements = array(); while ($a = $res->next()) $paiements[$a['id']] = $a['text']; { @@ -577,7 +577,14 @@ class XnetEventsModule extends PLModule GROUP BY uid", $member->uid, $evt['eid']); $u = $res->fetchOneAssoc(); - $u = $u['cnt'] ? $u['nb'] : null; + if ($u['cnt'] == 1 && $paid == 0 && Post::v('cancel')) { + XDB::execute("DELETE FROM group_event_participants + WHERE uid = {?} AND eid = {?}", + $member->uid, $evt['eid']); + $u = 0; + } else { + $u = $u['cnt'] ? $u['nb'] : null; + } subscribe_lists_event($u, $member->uid, $evt, $paid); } @@ -593,8 +600,8 @@ class XnetEventsModule extends PLModule if ($evt['paiement_id']) { $infos = User::getBulkUsersWithUIDs( - XDB::fetchAllAssoc('SELECT t.uid, t.montant - FROM ' . $globals->money->mpay_tprefix . 'transactions AS t + XDB::fetchAllAssoc('SELECT t.uid, t.amount + FROM payment_transactions AS t LEFT JOIN group_event_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?}) WHERE t.ref = {?} AND ep.uid IS NULL', $evt['eid'], $evt['paiement_id']),