Overview
Comment:type_parent can take any type value now
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 7f458dbc19fa6ba1f7de0f638a9fa47583265132
User & Date: bohwaz on 2020-09-09 21:15:03
Other Links: branch diff | manifest | tags
Context
2020-09-09
21:15
Split parameters and attributes, implement list inputs check-in: cd293e7c10 user: bohwaz tags: dev
21:15
type_parent can take any type value now check-in: 7f458dbc19 user: bohwaz tags: dev
2020-09-08
19:04
Par défaut emmener aux comptes utilisés couramment, pas aux plans comptables check-in: fd45d46da3 user: bohwaz tags: dev
Changes

Modified src/include/data/1.0.0_migration.sql from [057751f805] to [96c4b53767].

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
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







-
-
+
+











+
+
+


+



+



+

+
+
+

-
+

-
+
+







--.read plan_comptable_2020.sql

-- Migration comptes de code comme identifiant à ID unique
INSERT INTO acc_accounts (id, id_chart, code, label, position, user)
	SELECT NULL, 1, id, libelle, position, CASE WHEN plan_comptable = 1 THEN 0 ELSE 1 END FROM compta_comptes;

-- Migrations projets vers comptes analytiques
INSERT INTO acc_accounts (id_chart, code, label, position, user, type, type_parent)
	VALUES (1, '99', 'Projets', 0, 1, 6, 1);
INSERT INTO acc_accounts (id_chart, code, label, position, user, type)
	VALUES (1, '99', 'Projets', 0, 1, 6);

INSERT INTO acc_accounts (id_chart, code, label, position, user, type)
	SELECT 1, '99' || substr('0000' || id, -4), libelle, 0, 1, 6 FROM compta_projets;

-- Suppression des positions "actif ou passif" et "charge ou produit"
UPDATE acc_accounts SET position = 0 WHERE position = 3 OR position = 12;

-- Modification des valeurs de la position (qui n'est plus un champ binaire)
UPDATE acc_accounts SET position = 3 WHERE position = 4;
UPDATE acc_accounts SET position = 4 WHERE position = 8;

UPDATE acc_accounts SET type_parent = 1 WHERE code = '7';
UPDATE acc_accounts SET type_parent = 2 WHERE code = '6';

-- Migration comptes bancaires
UPDATE acc_accounts SET type = 3 WHERE code IN (SELECT id FROM compta_comptes_bancaires);
UPDATE acc_accounts SET type_parent = 3 WHERE code = '512';

-- Caisse
UPDATE acc_accounts SET type = 4 WHERE code = '530';
UPDATE acc_accounts SET type_parent = 4 WHERE code = '53';

-- Chèques et carte à encaisser
UPDATE acc_accounts SET type = 5 WHERE code = '5112' OR code = '5113';
UPDATE acc_accounts SET type_parent = 5 WHERE code = '51';

-- Comptes analytiques
UPDATE acc_accounts SET type_parent = 6 WHERE code = '9';

-- Bénévolat en nature
UPDATE acc_accounts SET type = 7 WHERE code = '870';
UPDATE acc_accounts SET type_parent = 7 WHERE code = '870';

-- FIXME: ajout parents des types
-- Comptes de tiers
UPDATE acc_accounts SET type_parent = 4 WHERE code = '4';

-- Recopie des mouvements
INSERT INTO acc_transactions (id, label, notes, reference, date, id_year)
	SELECT id, libelle, remarques, numero_piece, date, id_exercice
	FROM compta_journal;

-- Création des lignes associées aux mouvements

Modified src/include/data/1.0.0_schema.sql from [e01cddf2b1] to [d98aa45b1a].

198
199
200
201
202
203
204
205
206


207
208
209
210
211
212
213
198
199
200
201
202
203
204


205
206
207
208
209
210
211
212
213







-
-
+
+








    code TEXT NOT NULL, -- peut contenir des lettres, eg. 53A, 53B, etc.

    label TEXT NOT NULL,
    description TEXT NULL,

    position INTEGER NOT NULL, -- position actif/passif/charge/produit
    type INTEGER NOT NULL DEFAULT 0, -- Type de compte spécial : banque, caisse, en attente d'encaissement, favori, etc.
    type_parent INTEGER NOT NULL DEFAULT 0, -- Parent d'un type (eg. code = 53 aura comme type = banque et type_parent = 1 pour indiquer que c'est sous ce compte que doivent être créés les sous-comptes banque)
    type INTEGER NOT NULL DEFAULT 0, -- Type de compte spécial : banque, caisse, en attente d'encaissement, etc.
    type_parent INTEGER NOT NULL DEFAULT 0, -- Parent d'un type (eg. code = 53 aura comme type = banque et type_parent = 3 pour indiquer que c'est sous ce compte que doivent être créés les sous-comptes banque)
    user INTEGER NOT NULL DEFAULT 1 -- 1 = fait partie du plan comptable original, 0 = a été ajouté par l'utilisateur
);

CREATE UNIQUE INDEX IF NOT EXISTS acc_accounts_codes ON acc_accounts (code, id_chart);

CREATE TABLE IF NOT EXISTS acc_years
-- Exercices

Modified src/include/lib/Garradin/Entities/Accounting/Account.php from [3224d5aaad] to [2bd9e816eb].

86
87
88
89
90
91
92
93
94


95
96
97
86
87
88
89
90
91
92


93
94
95
96
97







-
-
+
+




	protected $_validation_rules = [
		'id_chart'    => 'required|integer|in_table:acc_charts,id',
		'code'        => 'required|string|alpha_num|max:10',
		'label'       => 'required|string|max:200',
		'description' => 'string|max:2000',
		'position'    => 'required|integer',
		'type'        => 'required|integer',
		'type_parent' => 'integer|min:0|max:1',
		'type'        => 'required|integer|min:0',
		'type_parent' => 'integer|min:0',
		'user'        => 'integer|min:0|max:1',
	];
}