Overview
Comment:Gestion de projets (compta analytique)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: f571ba36401de4eff6c7f9e5fce7a088fcf34f26
User & Date: bohwaz on 2017-10-11 04:53:31
Other Links: branch diff | manifest | tags
Context
2017-10-11
05:09
Mention du nom du membre dans le libellé (corrige [e0e31b676809fa82cfc38535a602fc63d41a7e70]) check-in: d0463fc9a5 user: bohwaz tags: dev
04:53
Gestion de projets (compta analytique) check-in: f571ba3640 user: bohwaz tags: dev
00:38
Ajoute option : chèques / CB à encaisser check-in: bc71c0882c user: bohwaz tags: dev
Changes

Modified src/include/data/0.8.0.sql from [9ec86cab92] to [d1406fb553].

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
INSERT INTO rappels SELECT * FROM rappels_old;
INSERT INTO rappels_envoyes SELECT id, id_membre, id_cotisation, id_rappel, date, media FROM rappels_envoyes_old;
INSERT INTO wiki_pages SELECT * FROM wiki_pages_old;
INSERT INTO wiki_revisions SELECT * FROM wiki_revisions_old;
INSERT INTO compta_categories SELECT * FROM compta_categories_old;
INSERT INTO compta_comptes_bancaires SELECT * FROM compta_comptes_bancaires_old;
INSERT INTO compta_exercices SELECT * FROM compta_exercices_old;
INSERT INTO compta_journal SELECT * FROM compta_journal_old;
INSERT INTO compta_rapprochement SELECT * FROM compta_rapprochement_old;
INSERT INTO fichiers SELECT * FROM fichiers_old;
INSERT INTO membres_operations SELECT * FROM membres_operations_old;
INSERT INTO membres_categories SELECT * FROM membres_categories_old;

-- Suppression des anciennes tables
DROP TABLE cotisations_membres_old;







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
INSERT INTO rappels SELECT * FROM rappels_old;
INSERT INTO rappels_envoyes SELECT id, id_membre, id_cotisation, id_rappel, date, media FROM rappels_envoyes_old;
INSERT INTO wiki_pages SELECT * FROM wiki_pages_old;
INSERT INTO wiki_revisions SELECT * FROM wiki_revisions_old;
INSERT INTO compta_categories SELECT * FROM compta_categories_old;
INSERT INTO compta_comptes_bancaires SELECT * FROM compta_comptes_bancaires_old;
INSERT INTO compta_exercices SELECT * FROM compta_exercices_old;
INSERT INTO compta_journal SELECT *, NULL FROM compta_journal_old;
INSERT INTO compta_rapprochement SELECT * FROM compta_rapprochement_old;
INSERT INTO fichiers SELECT * FROM fichiers_old;
INSERT INTO membres_operations SELECT * FROM membres_operations_old;
INSERT INTO membres_categories SELECT * FROM membres_categories_old;

-- Suppression des anciennes tables
DROP TABLE cotisations_membres_old;

Modified src/include/data/schema.sql from [9abfe9b965] to [1c0ae41b79].

232
233
234
235
236
237
238








239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260

261
262
263
264
265
266
267

268
269
270
271
272
273
274
    banque TEXT NOT NULL,

    iban TEXT NULL,
    bic TEXT NULL,

    FOREIGN KEY(id) REFERENCES compta_comptes(id) ON DELETE CASCADE
);









CREATE TABLE IF NOT EXISTS compta_journal
-- Journal des opérations comptables
(
    id INTEGER PRIMARY KEY,

    libelle TEXT NOT NULL,
    remarques TEXT NULL,
    numero_piece TEXT NULL, -- N° de pièce comptable

    montant REAL NOT NULL,

    date TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date) IS NOT NULL AND date(date) = date),
    moyen_paiement TEXT NULL,
    numero_cheque TEXT NULL,

    compte_debit TEXT NULL, -- N° du compte dans le plan, NULL est utilisé pour une opération qui vient d'un exercice précédent
    compte_credit TEXT NULL, -- N° du compte dans le plan

    id_exercice INTEGER NULL DEFAULT NULL, -- En cas de compta simple, l'exercice est permanent (NULL)
    id_auteur INTEGER NULL,
    id_categorie INTEGER NULL, -- Numéro de catégorie (en mode simple)


    FOREIGN KEY(moyen_paiement) REFERENCES compta_moyens_paiement(code),
    FOREIGN KEY(compte_debit) REFERENCES compta_comptes(id),
    FOREIGN KEY(compte_credit) REFERENCES compta_comptes(id),
    FOREIGN KEY(id_exercice) REFERENCES compta_exercices(id),
    FOREIGN KEY(id_auteur) REFERENCES membres(id) ON DELETE SET NULL,
    FOREIGN KEY(id_categorie) REFERENCES compta_categories(id) ON DELETE SET NULL

);

CREATE INDEX IF NOT EXISTS compta_operations_exercice ON compta_journal (id_exercice);
CREATE INDEX IF NOT EXISTS compta_operations_date ON compta_journal (date);
CREATE INDEX IF NOT EXISTS compta_operations_comptes ON compta_journal (compte_debit, compte_credit);
CREATE INDEX IF NOT EXISTS compta_operations_auteur ON compta_journal (id_auteur);








>
>
>
>
>
>
>
>




|

















>






|
>







232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
    banque TEXT NOT NULL,

    iban TEXT NULL,
    bic TEXT NULL,

    FOREIGN KEY(id) REFERENCES compta_comptes(id) ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS compta_projets
-- Projets (compta analytique)
(
    id INTEGER PRIMARY KEY NOT NULL,

    libelle TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS compta_journal
-- Journal des opérations comptables
(
    id INTEGER PRIMARY KEY NOT NULL,

    libelle TEXT NOT NULL,
    remarques TEXT NULL,
    numero_piece TEXT NULL, -- N° de pièce comptable

    montant REAL NOT NULL,

    date TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date) IS NOT NULL AND date(date) = date),
    moyen_paiement TEXT NULL,
    numero_cheque TEXT NULL,

    compte_debit TEXT NULL, -- N° du compte dans le plan, NULL est utilisé pour une opération qui vient d'un exercice précédent
    compte_credit TEXT NULL, -- N° du compte dans le plan

    id_exercice INTEGER NULL DEFAULT NULL, -- En cas de compta simple, l'exercice est permanent (NULL)
    id_auteur INTEGER NULL,
    id_categorie INTEGER NULL, -- Numéro de catégorie (en mode simple)
    id_projet INTEGER NULL,

    FOREIGN KEY(moyen_paiement) REFERENCES compta_moyens_paiement(code),
    FOREIGN KEY(compte_debit) REFERENCES compta_comptes(id),
    FOREIGN KEY(compte_credit) REFERENCES compta_comptes(id),
    FOREIGN KEY(id_exercice) REFERENCES compta_exercices(id),
    FOREIGN KEY(id_auteur) REFERENCES membres(id) ON DELETE SET NULL,
    FOREIGN KEY(id_categorie) REFERENCES compta_categories(id) ON DELETE SET NULL,
    FOREIGN KEY(id_projet) REFERENCES compta_projets(id) ON DELETE SET NULL
);

CREATE INDEX IF NOT EXISTS compta_operations_exercice ON compta_journal (id_exercice);
CREATE INDEX IF NOT EXISTS compta_operations_date ON compta_journal (date);
CREATE INDEX IF NOT EXISTS compta_operations_comptes ON compta_journal (compte_debit, compte_credit);
CREATE INDEX IF NOT EXISTS compta_operations_auteur ON compta_journal (id_auteur);

Modified src/include/lib/Garradin/Compta/Exercices.php from [08a6fdce95] to [f4ee66c0c1].

