17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
if ($exercice->cloture)
{
throw new UserException('Impossible de modifier un exercice clôturé.');
}
if ($form('edit'))
{
$form->check('compta_modif_exercice_' . $exercice->id);
$form->validate([
'libelle' => 'required',
'fin' => 'required|date',
'debut' => 'required|date',
]);
if (!$form->hasErrors())
{
try
{
$id = $e->edit($exercice->id, [
'libelle' => Utils::post('libelle'),
'debut' => Utils::post('debut'),
'fin' => Utils::post('fin'),
]);
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$error = $e->getMessage();
}
}
}
$tpl->assign('exercice', $exercice);
$tpl->display('admin/compta/exercices/modifier.tpl');
|
|
<
<
|
|
|
|
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
if ($exercice->cloture)
{
throw new UserException('Impossible de modifier un exercice clôturé.');
}
if ($form('edit'))
{
$form->check('compta_modif_exercice_' . $exercice->id, [
'libelle' => 'required',
'fin' => 'required|date',
'debut' => 'required|date',
]);
if (!$form->hasErrors())
{
try
{
$id = $e->edit($exercice->id, [
'libelle' => f('libelle'),
'debut' => f('debut'),
'fin' => f('fin'),
]);
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
}
$tpl->assign('exercice', $exercice);
$tpl->display('admin/compta/exercices/modifier.tpl');
|