Overview
Comment:Correction export compta patch de @Arnaud
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 6b75fcbeef7829fbb0126170bd518dac644ed544
User & Date: bohwaz on 2018-10-13 00:00:50
Other Links: branch diff | manifest | tags
Context
2018-10-15
21:53
Correction bug recherche sur texte libre check-in: a4b7d7ada4 user: bohwaz tags: dev
2018-10-13
00:00
Correction export compta patch de @Arnaud check-in: 6b75fcbeef user: bohwaz tags: dev
2018-10-09
17:23
Ne pas chercher à installer les plugins si la chaîne est vide check-in: d0bdd730fa user: bohwaz tags: dev
Changes

Modified src/VERSION from [31445caf76] to [1ce8a315ca].

1
0.9.0-rc1
|
1
0.9.0-rc2

Modified src/include/lib/Garradin/Compta/Import.php from [dbc9be8854] to [d8cc440c1c].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
		'Numéro de chèque',
		'Numéro de pièce',
		'Remarques'
	];

	protected function export($exercice)
	{
		return DB::getInstance()->prepare('SELECT
			journal.id,
			strftime(\'%d/%m/%Y\', date) AS date,
			(CASE cat.type WHEN 1 THEN \'Recette\' WHEN -1 THEN \'Dépense\' ELSE \'Autre\' END) AS type,
			(CASE cat.intitule WHEN NULL THEN \'\' ELSE cat.intitule END) AS cat,
			journal.libelle,
			montant,
			compte_debit,
................................................................................
			FROM compta_journal AS journal
				LEFT JOIN compta_categories AS cat ON cat.id = journal.id_categorie
				LEFT JOIN compta_comptes AS debit ON debit.id = journal.compte_debit
				LEFT JOIN compta_comptes AS credit ON credit.id = journal.compte_credit
				LEFT JOIN compta_moyens_paiement AS moyen ON moyen.code = journal.moyen_paiement
			WHERE id_exercice = '.(int)$exercice.'
			ORDER BY journal.date;
		')->execute();
	}

	protected function exportName()
	{
		return sprintf('Export comptabilité - %s - %s', Config::getInstance()->get('nom_asso'), date('Y-m-d'));
	}

	public function toCSV($exercice)
	{
		return Utils::toCSV($this->exportName(), $this->export($exercice));
	}

	public function toODS($exercice)
	{
		return Utils::toODS($this->exportName(), $this->export($exercice));
	}

	public function fromCSV($path)
	{
		if (!file_exists($path) || !is_readable($path))
		{
			throw new \RuntimeException('Fichier inconnu : '.$path);







|







 







|









|




|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
		'Numéro de chèque',
		'Numéro de pièce',
		'Remarques'
	];

	protected function export($exercice)
	{
		return DB::getInstance()->iterate('SELECT
			journal.id,
			strftime(\'%d/%m/%Y\', date) AS date,
			(CASE cat.type WHEN 1 THEN \'Recette\' WHEN -1 THEN \'Dépense\' ELSE \'Autre\' END) AS type,
			(CASE cat.intitule WHEN NULL THEN \'\' ELSE cat.intitule END) AS cat,
			journal.libelle,
			montant,
			compte_debit,
................................................................................
			FROM compta_journal AS journal
				LEFT JOIN compta_categories AS cat ON cat.id = journal.id_categorie
				LEFT JOIN compta_comptes AS debit ON debit.id = journal.compte_debit
				LEFT JOIN compta_comptes AS credit ON credit.id = journal.compte_credit
				LEFT JOIN compta_moyens_paiement AS moyen ON moyen.code = journal.moyen_paiement
			WHERE id_exercice = '.(int)$exercice.'
			ORDER BY journal.date;
		');
	}

	protected function exportName()
	{
		return sprintf('Export comptabilité - %s - %s', Config::getInstance()->get('nom_asso'), date('Y-m-d'));
	}

	public function toCSV($exercice)
	{
		return Utils::toCSV($this->exportName(), $this->export($exercice), $this->header);
	}

	public function toODS($exercice)
	{
		return Utils::toODS($this->exportName(), $this->export($exercice), $this->header);
	}

	public function fromCSV($path)
	{
		if (!file_exists($path) || !is_readable($path))
		{
			throw new \RuntimeException('Fichier inconnu : '.$path);