From a59923348f57297f308f2502212442d6d472410c Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 28 Jan 2022 14:40:21 +0000 Subject: [PATCH] =?UTF-8?q?Normalisation=20attribut=20(Utils.php)=20;=20aj?= =?UTF-8?q?out=20onglet=20Configuration=20;=20pr=C3=A9paration=20choix=20m?= =?UTF-8?q?=C3=A9thode=20de=20g=C3=A9n=C3=A9ration=20de=20re=C3=A7us?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 08d84642c176039d5b91135007ba419f5cae36eca6445b55d0ed47b7db362df9 --- config.json | 6 ++ garradin_plugin.ini | 4 +- lib/Utils.php | 54 ++++++++++------ templates/_nav.tpl | 3 + templates/index.tpl | 136 ++++++++++++++++++++++++++++++++------- templates/personne.tpl | 17 ++--- templates/versements.tpl | 82 +++++++++++------------ www/admin/index.php | 10 +++ www/admin/script.js | 13 +++- www/admin/style.css | 3 + www/admin/versements.php | 2 +- 11 files changed, 223 insertions(+), 107 deletions(-) diff --git a/config.json b/config.json index 2c63c08..bbc1ecc 100644 --- a/config.json +++ b/config.json @@ -1,2 +1,8 @@ { + "auteur" : "jce", + "articlesCGI" : [ + "Article 200", + "Article 228 bis", + "Article 978" + ] } diff --git a/garradin_plugin.ini b/garradin_plugin.ini index eb0a5f2..1660303 100644 --- a/garradin_plugin.ini +++ b/garradin_plugin.ini @@ -1,8 +1,8 @@ nom="Reçus fiscaux" description="Génération de reçus fiscaux pour les dons des membres" auteur="jce" -url="" +url="https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin" version="0.1" menu=1 -config=0 +config=1 min_version="1.1" diff --git a/lib/Utils.php b/lib/Utils.php index a964576..22cf619 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -14,7 +14,7 @@ class Utils { return DB::getInstance()->get( "SELECT - id, + id as idActivite, label, description FROM services @@ -47,9 +47,9 @@ class Utils { return DB::getInstance()->get( "SELECT - services.id as idService, - services.label as titreService, - services.description as descService, + services.id as idActivite, + services.label as titreActivite, + services.description as descActivite, services_fees.id as idTarif, services_fees.label as titreTarif, services_fees.description as descTarif @@ -66,13 +66,14 @@ class Utils { return DB::getInstance()->get( "SELECT - services.id as Id, - services.label, - services.description as descService, - services_fees.label as tarif, + services.id as idActivite, + services.label as titreActivite, + services.description as descActivite, + services_fees.id as idTarif, + services_fees.label as titreTarif, services_fees.description as descTarif, - acc_accounts.code as numero_cpt, - acc_accounts.label as nom_cpt + acc_accounts.code as numeroCpt, + acc_accounts.label as nomCpt FROM services LEFT JOIN services_fees ON services_fees.id_service = services.id LEFT JOIN acc_accounts ON services_fees.id_account = acc_accounts.id @@ -164,7 +165,7 @@ class Utils public static function getVersementsTotaux($annee) { $sql = "SELECT - acc_transactions_users.id_user as id, + acc_transactions_users.id_user as idUser, membres.nom as nom, sum(acc_transactions_lines.credit) AS montant, membres.adresse as adresse, @@ -195,43 +196,54 @@ class Utils * @return nom de l'association */ public static function getNomAsso() { - return DB::getInstance()->get( + return DB::getInstance()->first( "SELECT value FROM config WHERE key = 'nom_asso'" - )[0]->value; + )->value; } /** * @return adresse de l'association */ public static function getAdresseAsso() { - return DB::getInstance()->get( + return DB::getInstance()->first( "SELECT value FROM config WHERE key = 'adresse_asso'" - )[0]->value; + )->value; } /** - * récupérer l'année du premier exercice + * @return liste des années fiscales */ - public static function getPremiereAnnee() { - return DB::getInstance()->get( + public static function getAnneesFiscales() { + $rows = DB::getInstance()->get( "SELECT strftime('%Y', start_date) as annee FROM acc_years - ORDER by start_date" - )[0]->value; + ORDER by start_date DESC" + ); + $anneesFiscales = array(); + foreach ($rows as $row) { + $anneesFiscales[] = $row->annee; + } + return $anneesFiscales; } // ------------------------------------------------------------------------ // zip archive creation // ------------------------------------------------------------------------ + /** + * enregistrer les fichiers dans une archive zip + * @param $fileList : liste des fichiers à archiver + * @param $year : pour générer le nom de l'archive + * @param $archiveDir : ne sert plus + */ static function makeArchive( $fileList, $year, - $archiveDir) + $archiveDir = null) { $zipFilename = "recus_dons" . $year . ".zip"; header('Content-type: application/zip'); diff --git a/templates/_nav.tpl b/templates/_nav.tpl index ed9bae6..5908a88 100644 --- a/templates/_nav.tpl +++ b/templates/_nav.tpl @@ -7,5 +7,8 @@
Nom | -Description | -Tarif | -Description | -N° Compte | -Nom Compte | -
---|---|---|---|---|---|
{$activite.label} | -{$activite.descService} | -{$activite.tarif} | -{$activite.descTarif} | -{$activite.numero_cpt} | -{$activite.nom_cpt} | -