315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
        if (empty($data['fin']) || !checkdate(substr($data['fin'], 5, 2), substr($data['fin'], 8, 2), substr($data['fin'], 0, 4)))
        {
            throw new UserException('Date de fin vide ou invalide.');
        }

        return true;
    }


    public function getJournal($exercice)
    {
        $db = DB::getInstance();
        return $db->get('SELECT *, strftime(\'%s\', date) AS date FROM compta_journal
            WHERE id_exercice = ? ORDER BY date, id;', $exercice);
    }

    public function getGrandLivre($exercice)
    {
        $db = DB::getInstance();
        $livre = ['classes' => [], 'debit' => 0.0, 'credit' => 0.0];

        $res = $db->preparedQuery('SELECT compte FROM
            (SELECT compte_debit AS compte FROM compta_journal
                    WHERE id_exercice = :exercice GROUP BY compte_debit
                UNION
                SELECT compte_credit AS compte FROM compta_journal
                    WHERE id_exercice = :exercice GROUP BY compte_credit)
            ORDER BY compte ASC;', ['exercice' => (int) $exercice]);

        while ($row = $res->fetchArray(SQLITE3_NUM))
        {
            $compte = $row[0];

            if (is_null($compte))
                continue;

            $classe = substr($compte, 0, 1);
            $parent = substr($compte, 0, 2);

            if (!array_key_exists($classe, $livre['classes']))
            {
                $livre['classes'][$classe] = [];
            }

            if (!array_key_exists($parent, $livre['classes'][$classe]))
            {
                $livre['classes'][$classe][$parent] = [
                    'total'         =>  0.0,
                    'comptes'       =>  [],
                ];
            }

            $livre['classes'][$classe][$parent]['comptes'][$compte] = ['debit' => 0.0, 'credit' => 0.0, 'journal' => []];

            $livre['classes'][$classe][$parent]['comptes'][$compte]['journal'] = $db->get(
                'SELECT *, strftime(\'%s\', date) AS date FROM (
                    SELECT * FROM compta_journal WHERE compte_debit = :compte AND id_exercice = :exercice
                    UNION
                    SELECT * FROM compta_journal WHERE compte_credit = :compte AND id_exercice = :exercice
                    )
                ORDER BY date, numero_piece, id;', 
                ['compte' => $compte, 'exercice' => (int) $exercice]);

            $solde = 0.0;

            foreach ($livre['classes'][$classe][$parent]['comptes'][$compte]['journal'] as &$ligne)
            {
                if ($ligne->compte_credit == $compte)
                {
                    $solde += $ligne->montant;
                }
                else
                {
                    $solde -= $ligne->montant;
                }

                $ligne->solde = $solde;
            }

            $debit = (float) $db->firstColumn(
                'SELECT SUM(montant) FROM compta_journal WHERE compte_debit = ? AND id_exercice = ?;',
                $compte, (int) $exercice);

            $credit = (float) $db->firstColumn(
                'SELECT SUM(montant) FROM compta_journal WHERE compte_credit = ? AND id_exercice = ?;',
                $compte, (int) $exercice);

            $livre['classes'][$classe][$parent]['comptes'][$compte]['debit'] = $debit;
            $livre['classes'][$classe][$parent]['comptes'][$compte]['credit'] = $credit;
            $livre['classes'][$classe][$parent]['comptes'][$compte]['solde'] = $credit - $debit;

            $livre['classes'][$classe][$parent]['total'] += $debit;
            $livre['classes'][$classe][$parent]['total'] -= $credit;

            $livre['debit'] += $debit;
            $livre['credit'] += $credit;
        }

        $res->finalize();

        return $livre;
    }

    public function getCompteResultat($exercice)
    {
        $db = DB::getInstance();

        $charges    = ['comptes' => [], 'total' => 0.0];
        $produits   = ['comptes' => [], 'total' => 0.0];
        $resultat   = 0.0;

        $res = $db->preparedQuery('SELECT compte, SUM(debit), SUM(credit)
            FROM
                (SELECT compte_debit AS compte, SUM(montant) AS debit, 0 AS credit
                    FROM compta_journal WHERE id_exercice = :exercice GROUP BY compte_debit
                UNION
                SELECT compte_credit AS compte, 0 AS debit, SUM(montant) AS credit
                    FROM compta_journal WHERE id_exercice = :exercice GROUP BY compte_credit)
            WHERE compte LIKE \'6%\' OR compte LIKE \'7%\'
            GROUP BY compte
            ORDER BY compte ASC;', ['exercice' => (int)$exercice]);

        while ($row = $res->fetchArray(SQLITE3_NUM))
        {
            list($compte, $debit, $credit) = $row;
            $classe = substr($compte, 0, 1);
            $parent = substr($compte, 0, 2);

            if ($classe == 6)
            {
                if (!isset($charges['comptes'][$parent]))
                {
                    $charges['comptes'][$parent] = ['comptes' => [], 'solde' => 0.0];
                }

                $solde = round($debit - $credit, 2);

                if (empty($solde))
                    continue;

                $charges['comptes'][$parent]['comptes'][$compte] = $solde;
                $charges['total'] += $solde;
                $charges['comptes'][$parent]['solde'] += $solde;
            }
            elseif ($classe == 7)
            {
                if (!isset($produits['comptes'][$parent]))
                {
                    $produits['comptes'][$parent] = ['comptes' => [], 'solde' => 0.0];
                }

                $solde = round($credit - $debit, 2);

                if (empty($solde))
                    continue;

                $produits['comptes'][$parent]['comptes'][$compte] = $solde;
                $produits['total'] += $solde;
                $produits['comptes'][$parent]['solde'] += $solde;
            }
        }

        $res->finalize();

        $resultat = $produits['total'] - $charges['total'];

        return ['charges' => $charges, 'produits' => $produits, 'resultat' => $resultat];
    }

    /**
     * Calculer le bilan comptable pour l'exercice $exercice
     * @param  integer  $exercice   ID de l'exercice dont il faut produire le bilan
     * @param  boolean  $resultat   true s'il faut calculer le résultat de l'exercice (utile pour un exercice en cours)
     * @return array    Un tableau multi-dimensionnel avec deux clés : actif et passif
     */
    public function getBilan($exercice)
    {
        $db = DB::getInstance();

        $include = [Comptes::ACTIF, Comptes::PASSIF,
            Comptes::PASSIF | Comptes::ACTIF];

        $actif           = ['comptes' => [], 'total' => 0.0];
        $passif          = ['comptes' => [], 'total' => 0.0];
        $actif_ou_passif = ['comptes' => [], 'total' => 0.0];

        $resultat = $this->getCompteResultat($exercice);

        if ($resultat['resultat'] >= 0)
        {
            $passif['comptes']['12'] = [
                'comptes'   =>  ['120' => $resultat['resultat']],
                'solde'     =>  $resultat['resultat']
            ];

            $passif['total'] = $resultat['resultat'];
        }
        else
        {
            $passif['comptes']['12'] = [
                'comptes'   =>  ['129' => $resultat['resultat']],
                'solde'     =>  $resultat['resultat']
            ];

            $passif['total'] = $resultat['resultat'];
        }

        // Y'a sûrement moyen d'améliorer tout ça pour que le maximum de travail
        // soit fait au niveau du SQL, mais pour le moment ça marche
        $res = $db->preparedQuery('SELECT compte, debit, credit, (SELECT position FROM compta_comptes WHERE id = compte) AS position
            FROM
                (SELECT compte_debit AS compte, SUM(montant) AS debit, NULL AS credit
                    FROM compta_journal WHERE id_exercice = :exercice GROUP BY compte_debit
                UNION
                SELECT compte_credit AS compte, NULL AS debit, SUM(montant) AS credit
                    FROM compta_journal WHERE id_exercice = :exercice GROUP BY compte_credit)
            WHERE compte IN (SELECT id FROM compta_comptes WHERE position IN ('.implode(', ', $include).'))
            ORDER BY compte ASC;', ['exercice' => (int)$exercice]);

        while ($row = $res->fetchArray(SQLITE3_NUM))
        {
            list($compte, $debit, $credit, $position) = $row;
            $parent = substr($compte, 0, 2);
            $classe = $compte[0];

            if (($position & Comptes::ACTIF) && ($position & Comptes::PASSIF))
            {
                $position = 'actif_ou_passif';
                $solde = $debit - $credit;
            }
            else if ($position & Comptes::ACTIF)
            {
                $position = 'actif';
                $solde = $debit - $credit;
            }
            else if ($position & Comptes::PASSIF)
            {
                $position = 'passif';
                $solde = $credit - $debit;
            }
            else
            {
                continue;
            }

            if (!isset(${$position}['comptes'][$parent]))
            {
                ${$position}['comptes'][$parent] = ['comptes' => [], 'solde' => 0];
            }

            if (!isset(${$position}['comptes'][$parent]['comptes'][$compte]))
            {
                ${$position}['comptes'][$parent]['comptes'][$compte] = 0;
            }

            $solde = round($solde, 2);
            ${$position}['comptes'][$parent]['comptes'][$compte] += $solde;
            ${$position}['total'] += $solde;
            ${$position}['comptes'][$parent]['solde'] += $solde;
        }

        $res->finalize();

        foreach ($actif_ou_passif['comptes'] as $parent=>$p)
        {
            foreach ($p['comptes'] as $compte=>$solde)
            {
                if ($solde > 0)
                {
                    $position = 'actif';
                }
                else if ($solde < 0)
                {
                    $position = 'passif';
                    $solde = -$solde;
                }
                else
                {
                    continue;
                }

                if (!isset(${$position}['comptes'][$parent]))
                {
                    ${$position}['comptes'][$parent] = ['comptes' => [], 'solde' => 0];
                }

                if (!isset(${$position}['comptes'][$parent]['comptes'][$compte]))
                {
                    ${$position}['comptes'][$parent]['comptes'][$compte] = 0;
                }

                ${$position}['comptes'][$parent]['comptes'][$compte] += $solde;
                ${$position}['total'] += $solde;
                ${$position}['comptes'][$parent]['solde'] += $solde;
            }
        }

        // Suppression des soldes nuls
        foreach ($passif['comptes'] as $parent=>$p)
        {
            if ($p['solde'] == 0)
            {
                unset($passif['comptes'][$parent]);
                continue;
            }

            foreach ($p['comptes'] as $id=>$solde)
            {
                if ($solde == 0)
                {
                    unset($passif['comptes'][$parent]['comptes'][$id]);
                }
            }
        }

        foreach ($actif['comptes'] as $parent=>$p)
        {
            if (empty($p['solde']))
            {
                unset($actif['comptes'][$parent]);
                continue;
            }

            foreach ($p['comptes'] as $id=>$solde)
            {
                if (empty($solde))
                {
                    unset($actif['comptes'][$parent]['comptes'][$id]);
                }
            }
        }

        return ['actif' => $actif, 'passif' => $passif];
    }
}







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
315
316
317
318
319
320
321
322







































































































































































































































































































































        if (empty($data['fin']) || !checkdate(substr($data['fin'], 5, 2), substr($data['fin'], 8, 2), substr($data['fin'], 0, 4)))
        {
            throw new UserException('Date de fin vide ou invalide.');
        }

        return true;
    }
}







































































































































































































































































































































