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.');
22 if (!empty($_POST['close']))
24 if (!utils
::CSRF_check('compta_cloturer_exercice_'.$exercice['id']))
26 $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
32 $id = $e->close($exercice['id'], utils
::post('fin'));
34 if ($id && utils
::post('reports'))
36 $e->doReports($exercice['id'], utils
::modifyDate(utils
::post('fin'), '+1 day'));
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/cloturer.tpl');