4 require_once __DIR__
. '/../../_inc.php';
6 if ($user['droits']['membres'] < Membres
::DROIT_ECRITURE
)
8 throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
11 $cotisations = new Cotisations
;
13 if ($user['droits']['membres'] >= Membres
::DROIT_ADMIN
)
15 $cats = new Compta_Categories
;
19 if (!empty($_POST['save']))
21 if (!utils
::CSRF_check('new_cotisation'))
23 $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
28 $duree = utils
::post('periodicite') == 'jours' ?
(int) utils
::post('duree') : null;
29 $debut = utils
::post('periodicite') == 'date' ? utils
::post('debut') : null;
30 $fin = utils
::post('periodicite') == 'date' ? utils
::post('fin') : null;
31 $id_cat = utils
::post('categorie') ?
(int) utils
::post('id_categorie_compta') : null;
34 'intitule' => utils
::post('intitule'),
35 'description' => utils
::post('description'),
36 'montant' => (float) utils
::post('montant'),
40 'id_categorie_compta'=> $id_cat,
43 utils
::redirect('/admin/membres/cotisations/');
45 catch (UserException
$e)
47 $error = $e->getMessage();
52 $tpl->assign('error', $error);
53 $tpl->assign('categories', $cats->getList(Compta_Categories
::RECETTES
));
57 $tpl->assign('liste', $cotisations->listCurrentWithStats());
59 $tpl->display('admin/membres/cotisations/index.tpl');