Modified src/include/lib/Garradin/Compta/Journal.php from [da92b4acf3] to [28552cfb1f].

308
309
310
311
312
313
314










315
316
317
318
319
320
321
            $data['id_categorie'] = NULL;
        }

        if (isset($data['id_auteur']))
        {
            $data['id_auteur'] = (int)$data['id_auteur'];
        }











        return true;
    }

    public function getListForCategory($type = null, $cat = null)
    {
        $db = DB::getInstance();







>
>
>
>
>
>
>
>
>
>







308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
            $data['id_categorie'] = NULL;
        }

        if (isset($data['id_auteur']))
        {
            $data['id_auteur'] = (int)$data['id_auteur'];
        }

        if (isset($data['id_projet']))
        {
            $data['id_projet'] = (int)$data['id_projet'];

            if (!$db->test('compta_projets', $db->where('id', $data['id_projet'])))
            {
                throw new UserException('Projet inconnu.');
            }
        }

        return true;
    }

    public function getListForCategory($type = null, $cat = null)
    {
        $db = DB::getInstance();

Modified src/include/lib/Garradin/Template.php from [189de9d70f] to [60159f5458].

57
58
59
60
61
62
63














64
65
66
67
68
69
70
		$this->register_modifier('strlen', 'strlen');
		$this->register_modifier('get_country_name', ['Garradin\Utils', 'getCountryName']);
		$this->register_modifier('format_sqlite_date_to_french', ['Garradin\Utils', 'sqliteDateToFrench']);
		$this->register_modifier('format_bytes', ['Garradin\Utils', 'format_bytes']);
		$this->register_modifier('format_tel', [$this, 'formatPhoneNumber']);
		$this->register_modifier('abs', 'abs');
		$this->register_modifier('display_champ_membre', [$this, 'displayChampMembre']);















		$this->register_modifier('strftime_fr', function ($ts, $format) {
			return Utils::strftime_fr($format, $ts);
		});

		$this->register_modifier('date_fr', function ($ts, $format = 'd/m/Y H:i:s') {
			return Utils::date_fr($format, $ts);







>
>
>
>
>
>
>
>
>
>
>
>
>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
		$this->register_modifier('strlen', 'strlen');
		$this->register_modifier('get_country_name', ['Garradin\Utils', 'getCountryName']);
		$this->register_modifier('format_sqlite_date_to_french', ['Garradin\Utils', 'sqliteDateToFrench']);
		$this->register_modifier('format_bytes', ['Garradin\Utils', 'format_bytes']);
		$this->register_modifier('format_tel', [$this, 'formatPhoneNumber']);
		$this->register_modifier('abs', 'abs');
		$this->register_modifier('display_champ_membre', [$this, 'displayChampMembre']);
		
		$this->register_modifier('get_nom_compte', function ($compte) {
			if (is_null($compte))
			{
				return '';
			}

			if (!isset($this->liste_comptes))
			{
				$this->liste_comptes = (new Compta\Comptes)->getListAll();
			}

			return $this->liste_comptes[$compte];
		});

		$this->register_modifier('strftime_fr', function ($ts, $format) {
			return Utils::strftime_fr($format, $ts);
		});

		$this->register_modifier('date_fr', function ($ts, $format = 'd/m/Y H:i:s') {
			return Utils::date_fr($format, $ts);

Modified src/templates/admin/_head.tpl from [26ce54269d] to [7fc934a76c].

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
                <li class="compta new{if $current == 'compta/saisie'} current{/if}"><a href="{$admin_url}compta/operations/saisir.php">Saisie</a></li>
            {/if}
                <li class="compta list{if $current == 'compta/gestion'} current{/if}"><a href="{$admin_url}compta/operations/">Suivi des opérations</a></li>
                <li class="compta banks{if $current == 'compta/banques'} current{/if}"><a href="{$admin_url}compta/banques/">Banques &amp; caisse</a></li>
            {if $session->canAccess('compta', Garradin\Membres::DROIT_ADMIN)}
                <li class="compta admin config{if $current == 'compta/categories'} current{/if}"><a href="{$admin_url}compta/categories/">Catégories &amp; comptes</a></li>
            {/if}
                <li class="compta admin reports{if $current == 'compta/exercices'} current{/if}"><a href="{$admin_url}compta/exercices/">Exercices</a></li>
            </ul>
            </li>
        {/if}
        {if $session->canAccess('wiki', Garradin\Membres::DROIT_ACCES)}
            <li class="wiki{if $current == 'wiki'} current{elseif $current_parent == 'wiki'} current_parent{/if}"><a href="{$admin_url}wiki/"><b class="icn">✎</b><i> Wiki</i></a>
            <ul>
                <li class="wiki list{if $current == 'wiki/recent'} current{/if}"><a href="{$admin_url}wiki/recent.php">Dernières modifications</a>







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
                <li class="compta new{if $current == 'compta/saisie'} current{/if}"><a href="{$admin_url}compta/operations/saisir.php">Saisie</a></li>
            {/if}
                <li class="compta list{if $current == 'compta/gestion'} current{/if}"><a href="{$admin_url}compta/operations/">Suivi des opérations</a></li>
                <li class="compta banks{if $current == 'compta/banques'} current{/if}"><a href="{$admin_url}compta/banques/">Banques &amp; caisse</a></li>
            {if $session->canAccess('compta', Garradin\Membres::DROIT_ADMIN)}
                <li class="compta admin config{if $current == 'compta/categories'} current{/if}"><a href="{$admin_url}compta/categories/">Catégories &amp; comptes</a></li>
            {/if}
                <li class="compta admin reports{if $current == 'compta/exercices'} current{/if}"><a href="{$admin_url}compta/exercices/">Exercices &amp; projets</a></li>
            </ul>
            </li>
        {/if}
        {if $session->canAccess('wiki', Garradin\Membres::DROIT_ACCES)}
            <li class="wiki{if $current == 'wiki'} current{elseif $current_parent == 'wiki'} current_parent{/if}"><a href="{$admin_url}wiki/"><b class="icn">✎</b><i> Wiki</i></a>
            <ul>
                <li class="wiki list{if $current == 'wiki/recent'} current{/if}"><a href="{$admin_url}wiki/recent.php">Dernières modifications</a>

Added src/templates/admin/compta/categories/_nav.tpl version [b71d1d8635].













>
>
>
>
>
>
1
2
3
4
5
6
<ul class="actions">
    <li{if $current == "recettes"} class="current"{/if}><a href="{$admin_url}compta/categories/?recettes">Recettes</a></li>
    <li{if $current == "depenses"} class="current"{/if}><a href="{$admin_url}compta/categories/?depenses">Dépenses</a></li>
    <li{if $current == "ajouter"} class="current"{/if}><strong><a href="{$admin_url}compta/categories/ajouter.php">Ajouter une catégorie</a></strong></li>
    <li{if $current == "plan"} class="current"{/if}><em><a href="{$admin_url}compta/comptes/">Plan comptable</a></em></li>
</ul>

Modified src/templates/admin/compta/categories/ajouter.tpl from [c81154476b] to [f30b2371c1].

1


2
3
4
5
6
7
8
{include file="admin/_head.tpl" title="Ajouter une catégorie" current="compta/categories"}



{form_errors}

<form method="post" action="{$self_url}">

    <fieldset>
        <legend>Ajouter une catégorie</legend>

>
>







1
2
3
4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Ajouter une catégorie" current="compta/categories"}

{include file="admin/compta/categories/_nav.tpl" current="ajouter"}

{form_errors}

<form method="post" action="{$self_url}">

    <fieldset>
        <legend>Ajouter une catégorie</legend>

Modified src/templates/admin/compta/categories/index.tpl from [9acce7d48b] to [0b5a6fec57].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{include file="admin/_head.tpl" title="Catégories" current="compta/categories"}

<ul class="actions">
    <li{if $type == Garradin\Compta\Categories::RECETTES} class="current"{/if}><a href="?recettes">Recettes</a></li>
    <li{if $type == Garradin\Compta\Categories::DEPENSES} class="current"{/if}><a href="?depenses">Dépenses</a></li>
    <li><strong><a href="{$www_url}admin/compta/categories/ajouter.php">Ajouter une catégorie</a></strong></li>
    <li><em><a href="{$www_url}admin/compta/comptes/">Plan comptable</a></em></li>
</ul>

    {if !empty($liste)}
        <dl class="catList">
        {foreach from=$liste item="cat"}
            <dt>{$cat.intitule}</dt>
            {if !empty($cat.description)}
                <dd class="desc">{$cat.description}</dd>


<
<
<
|
<
<







1
2



3


4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Catégories" current="compta/categories"}




{include file="admin/compta/categories/_nav.tpl" current=$current_nav}



    {if !empty($liste)}
        <dl class="catList">
        {foreach from=$liste item="cat"}
            <dt>{$cat.intitule}</dt>
            {if !empty($cat.description)}
                <dd class="desc">{$cat.description}</dd>

Modified src/templates/admin/compta/categories/modifier.tpl from [744bd39187] to [75046d7ae0].

1


2
3
4
5
6
7
8
{include file="admin/_head.tpl" title="Modifier une catégorie" current="compta/categories"}



{form_errors}

<form method="post" action="{$self_url}">

    <fieldset>
        <legend>Modifier une catégorie</legend>

>
>







1
2
3
4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Modifier une catégorie" current="compta/categories"}

{include file="admin/compta/categories/_nav.tpl" current=null}

{form_errors}

<form method="post" action="{$self_url}">

    <fieldset>
        <legend>Modifier une catégorie</legend>

Modified src/templates/admin/compta/categories/supprimer.tpl from [66664b8c0b] to [30d30ea90b].

1


2
3
4
5
6
7
8
{include file="admin/_head.tpl" title="Supprimer une catégorie" current="compta/categories"}



{form_errors}

<form method="post" action="{$self_url}">

    <fieldset>
        <legend>Supprimer la catégorie comptable ?</legend>

>
>







1
2
3
4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Supprimer une catégorie" current="compta/categories"}

{include file="admin/compta/categories/_nav.tpl" current=null}

{form_errors}

<form method="post" action="{$self_url}">

    <fieldset>
        <legend>Supprimer la catégorie comptable ?</legend>

Modified src/templates/admin/compta/exercices/index.tpl from [cfdf80b4cf] to [7db8d2a012].

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
26
27
28
29
30
31
{include file="admin/_head.tpl" title="Exercices" current="compta/exercices"}






{if !$current_exercice}
<ul class="actions">
    <li><strong><a href="{$www_url}admin/compta/exercices/ajouter.php">Commencer un nouvel exercice</a></strong></li>
</ul>
{/if}

{if !empty($liste)}
    <dl class="catList">
    {foreach from=$liste item="exercice"}
        <dt>{$exercice.libelle}</dt>
        <dd class="desc">
            {if $exercice.cloture}Clôturé{else}En cours{/if}
            | Du {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}
        </dd>
        <dd class="compte">
            <strong>{$exercice.nb_operations}</strong> opérations enregistrées.
        </dd>
        <dd class="desc">
            <a href="{$www_url}admin/compta/exercices/journal.php?id={$exercice.id}">Journal général</a>
            | <a href="{$www_url}admin/compta/exercices/grand_livre.php?id={$exercice.id}">Grand livre</a>
            | <a href="{$www_url}admin/compta/exercices/compte_resultat.php?id={$exercice.id}">Compte de résultat</a>
            | <a href="{$www_url}admin/compta/exercices/bilan.php?id={$exercice.id}">Bilan</a>
        </dd>
        {if $session->canAccess('compta', Garradin\Membres::DROIT_ADMIN)}
        <dd class="actions">
            {if !$exercice.cloture}
            <a class="icn" href="{$www_url}admin/compta/exercices/modifier.php?id={$exercice.id}" title="Modifier">✎</a>
            <a class="icn" href="{$www_url}admin/compta/exercices/supprimer.php?id={$exercice.id}" title="Supprimer">✘</a>
            <a class="icn" href="{$www_url}admin/compta/exercices/cloturer.php?id={$exercice.id}" title="Clôturer cet exercice">🔒</a>

>
>
>
>
>



















|
|
|
|







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
26
27
28
29
30
31
32
33
34
35
36
{include file="admin/_head.tpl" title="Exercices" current="compta/exercices"}

<ul class="actions">
    <li class="current"><a href="{$admin_url}compta/exercices/">Exercices</a></li>
    <li><a href="{$admin_url}compta/projets/">Projets (compta analytique)</a></li>
</ul>

{if !$current_exercice}
<ul class="actions">
    <li><strong><a href="{$www_url}admin/compta/exercices/ajouter.php">Commencer un nouvel exercice</a></strong></li>
</ul>
{/if}

{if !empty($liste)}
    <dl class="catList">
    {foreach from=$liste item="exercice"}
        <dt>{$exercice.libelle}</dt>
        <dd class="desc">
            {if $exercice.cloture}Clôturé{else}En cours{/if}
            | Du {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}
        </dd>
        <dd class="compte">
            <strong>{$exercice.nb_operations}</strong> opérations enregistrées.
        </dd>
        <dd class="desc">
            <a href="{$www_url}admin/compta/rapports/journal.php?exercice={$exercice.id}">Journal général</a>
            | <a href="{$www_url}admin/compta/rapports/grand_livre.php?exercice={$exercice.id}">Grand livre</a>
            | <a href="{$www_url}admin/compta/rapports/compte_resultat.php?exercice={$exercice.id}">Compte de résultat</a>
            | <a href="{$www_url}admin/compta/rapports/bilan.php?exercice={$exercice.id}">Bilan</a>
        </dd>
        {if $session->canAccess('compta', Garradin\Membres::DROIT_ADMIN)}
        <dd class="actions">
            {if !$exercice.cloture}
            <a class="icn" href="{$www_url}admin/compta/exercices/modifier.php?id={$exercice.id}" title="Modifier">✎</a>
            <a class="icn" href="{$www_url}admin/compta/exercices/supprimer.php?id={$exercice.id}" title="Supprimer">✘</a>
            <a class="icn" href="{$www_url}admin/compta/exercices/cloturer.php?id={$exercice.id}" title="Clôturer cet exercice">🔒</a>

Modified src/templates/admin/compta/operations/index.tpl from [cf8308724d] to [83582c111c].

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
66
67
68
69
70
71
72
73
74
75
76
77
    </fieldset>
</form>
{/if}

<table class="list">
    <colgroup>
        <col width="3%" />
        <col width="3%" />
        <col width="12%" />
        <col width="10%" />
        <col />
        {if !$categorie && $type}
        <col width="20%" />
        {/if}
    </colgroup>
    <tbody>
    {foreach from=$journal item="ligne"}
        <tr>
            <td class="num"><a href="{$admin_url}compta/operations/voir.php?id={$ligne.id}">{$ligne.id}</a></td>
            <td class="actions">
            {if $session->canAccess('compta', Garradin\Membres::DROIT_ADMIN)}
                <a class="icn" href="{$admin_url}compta/operations/modifier.php?id={$ligne.id}" title="Modifier cette opération">✎</a>
            {/if}
            </td>
            <td>{$ligne.date|date_fr:'d/m/Y'}</td>
            <td>{$ligne.montant|escape|html_money} {$config.monnaie}</td>
            <th>{$ligne.libelle}</th>
            {if !$categorie && $type}
            <td>{$ligne.categorie}</td>
            {/if}
        </tr>
    {foreachelse}
        <tr>
            <td colspan="3"></td>
            <td colspan="2">
                Aucune opération.
            </td>
            {if !$categorie && $type}<td></td>{/if}
        </tr>
    {/foreach}
    </tbody>
    <tfoot>
        <tr>
            <td></td>
            <td></td>
            <th>Total</th>
            <td>{$total|escape|html_money} {$config.monnaie}</td>
            <td></td>
            {if !$categorie && $type}<td></td>{/if}
        </tr>
    </tfoot>
</table>

{include file="admin/_foot.tpl"}







<











<
<
<
<
<









|









<










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
66
67
68
69
70
    </fieldset>
</form>
{/if}

<table class="list">
    <colgroup>
        <col width="3%" />

        <col width="12%" />
        <col width="10%" />
        <col />
        {if !$categorie && $type}
        <col width="20%" />
        {/if}
    </colgroup>
    <tbody>
    {foreach from=$journal item="ligne"}
        <tr>
            <td class="num"><a href="{$admin_url}compta/operations/voir.php?id={$ligne.id}">{$ligne.id}</a></td>





            <td>{$ligne.date|date_fr:'d/m/Y'}</td>
            <td>{$ligne.montant|escape|html_money} {$config.monnaie}</td>
            <th>{$ligne.libelle}</th>
            {if !$categorie && $type}
            <td>{$ligne.categorie}</td>
            {/if}
        </tr>
    {foreachelse}
        <tr>
            <td colspan="2"></td>
            <td colspan="2">
                Aucune opération.
            </td>
            {if !$categorie && $type}<td></td>{/if}
        </tr>
    {/foreach}
    </tbody>
    <tfoot>
        <tr>

            <td></td>
            <th>Total</th>
            <td>{$total|escape|html_money} {$config.monnaie}</td>
            <td></td>
            {if !$categorie && $type}<td></td>{/if}
        </tr>
    </tfoot>
</table>

{include file="admin/_foot.tpl"}

Modified src/templates/admin/compta/operations/saisir.tpl from [95ac71bec2] to [36ab83ac38].

27
28
29
30
31
32
33




34
35
36
37
38
39
40
            <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle}" required="required" /></dd>
            <dt><label for="f_montant">Montant</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="number" size="5" name="montant" id="f_montant" value="{form_field name=montant default=0.00}" min="0.00" step="0.01" required="required" /> {$config.monnaie}</dd>
            <dt><label for="f_numero_piece">Numéro de pièce comptable</label></dt>
            <dd><input type="text" name="numero_piece" id="f_numero_piece" value="{form_field name=numero_piece}" /></dd>
            <dt><label for="f_remarques">Remarques</label></dt>
            <dd><textarea name="remarques" id="f_remarques" rows="4" cols="30">{form_field name=remarques}</textarea></dd>




        </dl>
        <dl class="type_recette type_depense">
            <dt><label for="f_moyen_paiement">Moyen de paiement</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                <select name="moyen_paiement" id="f_moyen_paiement" required="required">
                {foreach from=$moyens_paiement item="moyen"}
                    <option value="{$moyen.code}"{if $moyen.code == $moyen_paiement} selected="selected"{/if}>{$moyen.nom}</option>







>
>
>
>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
            <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle}" required="required" /></dd>
            <dt><label for="f_montant">Montant</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="number" size="5" name="montant" id="f_montant" value="{form_field name=montant default=0.00}" min="0.00" step="0.01" required="required" /> {$config.monnaie}</dd>
            <dt><label for="f_numero_piece">Numéro de pièce comptable</label></dt>
            <dd><input type="text" name="numero_piece" id="f_numero_piece" value="{form_field name=numero_piece}" /></dd>
            <dt><label for="f_remarques">Remarques</label></dt>
            <dd><textarea name="remarques" id="f_remarques" rows="4" cols="30">{form_field name=remarques}</textarea></dd>
            {if count($projets) > 1}
            <dt><label for="f_projet">Projet</label></dt>
            <dd>{form_select name="projet" values=$projets}</dd>
            {/if}
        </dl>
        <dl class="type_recette type_depense">
            <dt><label for="f_moyen_paiement">Moyen de paiement</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                <select name="moyen_paiement" id="f_moyen_paiement" required="required">
                {foreach from=$moyens_paiement item="moyen"}
                    <option value="{$moyen.code}"{if $moyen.code == $moyen_paiement} selected="selected"{/if}>{$moyen.nom}</option>

Modified src/templates/admin/compta/operations/voir.tpl from [96d5011b27] to [02afdb29f1].

41
42
43
44
45
46
47







48
49
50
51
52
53
54

    <dt>Exercice</dt>
    <dd>
        <a href="{$admin_url}compta/exercices/">{$exercice.libelle}</a>
        | Du {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}
        | <strong>{if $exercice.cloture}Clôturé{else}En cours{/if}</strong>
    </dd>








    <dt>Opération créée par</dt>
    <dd>
        {if $operation.id_auteur}
            {if $session->canAccess('compta', Garradin\Membres::DROIT_ACCES)}
                <a href="{$admin_url}membres/fiche.php?id={$operation.id_auteur}">{$nom_auteur}</a>
            {else}







>
>
>
>
>
>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

    <dt>Exercice</dt>
    <dd>
        <a href="{$admin_url}compta/exercices/">{$exercice.libelle}</a>
        | Du {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}
        | <strong>{if $exercice.cloture}Clôturé{else}En cours{/if}</strong>
    </dd>

    {if $operation.id_projet}
        <dt>Projet</dt>
        <dd>
            <a href="{$admin_url}compta/projets/">{$projet.libelle}</a>
        </dd>
    {/if}

    <dt>Opération créée par</dt>
    <dd>
        {if $operation.id_auteur}
            {if $session->canAccess('compta', Garradin\Membres::DROIT_ACCES)}
                <a href="{$admin_url}membres/fiche.php?id={$operation.id_auteur}">{$nom_auteur}</a>
            {else}

Added src/templates/admin/compta/projets/index.tpl version [4cae68a2fd].













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{include file="admin/_head.tpl" title="Projets" current="compta/exercices"}

<ul class="actions">
    <li><a href="{$admin_url}compta/exercices/">Exercices</a></li>
    <li class="current"><a href="{$admin_url}compta/projets/">Projets (compta analytique)</a></li>
</ul>

{form_errors}

{if $action == 'modifier'}

    <form method="post" action="{$self_url}">
        <fieldset>
            <legend>Modifier un projet</legend>
            <dl>
                <dt><label for="f_libelle">Libellé</label></dt>
                <dd><input type="text" name="libelle" id="f_labelle" value="{form_field name=libelle data=$projet}" /></dd>
            </dl>
            <p class="submit">
                {csrf_field key="modifier_projet_%d"|args:$projet.id}
                <input type="submit" name="modifier" value="Modifier &rarr;" />
            </p>
        </fieldset>
    </form>
{elseif $action == 'supprimer'}

    <form method="post" action="{$self_url}">

        <fieldset>
            <legend>Supprimer le projet ?</legend>
            <h3 class="warning">
                Êtes-vous sûr de vouloir supprimer le projet «&nbsp;{$projet.libelle}&nbsp;» ?
            </h3>
            <p class="help">
                Les opérations liées à ce projet ne seront pas supprimées, mais n'auront
                plus de projet lié.
            </p>
        </fieldset>

        <p class="submit">
            {csrf_field key="supprimer_projet_%d"|args:$projet.id}
            <input type="submit" name="supprimer" value="Supprimer &rarr;" />
        </p>

    </form>

{else}
    {if !empty($liste)}
        <dl class="catList">
        {foreach from=$liste item="projet"}
            <dt>{$projet.libelle}</dt>
            <dd class="compte">{$projet.nb_operations} opérations</dd>
            <dd class="desc">
                <a href="{$admin_url}compta/rapports/journal.php?projet={$projet.id}">Journal général</a>
                | <a href="{$admin_url}compta/rapports/grand_livre.php?projet={$projet.id}">Grand livre</a>
                | <a href="{$admin_url}compta/rapports/compte_resultat.php?projet={$projet.id}">Compte de résultat</a>
                | <a href="{$admin_url}compta/rapports/bilan.php?projet={$projet.id}">Bilan</a>
            </dd>
            {if $session->canAccess('compta', Garradin\Membres::DROIT_ADMIN)}
            <dd class="actions">
                <a class="icn" href="{$admin_url}compta/projets/?modifier={$projet.id}" title="Modifier">✎</a>
                <a class="icn" href="{$admin_url}compta/projets/?supprimer={$projet.id}" title="Supprimer">✘</a>
            </dd>
            {/if}
        {/foreach}
        </dl>
    {/if}

    {if $session->canAccess('compta', Garradin\Membres::DROIT_ADMIN)}
    <form method="post" action="{$self_url}">
        <fieldset>
            <legend>Ajouter un nouveau projet</legend>
            <dl>
                <dt><label for="f_libelle">Libellé</label></dt>
                <dd><input type="text" name="libelle" id="f_labelle" value="{form_field name=libelle}" /></dd>
            </dl>
            <p class="submit">
                {csrf_field key="ajout_projet"}
                <input type="submit" name="ajouter" value="Ajouter &rarr;" />
            </p>
        </fieldset>
    </form>
    {/if}
{/if}

{include file="admin/_foot.tpl"}

Added src/templates/admin/compta/rapports/_header.tpl version [246e41f329].



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
<div class="exercice">
    <h2>{$config.nom_asso}</h2>
    {if isset($projet)}
        <h3>Projet&nbsp;: {$projet.libelle}</h3>
    {else}
        <p>Exercice comptable {if $exercice.cloture}clôturé{else}en cours{/if} du
            {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}, généré le {$cloture|date_fr:'d/m/Y'}</p>
    {/if}
</div>

Modified src/templates/admin/compta/rapports/bilan.tpl from [059e49c098] to [b3279556ab].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Bilan" current="compta/exercices" body_id="rapport"}

<div class="exercice">
    <h2>{$config.nom_asso}</h2>
    <p>Exercice comptable {if $exercice.cloture}clôturé{else}en cours{/if} du
        {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}, généré le {$cloture|date_fr:'d/m/Y'}</p>
</div>

<table>
    <colgroup>
        <col width="50%" />
        <col width="50%" />
    </colgroup>
    <tbody>


|
<
<
<
<







1
2
3




4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Bilan" current="compta/exercices" body_id="rapport"}

{include file="admin/compta/rapports/_header.tpl"}





<table>
    <colgroup>
        <col width="50%" />
        <col width="50%" />
    </colgroup>
    <tbody>

Modified src/templates/admin/compta/rapports/compte_resultat.tpl from [8ca1ec22c9] to [510a2bfff7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Compte de résultat" current="compta/exercices" body_id="rapport"}

<div class="exercice">
    <h2>{$config.nom_asso}</h2>
    <p>Exercice comptable {if $exercice.cloture}clôturé{else}en cours{/if} du
        {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}, généré le {$cloture|date_fr:'d/m/Y'}</p>
</div>

<table>
    <colgroup>
        <col width="50%" />
        <col width="50%" />
    </colgroup>
    <tbody>


|
<
<
<
<







1
2
3




4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Compte de résultat" current="compta/exercices" body_id="rapport"}

{include file="admin/compta/rapports/_header.tpl"}





<table>
    <colgroup>
        <col width="50%" />
        <col width="50%" />
    </colgroup>
    <tbody>

Modified src/templates/admin/compta/rapports/grand_livre.tpl from [00c01f9217] to [9f320d7052].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Grand livre" current="compta/exercices" body_id="rapport"}

<div class="exercice">
    <h2>{$config.nom_asso}</h2>
    <p>Exercice comptable {if $exercice.cloture}clôturé{else}en cours{/if} du
        {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}, généré le {$cloture|date_fr:'d/m/Y'}</p>
</div>

{foreach from=$livre.classes key="classe" item="comptes"}
<h3>{$classe|get_nom_compte}</h3>

{foreach from=$comptes item="compte" key="code"}
    {foreach from=$compte.comptes item="souscompte" key="souscode"}
    <table class="list">


|
<
<
<
<







1
2
3




4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Grand livre" current="compta/exercices" body_id="rapport"}

{include file="admin/compta/rapports/_header.tpl"}





{foreach from=$livre.classes key="classe" item="comptes"}
<h3>{$classe|get_nom_compte}</h3>

{foreach from=$comptes item="compte" key="code"}
    {foreach from=$compte.comptes item="souscompte" key="souscode"}
    <table class="list">

Modified src/templates/admin/compta/rapports/journal.tpl from [5c52f09c4f] to [7a19ce99c8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Journal général" current="compta/exercices" body_id="rapport"}

<div class="exercice">
    <h2>{$config.nom_asso}</h2>
    <p>Exercice comptable {if $exercice.cloture}clôturé{else}en cours{/if} du
        {$exercice.debut|date_fr:'d/m/Y'} au {$exercice.fin|date_fr:'d/m/Y'}, généré le {$cloture|date_fr:'d/m/Y'}</p>
</div>

<table class="list multi">
    <thead>
        <tr>
            <td>Date</td>
            <th>Intitulé</th>
            <td>Comptes</td>


|
<
<
<
<







1
2
3




4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Journal général" current="compta/exercices" body_id="rapport"}

{include file="admin/compta/rapports/_header.tpl"}





<table class="list multi">
    <thead>
        <tr>
            <td>Date</td>
            <th>Intitulé</th>
            <td>Comptes</td>

Modified src/www/admin/compta/categories/index.php from [0cf8dc5306] to [e2ecaf3c11].

8
9
10
11
12
13
14

15
16
17
18
$cats = new Compta\Categories;

if (null !== qg('depenses'))
    $type = Compta\Categories::DEPENSES;
else
    $type = Compta\Categories::RECETTES;


$tpl->assign('type', $type);
$tpl->assign('liste', $cats->getList($type));

$tpl->display('admin/compta/categories/index.tpl');







>




8
9
10
11
12
13
14
15
16
17
18
19
$cats = new Compta\Categories;

if (null !== qg('depenses'))
    $type = Compta\Categories::DEPENSES;
else
    $type = Compta\Categories::RECETTES;

$tpl->assign('current_nav', $type == Compta\Categories::DEPENSES ? 'depenses' : 'recettes');
$tpl->assign('type', $type);
$tpl->assign('liste', $cats->getList($type));

$tpl->display('admin/compta/categories/index.tpl');

Modified src/www/admin/compta/operations/saisir.php from [a84763f6af] to [84e11944f3].

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
                    'montant'       =>  f('montant'),
                    'date'          =>  f('date'),
                    'compte_credit' =>  f('compte_credit'),
                    'compte_debit'  =>  f('compte_debit'),
                    'numero_piece'  =>  f('numero_piece'),
                    'remarques'     =>  f('remarques'),
                    'id_auteur'     =>  $user->id,

                ]);
            }
            elseif ($type == 'virement')
            {
                $id = $journal->add([
                    'libelle'       =>  f('libelle'),
                    'montant'       =>  f('montant'),
                    'date'          =>  f('date'),
                    'compte_debit'  =>  f('compte1'),
                    'compte_credit' =>  f('compte2'),
                    'numero_piece'  =>  f('numero_piece'),
                    'remarques'     =>  f('remarques'),
                    'id_auteur'     =>  $user->id,

                ]);
            }
            else
            {
                if ($type == 'recette')
                {
                    $cat = 'categorie_recette';







>













>







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
                    'montant'       =>  f('montant'),
                    'date'          =>  f('date'),
                    'compte_credit' =>  f('compte_credit'),
                    'compte_debit'  =>  f('compte_debit'),
                    'numero_piece'  =>  f('numero_piece'),
                    'remarques'     =>  f('remarques'),
                    'id_auteur'     =>  $user->id,
                    'id_projet'     =>  f('projet') || null,
                ]);
            }
            elseif ($type == 'virement')
            {
                $id = $journal->add([
                    'libelle'       =>  f('libelle'),
                    'montant'       =>  f('montant'),
                    'date'          =>  f('date'),
                    'compte_debit'  =>  f('compte1'),
                    'compte_credit' =>  f('compte2'),
                    'numero_piece'  =>  f('numero_piece'),
                    'remarques'     =>  f('remarques'),
                    'id_auteur'     =>  $user->id,
                    'id_projet'     =>  f('projet') || null,
                ]);
            }
            else
            {
                if ($type == 'recette')
                {
                    $cat = 'categorie_recette';
134
135
136
137
138
139
140

141
142
143
144
145
146
147
                    'numero_cheque' =>  ($type == 'dette') ? null : f('numero_cheque'),
                    'compte_credit' =>  $credit,
                    'compte_debit'  =>  $debit,
                    'numero_piece'  =>  f('numero_piece'),
                    'remarques'     =>  f('remarques'),
                    'id_categorie'  =>  ($type === 'dette') ? null : (int)$cat->id,
                    'id_auteur'     =>  $user->id,

                ]);
            }

            $session->set('context_compta_date', f('date'));

            Utils::redirect('/admin/compta/operations/saisir.php?ok='.(int)$id);
        }







