Overview
Comment:Restrict official chart changes to type, description and user accounts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: af6ecee421c97ab94bcf76471eb460fa37c8a748
User & Date: bohwaz on 2020-10-14 21:47:59
Other Links: branch diff | manifest | tags
Context
2020-10-15
00:48
Implement: chart import check-in: 5c5b6d21e1 user: bohwaz tags: dev
2020-10-14
21:47
Restrict official chart changes to type, description and user accounts check-in: af6ecee421 user: bohwaz tags: dev
21:28
Implement: chart export as CSV check-in: 3757b77d77 user: bohwaz tags: dev
Changes

Modified src/templates/acc/charts/accounts/all.tpl from [36a589be55] to [99ab4fa5b0].

19
20
21
22
23
24
25

26

27
28
29
30
31
32
33
34
35
			</td>
			<td>
				{if $account.user}<em>Ajouté</em>{/if}
			</td>
			<td class="actions">
				{if $session->canAccess('compta', Membres::DROIT_ADMIN) && !$chart.archived}
					{linkbutton shape="edit" label="Modifier" href="acc/charts/accounts/edit.php?id=%d"|args:$account.id}

					{linkbutton shape="delete" label="Supprimer" href="acc/charts/accounts/delete.php?id=%d"|args:$account.id}

				{/if}
			</td>
		</tr>
	{/foreach}
	</tbody>
</table>


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







>
|
>









19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
			</td>
			<td>
				{if $account.user}<em>Ajouté</em>{/if}
			</td>
			<td class="actions">
				{if $session->canAccess('compta', Membres::DROIT_ADMIN) && !$chart.archived}
					{linkbutton shape="edit" label="Modifier" href="acc/charts/accounts/edit.php?id=%d"|args:$account.id}
					{if $account.user || !$chart.code}
						{linkbutton shape="delete" label="Supprimer" href="acc/charts/accounts/delete.php?id=%d"|args:$account.id}
					{/if}
				{/if}
			</td>
		</tr>
	{/foreach}
	</tbody>
</table>


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

Modified src/templates/acc/charts/index.tpl from [ca8e8cdd2b] to [b88ecde741].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Gestion des plans comptables" current="acc/charts"}

<nav class="tabs">
	<ul>
		<li class="current"><a href="{$admin_url}acc/charts/">Plans comptables</a></li>
		{if $session->canAccess('compta', Membres::DROIT_ADMIN)}
		<li><a href="{$admin_url}acc/charts/import.php">Importer un plan comptable</a></li>
		{/if}
	</ul>
</nav>

{if $_GET.msg == 'OPEN'}
<p class="alert">
	Il n'existe aucun exercice ouvert.






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Gestion des plans comptables" current="acc/charts"}

<nav class="tabs">
	<ul>
		<li class="current"><a href="{$admin_url}acc/charts/">Plans comptables</a></li>
		{if $session->canAccess('compta', Membres::DROIT_ADMIN)}
			<li><a href="{$admin_url}acc/charts/import.php">Importer un plan comptable</a></li>
		{/if}
	</ul>
</nav>

{if $_GET.msg == 'OPEN'}
<p class="alert">
	Il n'existe aucun exercice ouvert.
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
					<td>{if $item.code}Officiel{else}Personnel{/if}</td>
					<td>{if $item.archived}<em>Archivé</em>{/if}</td>
					<td>
						{linkbutton shape="star" label="Comptes favoris" href="acc/charts/accounts/?id=%d"|args:$item.id}
						{linkbutton shape="menu" label="Tous les comptes" href="acc/charts/accounts/all.php?id=%d"|args:$item.id}
						{if $session->canAccess('compta', Membres::DROIT_ADMIN)}
							{linkbutton shape="edit" label="Modifier" href="acc/charts/edit.php?id=%d"|args:$item.id}
							{linkbutton shape="export" label="Exporter en CSV" href="acc/charts/export.php?id=%d"|args:$item.id}

							{if !$item.code && !$item.archived}
								{linkbutton shape="delete" label="Supprimer" href="acc/charts/delete.php?id=%d"|args:$item.id}
							{/if}
						{/if}
					</td>
				</tr>
			{/foreach}







|
>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
					<td>{if $item.code}Officiel{else}Personnel{/if}</td>
					<td>{if $item.archived}<em>Archivé</em>{/if}</td>
					<td>
						{linkbutton shape="star" label="Comptes favoris" href="acc/charts/accounts/?id=%d"|args:$item.id}
						{linkbutton shape="menu" label="Tous les comptes" href="acc/charts/accounts/all.php?id=%d"|args:$item.id}
						{if $session->canAccess('compta', Membres::DROIT_ADMIN)}
							{linkbutton shape="edit" label="Modifier" href="acc/charts/edit.php?id=%d"|args:$item.id}
							{linkbutton shape="export" label="Export CSV" href="acc/charts/export.php?id=%d"|args:$item.id}
							{linkbutton shape="export" label="Export tableur" href="acc/charts/export.php?id=%d&ods"|args:$item.id}
							{if !$item.code && !$item.archived}
								{linkbutton shape="delete" label="Supprimer" href="acc/charts/delete.php?id=%d"|args:$item.id}
							{/if}
						{/if}
					</td>
				</tr>
			{/foreach}

Modified src/www/admin/acc/charts/accounts/delete.php from [4ee1d4bb72] to [6c837a3adc].

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

$chart = $account->chart();

if ($chart->archived) {
	throw new UserException("Il n'est pas possible de modifier un compte d'un plan comptable archivé.");
}

if (!$account->canDelete()) {
	throw new UserException("Ce compte ne peut être supprimé car des écritures y sont liées (peut-être sur l'exercice courant ou sur un exercice clôt).\nSi vous souhaitez faire du ménage dans la liste des comptes il est recommandé de créer un nouveau comptable.");
}

if (f('delete') && $form->check('acc_accounts_delete_' . $account->id()))
{
	try
	{







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

$chart = $account->chart();

if ($chart->archived) {
	throw new UserException("Il n'est pas possible de modifier un compte d'un plan comptable archivé.");
}

if (($chart->code && !$account->user) || !$account->canDelete()) {
	throw new UserException("Ce compte ne peut être supprimé car des écritures y sont liées (peut-être sur l'exercice courant ou sur un exercice clôt).\nSi vous souhaitez faire du ménage dans la liste des comptes il est recommandé de créer un nouveau comptable.");
}

if (f('delete') && $form->check('acc_accounts_delete_' . $account->id()))
{
	try
	{

Modified src/www/admin/acc/charts/accounts/edit.php from [22d9b33346] to [918c58e783].

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

$chart = $account->chart();

if ($chart->archived) {
	throw new UserException("Il n'est pas possible de modifier un compte d'un plan comptable archivé.");
}

$can_edit = $account->canEdit();

if (f('edit') && $form->check('acc_accounts_edit_' . $account->id()))
{
	try
	{
		if ($can_edit) {
			$account->importForm();
		}
		else {
			$account->importLimitedForm();
		}








|



|
<







15
16
17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33

$chart = $account->chart();

if ($chart->archived) {
	throw new UserException("Il n'est pas possible de modifier un compte d'un plan comptable archivé.");
}

$can_edit = ($account->user || !$chart->code) && $account->canEdit();

if (f('edit') && $form->check('acc_accounts_edit_' . $account->id()))
{
	try {

		if ($can_edit) {
			$account->importForm();
		}
		else {
			$account->importLimitedForm();
		}