Ajout du support des écritures ventilées.
[garradin.git] / www / admin / compta / operations / membre.php
1 <?php
2 namespace Garradin;
3
4 require_once __DIR__ . '/../_inc.php';
5
6 $exercices = new Compta_Exercices;
7 $journal = new Compta_Journal;
8
9 $exercice = utils::get('exercice') ?: $exercices->getCurrentId();
10
11 if (!$exercice)
12 {
13 throw new UserException('Exercice inconnu.');
14 }
15
16 if (empty($_GET['id']) || !is_numeric($_GET['id']))
17 {
18 throw new UserException("Argument du numéro de membre manquant.");
19 }
20
21 $id = (int) $_GET['id'];
22
23 $membre = $membres->get($id);
24
25 if (!$membre)
26 {
27 throw new UserException("Le membre demandé n'existe pas.");
28 }
29
30 $liste_comptes = $comptes->getListAll();
31
32 function get_nom_compte($compte)
33 {
34 if (is_null($compte))
35 return '';
36
37 global $liste_comptes;
38 return $liste_comptes[$compte];
39 }
40
41 $tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
42
43 $tpl->assign('journal', $journal->listForMember($membre['id'], $exercice));
44
45 $tpl->assign('exercices', $exercices->getList());
46 $tpl->assign('exercice', $exercice);
47 $tpl->assign('membre', $membre);
48
49 $tpl->display('admin/compta/operations/membre.tpl');
50
51 ?>