Comment: | Modernisation catégories compta |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
ba738d8d9a521a1298fee3dc2d1bf184 |
User & Date: | bohwaz on 2017-08-17 00:49:34 |
Other Links: | branch diff | manifest | tags |
2017-08-17
| ||
01:34 | Modernisation : comptes bancaires check-in: ddb9d06519 user: bohwaz tags: dev | |
00:49 | Modernisation catégories compta check-in: ba738d8d9a user: bohwaz tags: dev | |
00:30 | Modernisation: saisie compta / suppression exercice check-in: eb64e66574 user: bohwaz tags: dev | |
Modified src/templates/admin/compta/categories/ajouter.tpl from [e6e518fb05] to [c81154476b].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{include file="admin/_head.tpl" title="Ajouter une catégorie" current="compta/categories"} {if $error} <p class="error"> {$error} </p> {/if} <form method="post" action="{$self_url}"> <fieldset> <legend>Ajouter une catégorie</legend> <dl> <dt><label for="f_type">Type</label> <b title="(Champ obligatoire)">obligatoire</b></dt> |
< < | < < |
1 2 3 4 5 6 7 8 9 10 |
{include file="admin/_head.tpl" title="Ajouter une catégorie" current="compta/categories"}
{form_errors}
<form method="post" action="{$self_url}">
<fieldset>
<legend>Ajouter une catégorie</legend>
<dl>
<dt><label for="f_type">Type</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
|
Modified src/templates/admin/compta/categories/modifier.tpl from [ab528c1c7f] to [744bd39187].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{include file="admin/_head.tpl" title="Modifier une catégorie" current="compta/categories"} {if $error} <p class="error"> {$error} </p> {/if} <form method="post" action="{$self_url}"> <fieldset> <legend>Modifier une catégorie</legend> <dl> <dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt> |
< < | < < |
1 2 3 4 5 6 7 8 9 10 |
{include file="admin/_head.tpl" title="Modifier une catégorie" current="compta/categories"}
{form_errors}
<form method="post" action="{$self_url}">
<fieldset>
<legend>Modifier une catégorie</legend>
<dl>
<dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
|
Modified src/templates/admin/compta/categories/supprimer.tpl from [bd5ca44d0b] to [66664b8c0b].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{include file="admin/_head.tpl" title="Supprimer une catégorie" current="compta/categories"} {if $error} <p class="error"> {$error} </p> {/if} <form method="post" action="{$self_url}"> <fieldset> <legend>Supprimer la catégorie comptable ?</legend> <h3 class="warning"> Êtes-vous sûr de vouloir supprimer la catégorie « {$cat.intitule} » ? |
< < | < < |
1 2 3 4 5 6 7 8 9 10 |
{include file="admin/_head.tpl" title="Supprimer une catégorie" current="compta/categories"}
{form_errors}
<form method="post" action="{$self_url}">
<fieldset>
<legend>Supprimer la catégorie comptable ?</legend>
<h3 class="warning">
Êtes-vous sûr de vouloir supprimer la catégorie « {$cat.intitule} » ?
|
Modified src/templates/admin/compta/operations/modifier.tpl from [f211178bbc] to [cd8b85b8f0].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{include file="admin/_head.tpl" title="Modification de l'opération n°%d"|args:$operation.id current="compta/saisie" js=1} {if $error} <p class="error"> {$error} </p> {/if} <form method="post" action="{$self_url}"> <fieldset> <legend>Informations sur l'opération</legend> <dl> <dt><label for="f_date">Date</label> <b title="(Champ obligatoire)">obligatoire</b></dt> |
< < | < < |
1 2 3 4 5 6 7 8 9 10 |
{include file="admin/_head.tpl" title="Modification de l'opération n°%d"|args:$operation.id current="compta/saisie" js=1}
{form_errors}
<form method="post" action="{$self_url}">
<fieldset>
<legend>Informations sur l'opération</legend>
<dl>
<dt><label for="f_date">Date</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
|
Modified src/templates/admin/compta/operations/supprimer.tpl from [1bac754e15] to [fd77415602].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{include file="admin/_head.tpl" title="Supprimer une opération" current="compta/gestion"} {if $error} <p class="error"> {$error} </p> {/if} <form method="post" action="{$self_url}"> <fieldset> <legend>Supprimer cette opération ?</legend> <h3 class="warning"> Êtes-vous sûr de vouloir supprimer l'opération n°{$operation.id} |
< < | < < |
1 2 3 4 5 6 7 8 9 10 |
{include file="admin/_head.tpl" title="Supprimer une opération" current="compta/gestion"}
{form_errors}
<form method="post" action="{$self_url}">
<fieldset>
<legend>Supprimer cette opération ?</legend>
<h3 class="warning">
Êtes-vous sûr de vouloir supprimer l'opération n°{$operation.id}
|
Modified src/www/admin/compta/categories/ajouter.php from [6e722cc3e8] to [532e949958].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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 |
<?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $cats = new Compta\Categories; $error = false; if (!empty($_POST['add'])) { if (!Utils::CSRF_check('compta_ajout_cat')) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } else { try { $id = $cats->add([ 'intitule' => Utils::post('intitule'), 'description' => Utils::post('description'), 'compte' => Utils::post('compte'), 'type' => Utils::post('type'), ]); if (Utils::post('type') == Compta\Categories::DEPENSES) $type = 'depenses'; elseif (Utils::post('type') == Compta\Categories::AUTRES) $type = 'autres'; else $type = 'recettes'; Utils::redirect('/admin/compta/categories/?'.$type); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('type', isset($_POST['type']) ? Utils::post('type') : Compta\Categories::RECETTES); $tpl->assign('comptes', $comptes->listTree()); $tpl->assign('categories', $cats); $tpl->display('admin/compta/categories/ajouter.tpl'); |
> > > | | | | | | | | | | | | | | | | | | | < < |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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 |
<?php namespace Garradin; use Garradin\Compta\Categories; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $cats = new Categories; if (f('add')) { $form->check('compta_ajout_cat', [ 'intitule' => 'required|string', 'compte' => 'required|in_table:compta_comptes,id', 'type' => 'required|in:' . implode(',', [Categories::DEPENSES, Categories::RECETTES, Categories::AUTRES]), ]); if (!$form->hasErrors()) { try { $id = $cats->add([ 'intitule' => f('intitule'), 'description' => f('description'), 'compte' => f('compte'), 'type' => f('type'), ]); if (f('type') == Categories::DEPENSES) $type = 'depenses'; elseif (f('type') == Categories::AUTRES) $type = 'autres'; else $type = 'recettes'; Utils::redirect('/admin/compta/categories/?'.$type); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('type', f('type') !== null ? f('type') : Categories::RECETTES); $tpl->assign('comptes', $comptes->listTree()); $tpl->assign('categories', $cats); $tpl->display('admin/compta/categories/ajouter.tpl'); |
Modified src/www/admin/compta/categories/modifier.php from [b91c181e44] to [6f533a8d90].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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 54 |
<?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $cats = new Compta\Categories; $id = (int)qg('id'); $cat = $cats->get($id); if (!$cat) { throw new UserException('Cette catégorie n\'existe pas.'); } $error = false; if (!empty($_POST['save'])) { if (!Utils::CSRF_check('compta_edit_cat_'.$cat['id'])) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } else { try { $id = $cats->edit($id, [ 'intitule' => Utils::post('intitule'), 'description' => Utils::post('description'), ]); if ($cat['type'] == Compta\Categories::DEPENSES) $type = 'depenses'; elseif ($cat['type'] == Compta\Categories::AUTRES) $type = 'autres'; else $type = 'recettes'; Utils::redirect('/admin/compta/categories/?'.$type); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('cat', $cat); $tpl->display('admin/compta/categories/modifier.tpl'); |
> > > | | | < < | > > | | < < | | | | | < |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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 54 |
<?php namespace Garradin; use Garradin\Compta\Categories; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $cats = new Categories; $id = (int)qg('id'); $cat = $cats->get($id); if (!$cat) { throw new UserException('Cette catégorie n\'existe pas.'); } if (f('save')) { $form->check('compta_edit_cat_' . $cat->id, [ 'intitule' => 'required|string', ]); if (!$form->hasErrors()) { try { $id = $cats->edit($id, [ 'intitule' => f('intitule'), 'description' => f('description'), ]); if ($cat->type == Compta\Categories::DEPENSES) $type = 'depenses'; elseif ($cat->type == Compta\Categories::AUTRES) $type = 'autres'; else $type = 'recettes'; Utils::redirect('/admin/compta/categories/?'.$type); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('cat', $cat); $tpl->display('admin/compta/categories/modifier.tpl'); |
Modified src/www/admin/compta/categories/supprimer.php from [57188aaeb9] to [974d7c46fd].
1
2
3
4
5
6
7
8
9
..
13
14
15
16
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
|
<?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $cats = new Compta\Categories; ................................................................................ if (!$cat) { throw new UserException('Cette catégorie n\'existe pas.'); } $error = false; if (!empty($_POST['delete'])) { if (!Utils::CSRF_check('delete_compta_cat_'.$cat['id'])) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } else { try { $cats->delete($id); Utils::redirect('/admin/compta/categories/'); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('cat', $cat); $tpl->display('admin/compta/categories/supprimer.tpl'); |
>
>
>
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|
|
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
..
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?php namespace Garradin; use Garradin\Compta\Categories; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $cats = new Compta\Categories; ................................................................................ if (!$cat) { throw new UserException('Cette catégorie n\'existe pas.'); } $error = false; if (f('delete') && $form->check('delete_compta_cat_' . $cat->id)) { try { $cats->delete($id); Utils::redirect('/admin/compta/categories/'); } catch (UserException $e) { $form->addError($e->getMessage()); } } $tpl->assign('cat', $cat); $tpl->display('admin/compta/categories/supprimer.tpl'); |
Modified src/www/admin/compta/exercices/modifier.php from [8d3dd0276d] to [fb07ad0c31].
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'); |
Modified src/www/admin/compta/operations/modifier.php from [5caac0bd9a] to [bf4b999eb2].
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
$type = $categorie->type; } else { $type = null; } $error = false; if (!empty($_POST['save'])) { if (!Utils::CSRF_check('compta_modifier_'.$operation['id'])) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } else { try { if (is_null($type)) { $journal->edit($operation['id'], [ 'libelle' => Utils::post('libelle'), 'montant' => Utils::post('montant'), 'date' => Utils::post('date'), 'compte_credit' => Utils::post('compte_credit'), 'compte_debit' => Utils::post('compte_debit'), 'numero_piece' => Utils::post('numero_piece'), 'remarques' => Utils::post('remarques'), ]); } else { $cat = $cats->get(Utils::post('id_categorie')); if (!$cat) { throw new UserException('Il faut choisir une catégorie.'); } if (!array_key_exists(Utils::post('moyen_paiement'), $cats->listMoyensPaiement())) { throw new UserException('Moyen de paiement invalide.'); } if (Utils::post('moyen_paiement') == 'ES') { $a = Compta\Comptes::CAISSE; $b = $cat->compte; } else { if (!trim(Utils::post('banque'))) { throw new UserException('Le compte bancaire choisi est invalide.'); } if (!array_key_exists(Utils::post('banque'), $banques->getList())) { throw new UserException('Le compte bancaire choisi n\'existe pas.'); } $a = Utils::post('banque'); $b = $cat->compte; } if ($type == Compta\Categories::DEPENSES) { $debit = $b; $credit = $a; ................................................................................ } elseif ($type == Compta\Categories::RECETTES) { $debit = $a; $credit = $b; } $journal->edit($operation['id'], [ 'libelle' => Utils::post('libelle'), 'montant' => Utils::post('montant'), 'date' => Utils::post('date'), 'moyen_paiement'=> Utils::post('moyen_paiement'), 'numero_cheque' => Utils::post('numero_cheque'), 'compte_credit' => $credit, 'compte_debit' => $debit, 'numero_piece' => Utils::post('numero_piece'), 'remarques' => Utils::post('remarques'), 'id_categorie' => (int)$cat['id'], ]); } Utils::redirect('/admin/compta/operations/voir.php?id='.(int)$operation['id']); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('type', $type); if ($type === null) { $tpl->assign('comptes', $comptes->listTree()); } else |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
$type = $categorie->type; } else { $type = null; } if (f('save')) { $form->check('compta_modifier_' . $operation->id, [ 'libelle' => 'required|string', 'montant' => 'required|money', 'date' => 'required|date_format:Y-m-d', ]); if (!$form->hasErrors()) { try { if (is_null($type)) { $journal->edit($operation->id, [ 'libelle' => f('libelle'), 'montant' => f('montant'), 'date' => f('date'), 'compte_credit' => f('compte_credit'), 'compte_debit' => f('compte_debit'), 'numero_piece' => f('numero_piece'), 'remarques' => f('remarques'), ]); } else { $cat = $cats->get(f('id_categorie')); if (!$cat) { throw new UserException('Il faut choisir une catégorie.'); } if (!array_key_exists(f('moyen_paiement'), $cats->listMoyensPaiement())) { throw new UserException('Moyen de paiement invalide.'); } if (f('moyen_paiement') == 'ES') { $a = Compta\Comptes::CAISSE; $b = $cat->compte; } else { if (!trim(f('banque'))) { throw new UserException('Le compte bancaire choisi est invalide.'); } if (!array_key_exists(f('banque'), $banques->getList())) { throw new UserException('Le compte bancaire choisi n\'existe pas.'); } $a = f('banque'); $b = $cat->compte; } if ($type == Compta\Categories::DEPENSES) { $debit = $b; $credit = $a; ................................................................................ } elseif ($type == Compta\Categories::RECETTES) { $debit = $a; $credit = $b; } $journal->edit($operation->id, [ 'libelle' => f('libelle'), 'montant' => f('montant'), 'date' => f('date'), 'moyen_paiement'=> f('moyen_paiement'), 'numero_cheque' => f('numero_cheque'), 'compte_credit' => $credit, 'compte_debit' => $debit, 'numero_piece' => f('numero_piece'), 'remarques' => f('remarques'), 'id_categorie' => (int)$cat->id, ]); } Utils::redirect('/admin/compta/operations/voir.php?id='.(int)$operation->id); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('type', $type); if ($type === null) { $tpl->assign('comptes', $comptes->listTree()); } else |
Modified src/www/admin/compta/operations/supprimer.php from [dd52dcb16d] to [ad64e3417f].
1
2
3
4
5
6
7
8
..
10
11
12
13
14
15
16
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
|
<?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $journal = new Compta\Journal; ................................................................................ $operation = $journal->get(qg('id')); if (!$operation) { throw new UserException("L'opération demandée n'existe pas."); } $error = false; if (f('delete')) { if (!Utils::CSRF_check('compta_supprimer_'.$operation['id'])) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } else { try { $journal->delete($operation->id); Utils::redirect('/admin/compta/operations/'); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('operation', $operation); $tpl->display('admin/compta/operations/supprimer.tpl'); |
>
<
<
|
<
<
<
<
|
<
<
|
1
2
3
4
5
6
7
8
9
..
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ADMIN); $journal = new Compta\Journal; ................................................................................ $operation = $journal->get(qg('id')); if (!$operation) { throw new UserException("L'opération demandée n'existe pas."); } if (f('delete')) { if ($form->check('compta_supprimer_' . $operation->id)) { try { $journal->delete($operation->id); Utils::redirect('/admin/compta/operations/'); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('operation', $operation); $tpl->display('admin/compta/operations/supprimer.tpl'); |