>







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
                    'numero_cheque' =>  ($type == 'dette') ? null : f('numero_cheque'),
                    'compte_credit' =>  $credit,
                    'compte_debit'  =>  $debit,
                    'numero_piece'  =>  f('numero_piece'),
                    'remarques'     =>  f('remarques'),
                    'id_categorie'  =>  ($type === 'dette') ? null : (int)$cat->id,
                    'id_auteur'     =>  $user->id,
                    'id_projet'     =>  f('projet') || null,
                ]);
            }

            $session->set('context_compta_date', f('date'));

            Utils::redirect('/admin/compta/operations/saisir.php?ok='.(int)$id);
        }
159
160
161
162
163
164
165

166
167
168
169
170
171
172
$tpl->assign('moyen_paiement', f('moyen_paiement') ?: 'ES');
$tpl->assign('categories_depenses', $cats->getList(Compta\Categories::DEPENSES));
$tpl->assign('categories_recettes', $cats->getList(Compta\Categories::RECETTES));
$tpl->assign('comptes_bancaires', $banques->getList());
$tpl->assign('banque', f('banque'));
$tpl->assign('compte_cheque_e_encaisser', Compta\Comptes::CHEQUE_A_ENCAISSER);
$tpl->assign('compte_carte_e_encaisser', Compta\Comptes::CARTE_A_ENCAISSER);


