Overview
Comment:Don't allow to change an account type after creation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable | 1.1.31
Files: files | file ages | folders
SHA3-256: 5fcdd3cdad22e54f9cb53b667e1c12cf79fbbf2f60995a5f169cbe2a6ac1dcfb
User & Date: bohwaz on 2022-10-23 16:00:41
Other Links: manifest | tags
Context
2022-10-23
16:03
Fix account creation form check-in: 626b68762e user: bohwaz tags: trunk, stable, 1.1.31
16:00
Don't allow to change an account type after creation check-in: 5fcdd3cdad user: bohwaz tags: trunk, stable, 1.1.31
15:42
Don't overwrite types check-in: 6197a350cd user: bohwaz tags: trunk, stable, 1.1.31
Changes

Modified src/include/migrations/1.1/31.sql from [2dfa19b249] to [47163209ae].

30
31
32
33
34
35
36










UPDATE acc_accounts SET position = 5
	WHERE id_chart IN (SELECT id FROM acc_charts WHERE country = 'FR')
	AND position NOT IN (0, 5)
	AND code LIKE '87_%';

-- Force analytical to be hidden
UPDATE acc_accounts SET position = 0 WHERE type = 7 AND position != 0;

















>
>
>
>
>
>
>
>
>
>
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
UPDATE acc_accounts SET position = 5
	WHERE id_chart IN (SELECT id FROM acc_charts WHERE country = 'FR')
	AND position NOT IN (0, 5)
	AND code LIKE '87_%';

-- Force analytical to be hidden
UPDATE acc_accounts SET position = 0 WHERE type = 7 AND position != 0;

-- Remove type from accounts that are outside their class
UPDATE acc_accounts SET type = 0 WHERE type = 1 AND code NOT LIKE '51%';
UPDATE acc_accounts SET type = 0 WHERE type = 2 AND code NOT LIKE '53%';
UPDATE acc_accounts SET type = 0 WHERE type = 3 AND code NOT LIKE '511%';
UPDATE acc_accounts SET type = 0 WHERE type = 4 AND code NOT LIKE '4%';
UPDATE acc_accounts SET type = 0 WHERE type = 5 AND code NOT LIKE '6%';
UPDATE acc_accounts SET type = 0 WHERE type = 6 AND code NOT LIKE '7%';
UPDATE acc_accounts SET type = 0 WHERE type = 7 AND code NOT LIKE '9%';
UPDATE acc_accounts SET type = 0 WHERE type = 8 AND code NOT LIKE '8%';

Modified src/templates/acc/charts/accounts/_account_form.tpl from [f8489f1a1d] to [bf4d62ee33].





1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17




<dl>

	{if !$account.type || !$create}
		{input type="select" label="Type de compte usuel" name="type" source=$account required=true options=$types}
		<dd class="help">Le statut de compte usuel est utilisé pour les écritures <em>«&nbsp;simplifiées&nbsp;»</em> (recettes, dépenses, dettes, créances, virements), pour la liste des comptes, et également pour proposer certaines fonctionnalités (rapprochement pour les comptes bancaires, règlement rapide de dette et créance, dépôt de chèques).</dd>
		<dd class="help">Un compte qui n'a pas de type usuel ne pourra être utilisé que dans une saisie avancée, et ne sera visible que dans les rapports de l'exercice.</dd>
	{else}
	<dt>Type de compte</dt>
	<dd>
		<?php $t = $types[$account->type]; ?> {$t}
		<input type="hidden" name="type" value="{$account.type}" />
	</dd>
	{/if}

	{if !$account.type || $account.type == $account::TYPE_VOLUNTEERING}
		<dt><label for="f_position_0">Position au bilan ou résultat</label>{if !$edit_disabled} <b>(obligatoire)</b>{/if}</dt>
		<dd class="help">La position permet d'indiquer dans quelle partie du bilan ou du résultat doit figurer le compte.</dd>
		{input type="radio" label="Ne pas utiliser ce compte au bilan ni au résultat" name="position" value=0 source=$account disabled=$edit_disabled}
>
>
>
>

>
|
<
<
<
<



<







1
2
3
4
5
6
7




8
9
10

11
12
13
14
15
16
17
{if $create}
<input type="hidden" name="type" value="{$account.type}" />
{/if}

<dl>

	{if $account.type}




	<dt>Type de compte</dt>
	<dd>
		<?php $t = $types[$account->type]; ?> {$t}

	</dd>
	{/if}

	{if !$account.type || $account.type == $account::TYPE_VOLUNTEERING}
		<dt><label for="f_position_0">Position au bilan ou résultat</label>{if !$edit_disabled} <b>(obligatoire)</b>{/if}</dt>
		<dd class="help">La position permet d'indiquer dans quelle partie du bilan ou du résultat doit figurer le compte.</dd>
		{input type="radio" label="Ne pas utiliser ce compte au bilan ni au résultat" name="position" value=0 source=$account disabled=$edit_disabled}