Overview
Comment:Restore old description and type from accounting chart
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable | 1.1.30
Files: files | file ages | folders
SHA3-256: 74a273af6e4e32bb372a4788212e46966b50bb9bf86b067e1825cc235235b2b2
User & Date: bohwaz on 2022-09-05 12:45:14
Other Links: manifest | tags
Context
2022-09-05
23:53
Don't show something when marked as paid check-in: 52ae75fa73 user: bohwaz tags: trunk, stable
12:45
Restore old description and type from accounting chart check-in: 74a273af6e user: bohwaz tags: trunk, stable, 1.1.30
12:28
Do not change description and type when updating an account from update of installed chart check-in: 0854f56115 user: bohwaz tags: trunk, stable
Changes

Modified src/VERSION from [c0f4b881c8] to [d38cbe3167].

1
1.1.29
|
1
1.1.30

Modified src/include/lib/Garradin/Upgrade.php from [4a3335ef59] to [17a8a36014].

459
460
461
462
463
464
465




466
467
468
469
470
471
472
				$db->exec('UPDATE files_search SET content = html_decode(content) WHERE content IS NOT NULL;');
			}

			if (version_compare($v, '1.1.29', '<')) {
				Charts::updateInstalled('fr_pca_2018');
				$db->import(ROOT . '/include/data/1.1.29_migration.sql');
			}





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

			// Delete local cached files
			Utils::resetCache(USER_TEMPLATES_CACHE_ROOT);
			Utils::resetCache(STATIC_CACHE_ROOT);







>
>
>
>







459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
				$db->exec('UPDATE files_search SET content = html_decode(content) WHERE content IS NOT NULL;');
			}

			if (version_compare($v, '1.1.29', '<')) {
				Charts::updateInstalled('fr_pca_2018');
				$db->import(ROOT . '/include/data/1.1.29_migration.sql');
			}

			if (version_compare($v, '1.1.30', '<')) {
				require ROOT . '/include/migrations/1.1/30.php';
			}

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

			// Delete local cached files
			Utils::resetCache(USER_TEMPLATES_CACHE_ROOT);
			Utils::resetCache(STATIC_CACHE_ROOT);

Added src/include/migrations/1.1/30.php version [7a34d6215c].



















































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

namespace Garradin;

/*
	Dans la version 1.1.29, une mise à jour du plan comptable a écrasé les descriptions et types
	choisis par l'utilisateur. Ici nous essayons de restaurer ces valeurs à partir de la sauvegarde.
 */

$old_db = DATA_ROOT . '/association.pre-upgrade-1.1.29.sqlite';

if (!file_exists($old_db)) {
	return;
}

$db->exec(sprintf('ATTACH \'%s\' AS old;', $old_db));

$chart_id = $db->firstColumn('SELECT id FROM acc_charts WHERE code = \'PCA_2018\' AND country = \'FR\';');

$db->exec(sprintf('UPDATE acc_accounts AS a
	SET description = b.description, type = b.type
	FROM old.acc_accounts AS b
	WHERE a.id = b.id AND a.id_chart = %d;', $chart_id));

$db->exec('DETACH \'old\';');