if (!$session->get('context_compta_date'))
{
    $exercices = new Compta\Exercices;
    $exercice = $exercices->getCurrent();

    if ($exercice->debut > time() || $exercice->fin < time())







>







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
$tpl->assign('moyen_paiement', f('moyen_paiement') ?: 'ES');
$tpl->assign('categories_depenses', $cats->getList(Compta\Categories::DEPENSES));
$tpl->assign('categories_recettes', $cats->getList(Compta\Categories::RECETTES));
$tpl->assign('comptes_bancaires', $banques->getList());
$tpl->assign('banque', f('banque'));
$tpl->assign('compte_cheque_e_encaisser', Compta\Comptes::CHEQUE_A_ENCAISSER);
$tpl->assign('compte_carte_e_encaisser', Compta\Comptes::CARTE_A_ENCAISSER);
$tpl->assign('projets', [0 => '-- Aucun'] + (new Compta\Projets)->getAssocList());

if (!$session->get('context_compta_date'))
{
    $exercices = new Compta\Exercices;
    $exercice = $exercices->getCurrent();

    if ($exercice->debut > time() || $exercice->fin < time())

Modified src/www/admin/compta/operations/voir.php from [267b3ba2b7] to [6dcec0725f].

37
38
39
40
41
42
43





44
45
46
47
48
49
50
51
52
53
    else
    {
        $tpl->assign('compte', $credit->libelle);
    }

    $tpl->assign('moyen_paiement', $cats->getMoyenPaiement($operation->moyen_paiement));
}






if ($operation->id_auteur)
{
    $auteur = (new Membres)->get($operation->id_auteur);
    $tpl->assign('nom_auteur', $auteur->identite);
}

$tpl->assign('related_members', $journal->listRelatedMembers($operation->id));

$tpl->display('admin/compta/operations/voir.tpl');







>
>
>
>
>










37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    else
    {
        $tpl->assign('compte', $credit->libelle);
    }

    $tpl->assign('moyen_paiement', $cats->getMoyenPaiement($operation->moyen_paiement));
}

