Ajout du support des écritures ventilées.
[garradin.git] / www / admin / membres / cotisations.php
1 <?php
2 namespace Garradin;
3
4 require_once __DIR__ . '/../_inc.php';
5
6 if ($user['droits']['membres'] < Membres::DROIT_ECRITURE)
7 {
8 throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
9 }
10
11 if (empty($_GET['id']) || !is_numeric($_GET['id']))
12 {
13 throw new UserException("Argument du numéro de membre manquant.");
14 }
15
16 $id = (int) $_GET['id'];
17
18 $membre = $membres->get($id);
19
20 if (!$membre)
21 {
22 throw new UserException("Ce membre n'existe pas.");
23 }
24
25 $cats = new Membres_Categories;
26
27 $categorie = $cats->get($membre['id_categorie']);
28 $tpl->assign('categorie', $categorie);
29
30 $cotisations = new Cotisations_Membres;
31
32 if (!empty($categorie['id_cotisation_obligatoire']))
33 {
34 $tpl->assign('cotisation', $cotisations->isMemberUpToDate($membre['id'], $categorie['id_cotisation_obligatoire']));
35 }
36 else
37 {
38 $tpl->assign('cotisation', false);
39 }
40
41 $tpl->assign('nb_activites', $cotisations->countForMember($membre['id']));
42 $tpl->assign('cotisations', $cotisations->listForMember($membre['id']));
43 $tpl->assign('cotisations_membre', $cotisations->listSubscriptionsForMember($membre['id']));
44
45 $tpl->assign('membre', $membre);
46
47 $tpl->display('admin/membres/cotisations.tpl');
48
49 ?>