Overview
Comment:Page de gestion des plans comptables et vue du plan comptable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 2421f0583be2518042114839857f813782667362
User & Date: bohwaz on 2020-04-23 01:12:24
Other Links: branch diff | manifest | tags
Context
2020-04-23
23:01
Ajout nouvelles icônes check-in: 905a51a206 user: bohwaz tags: dev
01:12
Page de gestion des plans comptables et vue du plan comptable check-in: 2421f0583b user: bohwaz tags: dev
01:11
La colonne bookmark a été supprimée check-in: 6934f3c4a5 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Account.php from [35e07dec9e] to [fdf2bec7a9].

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
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74







-
-
+
+
+
+
+
+
+
+
+
+
+
+














+
+
+
+
+
+
+
+
+
+






+





+







	const TABLE = 'acc_accounts';

	const PASSIF = 1;
	const ACTIF = 2;
	const ACTIF_PASSIF = 3;

	const PRODUIT = 4;
	const CHARGE = 5;
	const PRODUIT_CHARGE = 6;
	const CHARGE = 8;
	const PRODUIT_CHARGE = 12;

	const POSITIONS_NAMES = [
		'',
		1 => 'Passif',
		2 => 'Actif',
		3 => 'Actif ou passif',
		4 => 'Produit',
		8 => 'Charge',
		12 => 'Produit ou charge',
	];

	const TYPE_NONE = 0;
	const TYPE_BANK = 1;
	const TYPE_CASH = 2;

	/**
	 * Outstanding transaction accounts (like cheque or card payments)
	 */
	const TYPE_OUTSTANDING = 3;

	const TYPE_ANALYTICAL = 4;
	const TYPE_VOLUNTEERING = 5;

	const TYPE_BOOKMARK = 6;

	const TYPES_NAMES = [
		'',
		'Banque',
		'Caisse',
		'Attente d\'encaissement',
		'Analytique',
		'Bénévolat',
		'Favori',
	];

	protected $id;
	protected $id_plan;
	protected $code;
	protected $parent;
	protected $label;
	protected $description;
	protected $position;
	protected $type;
	protected $user;

	protected $_types = [
		'id'          => 'int',
		'id_plan'     => 'int',
		'code'        => 'string',
		'parent'      => '?int',
		'label'       => 'string',
		'description' => '?string',
		'position'    => 'int',
		'type'        => 'int',

Modified src/include/lib/Garradin/Template.php from [b064cf3755] to [e722f81cb4].

1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5
6
7
8
9
10
11
12
13
14






+







<?php

namespace Garradin;

use KD2\Form;
use Garradin\Membres\Session;
use Garradin\Entities\Accounting\Account;

class Template extends \KD2\Smartyer
{
	static protected $_instance = null;

	static public function getInstance()
	{
76
77
78
79
80
81
82








83
84
85
86
87
88
89
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98







+
+
+
+
+
+
+
+







		$this->register_modifier('dump', ['KD2\ErrorManager', 'dump']);
		$this->register_modifier('get_country_name', ['Garradin\Utils', 'getCountryName']);
		$this->register_modifier('format_sqlite_date_to_french', ['Garradin\Utils', 'sqliteDateToFrench']);
		$this->register_modifier('format_bytes', ['Garradin\Utils', 'format_bytes']);
		$this->register_modifier('format_tel', [$this, 'formatPhoneNumber']);
		$this->register_modifier('abs', 'abs');
		$this->register_modifier('display_champ_membre', [$this, 'displayChampMembre']);

		$this->register_modifier('account_type', function ($value) {
			return Account::TYPES_NAMES[$value];
		});

		$this->register_modifier('account_position', function ($value) {
			return Account::POSITIONS_NAMES[$value];
		});

		$this->register_modifier('get_nom_compte', function ($compte) {
			if (is_null($compte))
			{
				return '';
			}

151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
166
167
168



169
170
171
172
173
174
175
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187







-
+










+
+
+








		return '<p class="error">' . $this->escape($params['message']) . '</p>';
	}

	protected function formInput(array $params)
	{
		static $keep_attributes = ['pattern', 'max', 'min', 'step', 'title', 'name', 'cols', 'rows'];
		extract($params);
		extract($params, \EXTR_SKIP);

		if (!isset($name, $type)) {
			throw new \InvalidArgumentException('Missing name or type');
		}

		$current_value = null;

		if (isset($_POST[$name])) {
			$current_value = $_POST[$name];
		}
		elseif (isset($default)) {
			$current_value = $default;
		}

		$required_label = array_key_exists('required', $params) ? ' <b title="Champ obligatoire">(obligatoire)</b>' : '';

		$out = sprintf('<dt><label for="f_%s">%s</label>%s</dt>', $name, $this->escape($label), $required_label);

		if (isset($help)) {
			$out .= sprintf('<dd class="help">%s</dd>', $this->escape($help));

Modified src/templates/admin/_head.tpl from [ab1e909a41] to [51d0a149c7].

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
71
72
73
74
75
76
77

78
79
80

81
82


83
84
85

86
87

88
89
90
91
92
93
94







-
+


-
+

-
-
+
+

-
+

-







                <li class="member cotisations{if $current == 'membres/cotisations'} current{/if}"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
                <li class="member message{if $current == 'membres/message'} current{/if}"><a href="{$admin_url}membres/message_collectif.php">Message collectif</a></li>
            </ul>
            {/if}
            </li>
        {/if}
        {if $session->canAccess('compta', Membres::DROIT_ACCES)}
            <li class="compta{if $current == 'compta'} current{elseif $current_parent == 'compta'} current_parent{/if}"><a href="{$admin_url}compta/"><b>€</b><i> Comptabilité</i></a>
            <li class="compta{if $current == 'acc'} current{elseif $current_parent == 'acc'} current_parent{/if}"><a href="{$admin_url}acc/"><b>€</b><i> Comptabilité</i></a>
            <ul>
            {if $session->canAccess('compta', Membres::DROIT_ECRITURE)}
                <li class="compta new{if $current == 'compta/saisie'} current{/if}"><a href="{$admin_url}compta/operations/saisir.php">Saisie</a></li>
                <li class="compta new{if $current == 'acc/new'} current{/if}"><a href="{$admin_url}acc/transactions/new.php">Saisie</a></li>
            {/if}
                <li class="compta list{if $current == 'compta/gestion'} current{/if}"><a href="{$admin_url}compta/operations/">Suivi des opérations</a></li>
                <li class="compta banks{if $current == 'compta/banques'} current{/if}"><a href="{$admin_url}compta/banques/">Banques &amp; caisse</a></li>
                <li class="compta journals{if $current == 'acc/journals'} current{/if}"><a href="{$admin_url}acc/transactions/">Journaux</a></li>
                <li class="compta admin reports{if $current == 'acc/years'} current{/if}"><a href="{$admin_url}acc/years/">Exercices &amp; rapports</a></li>
            {if $session->canAccess('compta', Membres::DROIT_ADMIN)}
                <li class="compta admin config{if $current == 'compta/categories'} current{/if}"><a href="{$admin_url}compta/categories/">Catégories &amp; comptes</a></li>
                <li class="compta admin config{if $current == 'acc/plans'} current{/if}"><a href="{$admin_url}acc/plans/">Plans comptables</a></li>
            {/if}
                <li class="compta admin reports{if $current == 'compta/exercices'} current{/if}"><a href="{$admin_url}compta/exercices/">Exercices &amp; projets</a></li>
            </ul>
            </li>
        {/if}
        {if $session->canAccess('wiki', Membres::DROIT_ACCES)}
            <li class="wiki{if $current == 'wiki'} current{elseif $current_parent == 'wiki'} current_parent{/if}"><a href="{$admin_url}wiki/"><b class="icn">✎</b><i> Wiki</i></a>
            <ul>
                <li class="wiki list{if $current == 'wiki/recent'} current{/if}"><a href="{$admin_url}wiki/recent.php">Dernières modifications</a>

Added src/templates/admin/acc/plans/accounts/index.tpl version [707bc79df3].




















































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{include file="admin/_head.tpl" title=$plan.label current="acc/plans"}

<ul class="actions">
	<li><a href="{$admin_url}acc/plans/">Gérer les plans</a></li>
	<li><a href="{$admin_url}acc/plans/import.php">Import / export</a></li>
	<li class="current"><a href="{$admin_url}acc/plans/accounts/?id={$plan.id}">Modifier le plan</a></li>
</ul>

{if count($accounts)}
	<table class="list accounts">
		<thead>
			<td>Code</td>
			<th>Libellé</th>
			<td>Position</td>
			<td></td>
			<td></td>
			<td></td>
		</thead>
		<tbody>
			{foreach from=$accounts item="item"}
				<tr class="account-level-<?=strlen($item->code)?>">
					<td>{$item.code}</td>
					<th>{$item.label}</th>
					<td>{$item.position|account_position}</td>
					<td>{$item.type|account_type}</td>
					<td>{if $item.bookmark}Favori{/if}</td>
					<td class="actions">
						{if !$item.user}
							<a class="icn" href="{$admin_url}acc/plans/delete.php?id={$item.id}" title="Supprimer">✘</a>
						{/if}
						<a class="icn" href="{$admin_url}acc/plans/edit.php?id={$item.id}" title="Modifier">✎</a>
					</td>
				</tr>
			{/foreach}
		</tbody>
	</table>
{/if}

<form method="post" action="{$self_url_no_qs}">
	<fieldset>
		<legend>Ajouter un compte au plan comptable</legend>
		<dl>
			{input type="text" name="label" label="Libellé" required=1}
		</dl>
		<p class="submit">
			<input type="submit" value="Créer &rarr;" />
		</p>
	</fieldset>
</form>

{include file="admin/_foot.tpl"}

Added src/templates/admin/acc/plans/index.tpl version [c2e9712d2e].



















































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{include file="admin/_head.tpl" title="Gestion des plans comptables" current="acc/plans"}

<ul class="actions">
	<li class="current"><a href="{$admin_url}acc/plans/">Gérer les plans</a></li>
	<li><a href="{$admin_url}acc/plans/import.php">Import / export</a></li>
	<li><a href="{$admin_url}acc/plans/reset.php">Remise à zéro</a></li>
</ul>

{if count($list)}
    <table class="list">
        <thead>
        	<td>Pays</td>
            <th>Libellé</th>
            <td></td>
        </thead>
        <tbody>
            {foreach from=$list item="item"}
                <tr>
                	<td>{$item.country|get_country_name}</td>
                    <th><a href="{$admin_url}acc/plans/accounts/?id={$item.id}">{$item.label}</a> <em>{if $item.code}(officiel){else}(copie){/if}</em></th>
                    <td class="actions">
                    	<a class="icn" href="{$admin_url}acc/plans/accounts/?id={$item.id}" title="Gérer les comptes">𝍢</a>
                        <a class="icn" href="{$admin_url}acc/plans/edit.php?id={$item.id}" title="Renommer le plan comptable">✎</a>
                        {if empty($item.code)}
                        	<a class="icn" href="{$admin_url}acc/plans/delete.php?id={$item.id}" title="Supprimer le plan comptable">✘</a>
                        {else}
                        	<a class="icn" href="{$admin_url}acc/plans/reset.php?id={$item.id}" title="Remettre à zéro">⤝</a>
                        {/if}
                    </td>
                </tr>
            {/foreach}
        </tbody>
    </table>
{/if}

<form method="post" action="{$self_url_no_qs}">
	<fieldset>
		<legend>Créer un nouveau plan comptable</legend>
		<dl>
			{input type="select_groups" name="plan" options=$plans_groupped label="Recopier depuis" required=1}
			{input type="text" name="label" label="Libellé" required=1}
			{input type="select" name="country" label="Pays" required=1 options=$country_list default=$config.pays}
		</dl>
		<p class="submit">
			<input type="submit" value="Créer &rarr;" />
		</p>
	</fieldset>
</form>

{include file="admin/_foot.tpl"}

Added src/www/admin/acc/_inc.php version [1ab6e238e9].








1
2
3
4
5
6
7
+
+
+
+
+
+
+
<?php

namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ACCES);

Added src/www/admin/acc/plans/accounts/index.php version [2fec0ea51f].


















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?php
namespace Garradin;

use Garradin\Accounting\Plans;
use Garradin\Accounting\Accounts;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ADMIN);

$plan = (new Plans)->get(qg('id'));
$accounts = new Accounts;

$tpl->assign('plan', $plan);
$tpl->assign('accounts', $accounts->listForPlan($plan->id()));

$tpl->display('admin/acc/plans/accounts/index.tpl');

Added src/www/admin/acc/plans/index.php version [c25cd6a200].

















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?php
namespace Garradin;

use Garradin\Accounting\Plans;

require_once __DIR__ . '/../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ADMIN);

$plans = new Plans;

$tpl->assign('list', $plans->list());
$tpl->assign('plans_groupped', $plans->listByCountry());
$tpl->assign('country_list', Utils::getCountryList());

$tpl->display('admin/acc/plans/index.tpl');

Modified src/www/admin/static/admin.css from [6c1a898bc9] to [b23ca5b1ed].

1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035

1036
1037
1038


1039
1040

1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053




1054
1055
1056
1057
1058
1059
1060
1061
1062
1024
1025
1026
1027
1028
1029
1030





1031



1032
1033


1034













1035
1036
1037
1038


1039
1040
1041
1042
1043
1044
1045







-
-
-
-
-
+
-
-
-
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-







    margin: .2em 0 .2em 2em;
}

.catList dd.actions {
    margin: .2em 0 1em 2em;
}

ul.accountList {
    list-style-type: square;
    margin-left: 2em;
}

table.accounts tbody tr td:first-child { font-family: monospace; }
ul.accountList > li > h4 {
    font-weight: normal;
    font-size: 1.2em;
table.accounts th { font-weight: normal; }
table.accounts .account-level-1 th { font-size: 1.6em; }
}

table.accounts .account-level-2 > th { padding-left: 1em; font-size: 1.3em; }
ul.accountList > li {
    margin-bottom: .8em;
}

table.accountList .niveau_2 .libelle {
    font-weight: bold;
}

table.accountList .niveau_3 .libelle { padding-left: 1em; }
table.accountList .niveau_4 .libelle { padding-left: 2em; }
table.accountList .niveau_5 .libelle { padding-left: 3em; }
table.accountList .niveau_6 .libelle { padding-left: 4em; }

table.accounts .account-level-3 > th { padding-left: 2em; }
table.accounts .account-level-4 > th { padding-left: 3em; }
table.accounts .account-level-5 > th { padding-left: 4em; }
table.accounts .account-level-6 > th { padding-left: 5em; }
table.rib { display: inline-table; vertical-align: middle; font-size: .9em; text-align: center; border-collapse: collapse; }
table.rib th, table.rib td { padding: .1em .3em; border: 1px solid #ccc; }

dl.describe {
    margin-bottom: 1em;
}

dl.describe > dt {
    font-weight: bold;