if ($operation->id_projet)
{
    $tpl->assign('projet', (new Compta\Projets)->get($operation->id_projet));
}

if ($operation->id_auteur)
{
    $auteur = (new Membres)->get($operation->id_auteur);
    $tpl->assign('nom_auteur', $auteur->identite);
}

$tpl->assign('related_members', $journal->listRelatedMembers($operation->id));

$tpl->display('admin/compta/operations/voir.tpl');

Added src/www/admin/compta/projets/index.php version [daf736a4a0].

























































































































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

namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$projets = new Compta\Projets;

$action = null;
$id = null;

if (qg('supprimer'))
{
	$session->requireAccess('compta', Membres::DROIT_ADMIN);

	$action = 'supprimer';
	$id = (int) qg('supprimer');
}
elseif (qg('modifier'))
{
	$session->requireAccess('compta', Membres::DROIT_ADMIN);

	$action = 'modifier';
	$id = (int) qg('modifier');
}

if ($id)
{
	if (!($projet = $projets->get($id)))
	{
		throw new UserException('Ce projet n\'existe pas.');
	}
	
	$tpl->assign('projet', $projet);
}


if (f('ajouter') && $form->check('ajout_projet'))
{
	$session->requireAccess('compta', Membres::DROIT_ADMIN);

	$projets->add(f('libelle'));
	Utils::redirect('/admin/compta/projets/');
}
elseif (f('modifier') && $form->check('modifier_projet_' . $id))
{
	$projets->edit($id, f('libelle'));
	Utils::redirect('/admin/compta/projets/');
}
elseif (f('supprimer') && $form->check('supprimer_projet_' . $id))
{
	$projets->remove($id);
	Utils::redirect('/admin/compta/projets/');
}


