Overview
Comment:Fix projects balances, fix [a8f507d0c033d6c8540797ea0f37e076781cc101]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: e50fecb3979ef016f328f12eff2e3ac9bbac29d518d2c9f4b55c04c36554450f
User & Date: bohwaz on 2022-04-05 14:10:09
Other Links: manifest | tags
References
2022-04-05
14:10 Fixed ticket [a8f507d0c0]: Totaux charges et produits par projet plus 4 other changes artifact: 85b32a691c user: bohwaz
Context
2022-04-06
11:40
Make sure $id can be null check-in: f74c5b2444 user: bohwaz tags: trunk, stable
2022-04-05
14:10
Fix projects balances, fix [a8f507d0c033d6c8540797ea0f37e076781cc101] check-in: e50fecb397 user: bohwaz tags: trunk, stable
02:59
Storage quota will be easier to understand like this check-in: 44ab3a3cdd user: bohwaz tags: trunk
Changes

Modified src/include/data/1.1.0_schema.sql from [8475b86e68] to [ec0b389c55].

200
201
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217
                credit - debit
        END AS balance,
        CASE WHEN debit - credit > 0 THEN 1 ELSE 0 END AS is_debt
    FROM (
        SELECT t.id_year, l.id_analytical, a.id, a.label, a.code, a.position, a.type,
            SUM(l.credit) AS credit,
            SUM(l.debit) AS debit
        FROM acc_accounts a
        INNER JOIN acc_transactions_lines l ON l.id_account = a.id
        INNER JOIN acc_transactions t ON t.id = l.id_transaction

        GROUP BY l.id_analytical, a.id
    );

CREATE TABLE IF NOT EXISTS acc_years
-- Exercices
(
    id INTEGER NOT NULL PRIMARY KEY,








<
|

>
|







200
201
202
203
204
205
206

207
208
209
210
211
212
213
214
215
216
217
                credit - debit
        END AS balance,
        CASE WHEN debit - credit > 0 THEN 1 ELSE 0 END AS is_debt
    FROM (
        SELECT t.id_year, l.id_analytical, a.id, a.label, a.code, a.position, a.type,
            SUM(l.credit) AS credit,
            SUM(l.debit) AS debit

        FROM acc_transactions_lines l
        INNER JOIN acc_transactions t ON t.id = l.id_transaction
        INNER JOIN acc_accounts a ON a.id = l.id_account
        GROUP BY l.id_analytical, a.id, t.id_year
    );

CREATE TABLE IF NOT EXISTS acc_years
-- Exercices
(
    id INTEGER NOT NULL PRIMARY KEY,

Modified src/include/data/schema.sql from [8475b86e68] to [ec0b389c55].

200
201
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217
                credit - debit
        END AS balance,
        CASE WHEN debit - credit > 0 THEN 1 ELSE 0 END AS is_debt
    FROM (
        SELECT t.id_year, l.id_analytical, a.id, a.label, a.code, a.position, a.type,
            SUM(l.credit) AS credit,
            SUM(l.debit) AS debit
        FROM acc_accounts a
        INNER JOIN acc_transactions_lines l ON l.id_account = a.id
        INNER JOIN acc_transactions t ON t.id = l.id_transaction

        GROUP BY l.id_analytical, a.id
    );

CREATE TABLE IF NOT EXISTS acc_years
-- Exercices
(
    id INTEGER NOT NULL PRIMARY KEY,








<
|

>
|







200
201
202
203
204
205
206

207
208
209
210
211
212
213
214
215
216
217
                credit - debit
        END AS balance,
        CASE WHEN debit - credit > 0 THEN 1 ELSE 0 END AS is_debt
    FROM (
        SELECT t.id_year, l.id_analytical, a.id, a.label, a.code, a.position, a.type,
            SUM(l.credit) AS credit,
            SUM(l.debit) AS debit

        FROM acc_transactions_lines l
        INNER JOIN acc_transactions t ON t.id = l.id_transaction
        INNER JOIN acc_accounts a ON a.id = l.id_account
        GROUP BY l.id_analytical, a.id, t.id_year
    );

CREATE TABLE IF NOT EXISTS acc_years
-- Exercices
(
    id INTEGER NOT NULL PRIMARY KEY,

Modified src/include/lib/Garradin/Upgrade.php from [a64a74d4bb] to [a344c2f187].

419
420
421
422
423
424
425










426
427
428
429
430
431
432
				$db->commit();
			}

			if (version_compare($v, '1.1.23', '<')) {
				$db->begin();
				// Create acc_accounts_projects_balances view
				$db->import(ROOT . '/include/data/1.1.0_schema.sql');










				$db->commit();
			}

			// Vérification de la cohérence des clés étrangères
			$db->foreignKeyCheck();

			// Delete local cached files







>
>
>
>
>
>
>
>
>
>







419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
				$db->commit();
			}

			if (version_compare($v, '1.1.23', '<')) {
				$db->begin();
				// Create acc_accounts_projects_balances view
				$db->import(ROOT . '/include/data/1.1.0_schema.sql');
				$db->commit();
			}

			if (version_compare($v, '1.1.24', '<')) {
				$db->begin();

				// Re-create acc_accounts_projects_balances view
				$db->exec('DROP VIEW IF EXISTS acc_accounts_projects_balances;');
				$db->import(ROOT . '/include/data/1.1.0_schema.sql');

				$db->commit();
			}

			// Vérification de la cohérence des clés étrangères
			$db->foreignKeyCheck();

			// Delete local cached files