X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetevents%2Fxnetevents.inc.php;h=1303d9ce47ff07c92de84a761c92dcb4657a7228;hb=a7d35093a40837b3a17d7fbac0259995f084812c;hp=cb3aba526cbaea0305cb79cc7db42b262e79ce55;hpb=8bac35d8a8062f623c09853232422107f4c4621b;p=platal.git diff --git a/modules/xnetevents/xnetevents.inc.php b/modules/xnetevents/xnetevents.inc.php index cb3aba5..1303d9c 100644 --- a/modules/xnetevents/xnetevents.inc.php +++ b/modules/xnetevents/xnetevents.inc.php @@ -1,6 +1,6 @@ 0 + WHERE ep.eid = {?} ".(($item_id)?" AND item_id = $item_id":"")." $where GROUP BY ep.uid @@ -155,7 +155,14 @@ function get_event_participants($evt, $item_id, $tri, $limit = '') { $tab = array(); $user = 0; + $evt['adminpaid'] = 0; + $evt['telepaid'] = 0; + $evt['topay'] = 0; + $evt['paid'] = 0; while ($u = $res->next()) { + if ($u['nb'] == 0) { + continue; + } $u['adminpaid'] = $u['paid']; $u['montant'] = 0; if ($money && $pay_id) { @@ -166,8 +173,8 @@ function get_event_participants($evt, $item_id, $tri, $limit = '') { $pay_id, $u['uid']); $montants = $res_->fetchColumn(); foreach ($montants as $m) { - $p = strtr(substr($m, 0, strpos($m, "EUR")), ",", "."); - $u['paid'] += trim($p); + $p = strtr(substr($m, 0, strpos($m, "EUR")), ",", "."); + $u['paid'] += trim($p); } } $u['telepayment'] = $u['paid'] - $u['adminpaid']; @@ -182,6 +189,10 @@ function get_event_participants($evt, $item_id, $tri, $limit = '') { $u['montant'] += $i['montant']*$i['nb']; } $tab[] = $u; + $evt['telepaid'] += $u['telepayment']; + $evt['adminpaid'] += $u['adminpaid']; + $evt['paid'] += $u['paid']; + $evt['topay'] += $u['montant']; } return $tab; } @@ -196,7 +207,7 @@ function subscribe_lists_event($participate, $uid, $evt) $participant_list = $evt['participant_list']; $absent_list = $evt['absent_list']; - $email = get_user_forlife($uid); + $email = get_user_forlife($uid, '_silent_user_callback'); if ($email) { $email .= '@'.$globals->mail->domain; @@ -239,7 +250,7 @@ function subscribe_lists_event($participate, $uid, $evt) } // }}} -function event_change_shortname(&$page, $old, $new) +function event_change_shortname(&$page, $eid, $old, $new) { global $globals; @@ -248,7 +259,7 @@ function event_change_shortname(&$page, $old, $new) } // Quelques vérifications sur l'alias (caractères spéciaux) if ($new && !preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $new)) { - $page->trig("Le raccourci demandé n'est pas valide. + $page->trigError("Le raccourci demandé n'est pas valide. Vérifie qu'il comporte entre 3 et 20 caractères et qu'il ne contient que des lettres non accentuées, des chiffres ou les caractères - et ."); @@ -262,7 +273,7 @@ function event_change_shortname(&$page, $old, $new) WHERE short_name = {?}', $new); if ($res->fetchOneCell() > 0) { - $page->trig("Le raccourci demandé est déjà utilisé. Choisis en un autre."); + $page->trigError("Le raccourci demandé est déjà utilisé. Choisis en un autre."); return $old; } } @@ -296,7 +307,7 @@ function event_change_shortname(&$page, $old, $new) LEFT JOIN groupex.membres AS m ON (ep.uid = m.uid) LEFT JOIN auth_user_md5 AS u ON (u.user_id = ep.uid) LEFT JOIN aliases AS a ON (a.id = ep.uid AND a.type = 'a_vie') - WHERE ep.eid = {?} + WHERE ep.eid = {?} AND ep.nb > 0 GROUP BY ep.uid)", $lastid, '@'.$globals->mail->domain, $eid); @@ -307,12 +318,12 @@ function event_change_shortname(&$page, $old, $new) XDB::execute("INSERT INTO virtual_redirect ( SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect FROM groupex.membres AS m - LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid) + LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?}) LEFT JOIN auth_user_md5 AS u ON (u.user_id = m.uid) LEFT JOIN aliases AS a ON (a.id = m.uid AND a.type = 'a_vie') WHERE m.asso_id = {?} AND ep.uid IS NULL GROUP BY m.uid)", - $lastid, "@".$globals->mail->domain, $globals->asso('id')); + $lastid, "@".$globals->mail->domain, $eid, $globals->asso('id')); return $new; }