$tpl->assign('action', $action);
$tpl->assign('liste', $projets->getList());

$tpl->display('admin/compta/projets/index.tpl');

Added src/www/admin/compta/rapports/_inc.php version [73c58d8a9d].



















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$rapports = new Compta\Rapports;
$criterias = [];

if (qg('projet'))
{
	$projets = new Compta\Projets;
	$projet = $projets->get((int) qg('projet'));

	if (!$projet)
	{
		throw new UserException('Projet inconnu.');
	}

	$criterias['id_projet'] = $projet->id;
	$tpl->assign('projet', $projet);
}
elseif (qg('exercice'))
{
	$exercices = new Compta\Exercices;

	$exercice = $exercices->get((int)qg('exercice'));

	if (!$exercice)
	{
		throw new UserException('Exercice inconnu.');
	}

	$criterias['id_exercice'] = $exercice->id;
	$tpl->assign('cloture', $exercice->cloture ? $exercice->fin : time());
	$tpl->assign('exercice', $exercice);
}
else
{
	throw new UserException('Critère de rapport inconnu.');
}

Modified src/www/admin/compta/rapports/bilan.php from [8a023f5709] to [a817281776].

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
26
27
28
29
30
<?php

namespace Garradin;
require_once __DIR__ . '/../_inc.php';

