4 require_once __DIR__
. '/../_inc.php';
6 if ($user['droits']['compta'] < Membres
::DROIT_ADMIN
)
8 throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
11 $e = new Compta_Exercices
;
13 $exercice = $e->get((int)utils
::get('id'));
17 throw new UserException('Exercice inconnu.');
20 if ($exercice['cloture'])
22 throw new UserException('Impossible de supprimer un exercice clôturé.');
27 if (!empty($_POST['delete']))
29 if (!utils
::CSRF_check('compta_supprimer_exercice_'.$exercice['id']))
31 $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
37 $id = $e->delete($exercice['id']);
39 utils
::redirect('/admin/compta/exercices/');
41 catch (UserException
$e)
43 $error = $e->getMessage();
48 $tpl->assign('error', $error);
49 $tpl->assign('exercice', $exercice);
51 $tpl->display('admin/compta/exercices/supprimer.tpl');