$exercices = new Compta\Exercices;

$exercice = $exercices->get((int)qg('id'));

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

$liste_comptes = $comptes->getListAll();

function get_nom_compte($compte)
{
	global $liste_comptes;
	return $liste_comptes[$compte];
}

$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');

$tpl->assign('bilan', $exercices->getBilan($exercice->id));

$tpl->assign('cloture', $exercice->cloture ? $exercice->fin : time());
$tpl->assign('exercice', $exercice);

$tpl->display('admin/compta/exercices/bilan.tpl');



<

<
|
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

<
<
<
|
1
2
3

4

5

6















7
8



9
<?php

namespace Garradin;



require_once __DIR__ . '/_inc.php';

















$tpl->assign('bilan', $rapports->bilan($criterias));




$tpl->display('admin/compta/rapports/bilan.tpl');

Modified src/www/admin/compta/rapports/compte_resultat.php from [a0497a409d] to [7128f79903].

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
26
27
28
29
<?php

namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$exercices = new Compta\Exercices;

$exercice = $exercices->get((int)qg('id'));

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

$liste_comptes = $comptes->getListAll();

function get_nom_compte($compte)
{
	global $liste_comptes;
	return $liste_comptes[$compte];
}

$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
$tpl->assign('compte_resultat', $exercices->getCompteResultat($exercice->id));

$tpl->assign('cloture', $exercice->cloture ? $exercice->fin : time());
$tpl->assign('exercice', $exercice);

$tpl->display('admin/compta/exercices/compte_resultat.tpl');

>


|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

<
<
<
|
1
2
3
4
5
6


















7
8



9
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';



















$tpl->assign('compte_resultat', $rapports->compteResultat($criterias));




$tpl->display('admin/compta/rapports/compte_resultat.tpl');

Modified src/www/admin/compta/rapports/grand_livre.php from [30a396ce8e] to [f6b332c56d].

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
26
27
28
29
<?php

namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$exercices = new Compta\Exercices;

$exercice = $exercices->get((int)qg('id'));

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

$liste_comptes = $comptes->getListAll();

function get_nom_compte($compte)
{
	global $liste_comptes;
	return $liste_comptes[$compte];
}

$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
$tpl->assign('livre', $exercices->getGrandLivre($exercice->id));

$tpl->assign('cloture', $exercice->cloture ? $exercice->fin : time());
$tpl->assign('exercice', $exercice);

$tpl->display('admin/compta/exercices/grand_livre.tpl');

>


|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

<
<
<
|
1
2
3
4
5
6


















7
8



9
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';



















$tpl->assign('livre', $rapports->grandLivre($criterias));




$tpl->display('admin/compta/rapports/grand_livre.tpl');

Modified src/www/admin/compta/rapports/journal.php from [5f28fca015] to [d73a2c213c].

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
26
27
28
29
30
31
32
<?php

namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$exercices = new Compta\Exercices;

$exercice = $exercices->get((int)qg('id'));

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

$liste_comptes = $comptes->getListAll();

function get_nom_compte($compte)
{
	if (is_null($compte))
		return '';

	global $liste_comptes;
	return $liste_comptes[$compte];
}

$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
$tpl->assign('journal', $exercices->getJournal($exercice->id));

$tpl->assign('cloture', $exercice->cloture ? $exercice->fin : time());
$tpl->assign('exercice', $exercice);

$tpl->display('admin/compta/exercices/journal.tpl');

>


|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

<
<
<
|
1
2
3
4
5
6





















7
8



9
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';






















$tpl->assign('journal', $rapports->journal($criterias));




$tpl->display('admin/compta/rapports/journal.tpl');

Modified src/www/admin/upgrade.php from [52f275a46e] to [2ce40cf8ef].

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260

    // Mise à jour base de données
    $db->exec(file_get_contents(ROOT . '/include/data/0.7.2.sql'));

    $db->exec('END;');
}

if (version_compare($v, '0.8.0-alpha1', '<'))
{
    // Inscription de l'appid
    $db->exec('PRAGMA application_id = ' . DB::APPID . ';');

    // Changement de la taille de pagesize
    // Cecit devrait améliorer les performances de la DB
    $db->exec('PRAGMA page_size = 4096;');







|







246
247
248
249
250
251
252
253
254
255
256
257
258
259
260

    // Mise à jour base de données
    $db->exec(file_get_contents(ROOT . '/include/data/0.7.2.sql'));

    $db->exec('END;');
}

if (version_compare($v, '0.8.0-beta4', '<'))
{
    // Inscription de l'appid
    $db->exec('PRAGMA application_id = ' . DB::APPID . ';');

    // Changement de la taille de pagesize
    // Cecit devrait améliorer les performances de la DB
    $db->exec('PRAGMA page_size = 4096;');
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
    {
        $config->set('champ_identifiant', 'numero');
        $config->save();
    }

    // Nettoyage de la base de données
    $db->exec('VACUUM;');
}

if (version_compare($v, '0.8.0-beta4', '<'))
{
    // Mise à jour plan comptable
    $comptes = new Compta\Comptes;
    $comptes->importPlan();
}

Utils::clearCaches();

$config->setVersion(garradin_version());







|
<
<
<
|







286
287
288
289
290
291
292
293



294
295
296
297
298
299
300
301
    {
        $config->set('champ_identifiant', 'numero');
        $config->save();
    }

    // Nettoyage de la base de données
    $db->exec('VACUUM;');




    // Mise à jour plan comptable: ajout comptes encaissement
    $comptes = new Compta\Comptes;
    $comptes->importPlan();
}

Utils::clearCaches();

$config->setVersion(garradin_version());