From 26c113349a6a1ae4c71be8800eedf161016e6cff Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 25 Feb 2022 17:07:24 +0000 Subject: [PATCH 001/137] =?UTF-8?q?ajouts=20fichiers=20oubli=C3=A9s=20;=20?= =?UTF-8?q?suppression=20fichiers=20inutiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 28fb218f925df004a6471dfeb2df98aac1da5c505559adf051425ac76cc1dead --- CHANGELOG | 0 LICENCE | 14 -------------- garradin_plugin.ini | 2 +- install.php | 2 +- templates/upload.tpl | 18 ++++++++++++++++++ www/admin/upload.php | 23 +++++++++++++++++++++++ 6 files changed, 43 insertions(+), 16 deletions(-) delete mode 100644 CHANGELOG delete mode 100644 LICENCE create mode 100644 templates/upload.tpl create mode 100644 www/admin/upload.php diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index e69de29..0000000 diff --git a/LICENCE b/LICENCE deleted file mode 100644 index ad1b3a4..0000000 --- a/LICENCE +++ /dev/null @@ -1,14 +0,0 @@ -Plugin Facturation pour Garradin -Copyright (C) 2019 zou - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation version 3 of the License - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see \ No newline at end of file diff --git a/garradin_plugin.ini b/garradin_plugin.ini index a32c0bf..9b0cdc8 100644 --- a/garradin_plugin.ini +++ b/garradin_plugin.ini @@ -2,7 +2,7 @@ nom="Reçus fiscaux" description="Génération de reçus fiscaux pour les dons des membres" auteur="jce" url="https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin" -version="0.4" +version="0.5" menu=1 config=1 min_version="1.1" diff --git a/install.php b/install.php index 17063aa..6abc40a 100644 --- a/install.php +++ b/install.php @@ -2,7 +2,7 @@ namespace Garradin; use Garradin\Entities\Files\File; -// « signature » par défaut à remplacer (voir configuration) +// « signature » par défaut à remplacer (voir l'onglet de configuration) $path = __DIR__ . '/data/default_signature.png'; $default_signature_file = (new File)->createAndStore('skel/plugin/recusFiscaux','default_signature.png', $path, null); diff --git a/templates/upload.tpl b/templates/upload.tpl new file mode 100644 index 0000000..45089b0 --- /dev/null +++ b/templates/upload.tpl @@ -0,0 +1,18 @@ +{include file="admin/_head.tpl" title="Envoi de fichier"} + +{form_errors} + +
+
+ Téléverser des fichiers +
+ {input type="file" name="file[]" multiple=true label="Fichiers à envoyer" data-enhanced=1} +
+

+ {csrf_field key=$csrf_key} + {button type="submit" name="upload" label="Envoyer" shape="upload" class="main"} +

+
+
+ +{include file="admin/_foot.tpl"} diff --git a/www/admin/upload.php b/www/admin/upload.php new file mode 100644 index 0000000..945ce80 --- /dev/null +++ b/www/admin/upload.php @@ -0,0 +1,23 @@ +runIf('upload', function () use ($parent) { + $sig_file = File::uploadMultiple($parent, 'file'); + $_SESSION['sig_file'] = $sig_file; + +}, $csrf_key, PLUGIN_ROOT . '/www/admin/config.php'); + +$tpl->assign(compact('parent', 'csrf_key')); + +$tpl->display(PLUGIN_ROOT . '/templates/upload.tpl'); From cc6c46f59df4c8a732d2f42cc071a815788b6233 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 2 Mar 2022 12:38:15 +0000 Subject: [PATCH 002/137] =?UTF-8?q?suppression=20fichiers=20cr=C3=A9=C3=A9?= =?UTF-8?q?s=20lors=20d=C3=A9sinstallation=20;=20suppression=20majuscule?= =?UTF-8?q?=20dans=20nom=20plugin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 2134225b5757bee55253c1af81ba9f3dab5ea2f948c93ae42d76d3af6164f370 --- README.md | 4 ++-- install.php | 3 +-- lib/pdf.css | 3 ++- uninstall.php | 11 +++++++++++ www/admin/config.php | 4 ++-- www/admin/generer_activites.php | 2 +- www/admin/generer_personnes.php | 2 +- www/admin/style.css | 3 ++- www/admin/upload.php | 4 +--- 9 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 uninstall.php diff --git a/README.md b/README.md index c2570fb..3e4bc27 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Plugin reçus fiscaux pour Garradin -Plugin de reçus fiscaux pour le logiciel de gestion d'association Garradin ( https://garradin.eu/ - https://fossil.kd2.org/garradin ). +Plugin de reçus fiscaux pour le logiciel de gestion d'association Garradin (https://garradin.eu/ - https://fossil.kd2.org/garradin). Source : https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin ## Installation -Vous pouvez télécharger l'archive .tar.gz depuis la page des [releases](https://), et la placer directement dans le dossier plugins de Garradin. +Vous pouvez télécharger [l'archive .tar.gz](https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin/-/archive/master/recus-fiscaux-garradin-master.tar.gz), et la désarchiver dans le dossier plugins de Garradin. ## Fonctionnalités - Créer des reçus fiscaux pour des dons et génération du cerfa correspondant diff --git a/install.php b/install.php index 6abc40a..6fb3e16 100644 --- a/install.php +++ b/install.php @@ -4,5 +4,4 @@ use Garradin\Entities\Files\File; // « signature » par défaut à remplacer (voir l'onglet de configuration) $path = __DIR__ . '/data/default_signature.png'; -$default_signature_file = (new File)->createAndStore('skel/plugin/recusFiscaux','default_signature.png', $path, null); - +$_SESSION['default_signature_file'] = (new File)->createAndStore('skel/plugin/recusfiscaux','default_signature.png', $path, null); diff --git a/lib/pdf.css b/lib/pdf.css index f1f7603..9ae6ceb 100644 --- a/lib/pdf.css +++ b/lib/pdf.css @@ -113,7 +113,8 @@ body #signature { display: block; - width : 7cm; + max-width : 7cm; + max-height : 2cm; margin: 0 auto; padding-bottom : 2mm; } diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 0000000..b4bf885 --- /dev/null +++ b/uninstall.php @@ -0,0 +1,11 @@ +delete(); + +// signature réelle +$_SESSION['sig_file'][0]->delete(); diff --git a/www/admin/config.php b/www/admin/config.php index c7aca5a..fb7f621 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -32,7 +32,7 @@ if (f('save') && $form->check('recusfiscaux_config')) // nom, fonction et signature du responsable $plugin->setConfig('nom_responsable', trim(f('nom_responsable'))); $plugin->setConfig('fonction_responsable', trim(f('fonction_responsable'))); - if (isset($_SESSION['sig_file'])) { + if (isset($_SESSION['sig_file']) && count($_SESSION['sig_file']) > 0) { $plugin->setConfig('signature', $_SESSION['sig_file'][0]->path); } @@ -46,7 +46,7 @@ if (f('save') && $form->check('recusfiscaux_config')) $tpl->assign('ok', qg('ok') !== null); $tpl->assign('path', $path); -$tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusFiscaux/default_signature.png"); +$tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"); $tpl->assign('plugin_config', $plugin->getConfig()); $tpl->assign('plugin_css', ['style.css']); $tpl->display(PLUGIN_ROOT . '/templates/config.tpl'); diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index 8678893..0776adf 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -24,7 +24,7 @@ $adresseAsso = Utils::getAdresseAsso(); $signature = (null !== $plugin->getConfig('signature')) ? \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : - \Garradin\WWW_URL . "plugin/recusFiscaux/default_signature.png"; + \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"; // articles du CGI $articlesCGI = array(); diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index 1866bdc..3b4bfcb 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -22,7 +22,7 @@ $adresseAsso = Utils::getAdresseAsso(); $signature = (null !== $plugin->getConfig('signature')) ? \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : - \Garradin\WWW_URL . "plugin/recusFiscaux/default_signature.png"; + \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"; // articles du CGI $articlesCGI = array(); diff --git a/www/admin/style.css b/www/admin/style.css index b3a08bc..b158dbb 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -32,7 +32,8 @@ input[type="text"] { } #signature { - width:300px; + max-width: 300px; + max-height 150px; } dl.config { diff --git a/www/admin/upload.php b/www/admin/upload.php index 945ce80..7fd5387 100644 --- a/www/admin/upload.php +++ b/www/admin/upload.php @@ -13,9 +13,7 @@ if (!File::checkCreateAccess($parent, $session)) { $csrf_key = 'upload_file_' . md5($parent); $form->runIf('upload', function () use ($parent) { - $sig_file = File::uploadMultiple($parent, 'file'); - $_SESSION['sig_file'] = $sig_file; - + $_SESSION['sig_file'] = File::uploadMultiple($parent, 'file'); }, $csrf_key, PLUGIN_ROOT . '/www/admin/config.php'); $tpl->assign(compact('parent', 'csrf_key')); From 95c8063083844e9dd05bf5c821556a63c899b947 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 3 Mar 2022 11:09:52 +0000 Subject: [PATCH 003/137] =?UTF-8?q?corrections=20erreurs=20d=C3=A9sinstall?= =?UTF-8?q?ation=20et=20g=C3=A9n=C3=A9ration=20re=C3=A7us?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: bf921ff8922652b165537fd1a2e9cf7661becaab65484213c9f93f9685ef66c4 --- config.json | 6 ++++-- data/default_signature.png | Bin 5689 -> 16360 bytes install.php | 5 ++++- lib/RecusHTML.php | 5 +++-- templates/config.tpl | 34 ++++++++++++++++++++++++++-------- uninstall.php | 8 ++++++-- www/admin/config.php | 24 ++++++++++++++++++++++-- www/admin/style.css | 6 ------ 8 files changed, 65 insertions(+), 23 deletions(-) diff --git a/config.json b/config.json index 995e5df..27ff89b 100644 --- a/config.json +++ b/config.json @@ -17,12 +17,14 @@ { "taux" : "normal", "ligne" : "UF", - "remarque" : "" + "remarque" : "", + "valeur" : 0 }, { "taux" : "majoré", "ligne" : "UD", - "remarque" : "aide aux personnes en difficulté" + "remarque" : "aide aux personnes en difficulté", + "valeur" : 0 } ] } diff --git a/data/default_signature.png b/data/default_signature.png index 38aa69f5125704713a5cb9ed6b24542f3a2b37cc..4ea7ecfffef187f76409595506d0539d339ee03c 100644 GIT binary patch literal 16360 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 X&vbXicreateAndStore('skel/plugin/recusfiscaux','default_signature.png', $path, null); +$default_signature_file = (new File)->createAndStore('skel/plugin/recusfiscaux', + 'default_signature.png', + $path, + null); diff --git a/lib/RecusHTML.php b/lib/RecusHTML.php index d00e780..42f37ee 100644 --- a/lib/RecusHTML.php +++ b/lib/RecusHTML.php @@ -92,7 +92,8 @@ FDD; $nbArticles = count($this->articlesCGI); if ($nbArticles == 1) { - echo "Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d'impôt prévue à l’article $this->articlesCGI[0] du CGI

\n"; + echo "

Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d'impôt prévue à l’article "; + printf("%s du code général des impôts

\n", $this->articlesCGI[0]); } else if ($nbArticles > 1) { @@ -106,7 +107,7 @@ FDD; echo " et "; } } - echo " du code général des impôts

"; + echo " du code général des impôts

\n"; } echo "\n"; diff --git a/templates/config.tpl b/templates/config.tpl index 55796c6..bc49871 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -18,7 +18,10 @@ *}
(obligatoire)
+ {input type="textarea" name="objet_asso" source=$plugin.config label="" required="required" cols="50" rows="6" maxlength=300} + {* {input type="text" name="objet_asso" source=$plugin.config label="" required="required" maxlength=300} +*}
{* @@ -28,35 +31,50 @@ *}
- (obligatoire) + (obligatoire ; sélectionnez tous les articles qui s'appliquent à l'asociation)
{foreach from=$plugin_config->articlesCGI key="key" item="article"} {* À VÉRIFIER : {input : checked ne fonctionne pas si l'attribut name est un tableau... {input type="checkbox" name="articlesCGI[]" value=$key label=$article.titre} *} - +
+ + +
+ {/foreach} +
+ +
+
+ (obligatoire ; sélectionnez tous les taux qui s'appliquent à l'asociation) +
+ {foreach from=$plugin_config->reduction key="key" item="taux"} +
+ + {/if} +
{/foreach}
-{*
Nom, fonction et signature du responsable -*}
-
(obligatoire)
+
(obligatoire)
{input type="text" name="nom_responsable" source=$plugin.config label="" required="required" maxlength=50}
-
(obligatoire)
+
(obligatoire)
{input type="text" name="fonction_responsable" source=$plugin.config label="" required="required" maxlength=50}
-
(obligatoire)
+
(obligatoire)

L'image de la signature doit être d'une taille « raisonnable » et avoir un fond transparent

{if $plugin_config.signature != ''} diff --git a/uninstall.php b/uninstall.php index b4bf885..22bc6d1 100644 --- a/uninstall.php +++ b/uninstall.php @@ -5,7 +5,11 @@ use Garradin\Entities\Files\File; // supprimer les fichiers créés // signature par défaut -$_SESSION['default_signature_file']->delete(); +$default_signature_file = \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_signature.png'); +$default_signature_file->delete(); // signature réelle -$_SESSION['sig_file'][0]->delete(); +$signature = $plugin->getConfig('signature'); +if (null !== $signature) { + \Garradin\Files\Files::get($signature)->delete(); +} diff --git a/www/admin/config.php b/www/admin/config.php index fb7f621..76b2739 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -6,6 +6,7 @@ use Garradin\Entities\Files\File; $session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN); $art_sel=f('articlesCGI') ? : []; +$taux_sel = f('tauxReduction') ? : []; $path = qg('path') ?: File::CONTEXT_CONFIG; $context = Files::getContext($path); @@ -21,7 +22,7 @@ if (f('save') && $form->check('recusfiscaux_config')) $confArticles = $plugin->getConfig('articlesCGI'); // effacer l'ancienne configuration for ($i = 0; $i < count($confArticles); ++$i) { - $confArticles[$i]->valeur = 0; + $confArticles[$i]->valeur = 0; } // et copier la nouvelle foreach ($art_sel as $article) { @@ -29,10 +30,29 @@ if (f('save') && $form->check('recusfiscaux_config')) } $plugin->setConfig("articlesCGI", $confArticles); + // taux de réduction + $confTaux = $plugin->getConfig('reduction'); + // effacer l'ancienne configuration + for ($i = 0; $i < count($confTaux); ++$i) { + $confTaux[$i]->valeur = 0; + } + // et copier la nouvelle + foreach ($taux_sel as $taux) { + $confTaux[$taux]->valeur = 1; + } + $plugin->setConfig("reduction", $confTaux); + // nom, fonction et signature du responsable $plugin->setConfig('nom_responsable', trim(f('nom_responsable'))); $plugin->setConfig('fonction_responsable', trim(f('fonction_responsable'))); - if (isset($_SESSION['sig_file']) && count($_SESSION['sig_file']) > 0) { + if (isset($_SESSION['sig_file']) && count($_SESSION['sig_file']) > 0) + { + // supprimer la signature précédente, si besoin + if (null !== $plugin->getConfig('signature')) + { + \Garradin\Files\Files::get($plugin->getConfig('signature'))->delete(); + } + // puis installer la nouvelle $plugin->setConfig('signature', $_SESSION['sig_file'][0]->path); } diff --git a/www/admin/style.css b/www/admin/style.css index b158dbb..3d95bfb 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -11,9 +11,6 @@ fieldset { -webkit-border-radius:8px; border-radius:8px; } -fieldset label { - font-weight:bold; -} div span { padding-left : 0.5em; padding-right : 0.5em; @@ -27,9 +24,6 @@ summary.activite { h3.personne { background: rgba(var(--gSecondColor), 0.35); } -input[type="text"] { - width: 50em; -} #signature { max-width: 300px; From 8147e5791a703b8978f6c0a34ec781f10b8bacc9 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 3 Mar 2022 13:15:48 +0000 Subject: [PATCH 004/137] =?UTF-8?q?encore=20des=20erreurs=20de=20d=C3=A9si?= =?UTF-8?q?nstallation=20corrig=C3=A9es=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 4a86c1b18ea6bef9a5b1ba038e8321d97e2e7657c5a813d4e1bed29116c24695 --- templates/config.tpl | 5 +---- templates/index.tpl | 4 ++++ uninstall.php | 9 +++++++-- www/admin/config.php | 5 ++++- www/admin/style.css | 3 ++- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/templates/config.tpl b/templates/config.tpl index bc49871..4658e19 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -18,10 +18,7 @@ *}
(obligatoire)
- {input type="textarea" name="objet_asso" source=$plugin.config label="" required="required" cols="50" rows="6" maxlength=300} - {* - {input type="text" name="objet_asso" source=$plugin.config label="" required="required" maxlength=300} -*} + {input type="textarea" name="objet_asso" source=$plugin.config label="" required="required" cols="50" rows="4" maxlength=300}
{*
diff --git a/templates/index.tpl b/templates/index.tpl index 4f48de1..4aff8bf 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -52,11 +52,13 @@

Choisir le taux de réduction

{foreach from=$plugin_config->reduction item="reduc"} + {if $reduc->valeur == 1} + {/if} {/foreach}
@@ -92,11 +94,13 @@ {foreach from=$plugin_config->reduction item="reduc"} + {if $reduc->valeur == 1} + {/if} {/foreach} {if $activite.descActivite != ""}{$activite.descActivite} ; {/if}{$activite.descTarif} diff --git a/uninstall.php b/uninstall.php index 22bc6d1..5f8bdeb 100644 --- a/uninstall.php +++ b/uninstall.php @@ -6,10 +6,15 @@ use Garradin\Entities\Files\File; // signature par défaut $default_signature_file = \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_signature.png'); -$default_signature_file->delete(); +if (null !== $default_signature_file) { + $default_signature_file->delete(); +} // signature réelle $signature = $plugin->getConfig('signature'); if (null !== $signature) { - \Garradin\Files\Files::get($signature)->delete(); + $sig_file = \Garradin\Files\Files::get($signature); + if (null !== $sig_file) { + $sig_file->delete(); + } } diff --git a/www/admin/config.php b/www/admin/config.php index 76b2739..ebd1137 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -50,7 +50,10 @@ if (f('save') && $form->check('recusfiscaux_config')) // supprimer la signature précédente, si besoin if (null !== $plugin->getConfig('signature')) { - \Garradin\Files\Files::get($plugin->getConfig('signature'))->delete(); + $sig_file = \Garradin\Files\Files::get($plugin->getConfig('signature')); + if (null !== $sig_file) { + $sig_file->delete(); + } } // puis installer la nouvelle $plugin->setConfig('signature', $_SESSION['sig_file'][0]->path); diff --git a/www/admin/style.css b/www/admin/style.css index 3d95bfb..735c4a3 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -26,8 +26,9 @@ h3.personne { } #signature { + padding : 1em 0.5em 0 0.5em; max-width: 300px; - max-height 150px; + max-height: 150px; } dl.config { From 6d49553ed138ba40051fb313f3884db6bffc7fac Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 4 Mar 2022 08:39:20 +0000 Subject: [PATCH 005/137] simplification de la configuration et des choix de tarifs et taux FossilOrigin-Name: 0887b9389829b41439ac7ff12d1594b40573d3a049298e311100165fccb4a567 --- lib/pdf.css | 1 + templates/config.tpl | 10 +++++----- templates/index.tpl | 34 +++++++++++++++++++++++++++++----- www/admin/index.php | 8 ++++++++ 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/lib/pdf.css b/lib/pdf.css index 9ae6ceb..58a80c3 100644 --- a/lib/pdf.css +++ b/lib/pdf.css @@ -89,6 +89,7 @@ body #final { grid-area: signature; + height : 5cm; } .rubrique diff --git a/templates/config.tpl b/templates/config.tpl index 4658e19..04e36a9 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -61,17 +61,17 @@
Nom, fonction et signature du responsable
-
(obligatoire)
- {input type="text" name="nom_responsable" source=$plugin.config label="" required="required" maxlength=50} +
+ {input type="text" name="nom_responsable" source=$plugin.config label="" maxlength=50}
-
(obligatoire)
- {input type="text" name="fonction_responsable" source=$plugin.config label="" required="required" maxlength=50} +
+ {input type="text" name="fonction_responsable" source=$plugin.config label="" maxlength=50}
-
(obligatoire)
+

L'image de la signature doit être d'une taille « raisonnable » et avoir un fond transparent

{if $plugin_config.signature != ''} diff --git a/templates/index.tpl b/templates/index.tpl index 4aff8bf..2e9feb9 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -54,8 +54,13 @@ {foreach from=$plugin_config->reduction item="reduc"} {if $reduc->valeur == 1} - + {/if} @@ -87,7 +92,20 @@ {foreach from=$activitesTarifsComptes item="activite"} - {input type="checkbox" name="tarifs[]" value=$activite.idTarif} + {if $nbTarifs == 1} + {input + type="checkbox" + name="tarifs[]" + value=$activite.idTarif + checked="checked" + } + {else} + {input + type="checkbox" + name="tarifs[]" + value=$activite.idTarif + } + {/if} {$activite.titreActivite} - {$activite.titreTarif} @@ -96,8 +114,14 @@ {foreach from=$plugin_config->reduction item="reduc"} {if $reduc->valeur == 1} - + 1}disabled{/if} + {if $nbTaux == 1}checked{/if} + /> {/if} diff --git a/www/admin/index.php b/www/admin/index.php index ff7ca3d..48559e8 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -13,6 +13,12 @@ if ($anneesFiscales[0] < $anneeCourante) { // libellés pour les taux de réduction $_SESSION['ligneReduction'] = Utils::getLignesReduction($plugin->getConfig('reduction')); +// compter le nombre de taux de réduction activés +$nbTaux = 0; +foreach ($plugin->getConfig('reduction') as $taux) +{ + if ($taux->valeur == 1) { ++$nbTaux; } +} // liste des activités, cotisations et comptes associés $activitesTarifsComptes = Utils::getActivitesTarifsEtComptes(); @@ -21,7 +27,9 @@ $activitesTarifsComptes = Utils::getActivitesTarifsEtComptes(); $tpl->assign('anneesFiscales', $anneesFiscales); $tpl->assign('anneeCourante', $anneeCourante); $tpl->assign('activitesTarifsComptes', $activitesTarifsComptes); +$tpl->assign('nbTarifs', count($activitesTarifsComptes)); $tpl->assign('plugin_config', $plugin->getConfig()); +$tpl->assign('nbTaux', $nbTaux); $tpl->assign('plugin_css', ['style.css']); // envoyer au template From 33bb577b34263b295f39f7011eeec64bbceab934 Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 4 Mar 2022 10:11:00 +0000 Subject: [PATCH 006/137] =?UTF-8?q?v=C3=A9rification=20s=C3=A9lection=20ta?= =?UTF-8?q?ux=20;=20traitement=20absence=20signature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 47d1b79ff0bdacfe44b328e6b5d537a04e91093f5d7f116f8a77384d5756483e --- templates/index.tpl | 8 ++++++++ www/admin/generer_activites.php | 3 +-- www/admin/generer_personnes.php | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/templates/index.tpl b/templates/index.tpl index 2e9feb9..b87900e 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -51,6 +51,9 @@ @@ -78,6 +82,9 @@ diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index 0776adf..ea42398 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -20,11 +20,10 @@ $totalPersonnes = cumulerVersements($versementsSelectionnes); // générer les reçus $nomAsso = Utils::getNomAsso(); $adresseAsso = Utils::getAdresseAsso(); - $signature = (null !== $plugin->getConfig('signature')) ? \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : - \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"; + ""; // articles du CGI $articlesCGI = array(); diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index 3b4bfcb..524d3d1 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -18,11 +18,10 @@ foreach ($lesLignes as $ligne) { // générer les reçus $nomAsso = Utils::getNomAsso(); $adresseAsso = Utils::getAdresseAsso(); - $signature = (null !== $plugin->getConfig('signature')) ? \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : - \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"; + ""; // articles du CGI $articlesCGI = array(); From 5074876f0aaf1a9b76e4b2234bc232416978322b Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 4 Mar 2022 12:54:53 +0000 Subject: [PATCH 007/137] incorporation feuille de style dans lib/RecusHTML.php FossilOrigin-Name: fb483e52b61476d0f050be88b34d91dcb4dcf627b71c85ef256d59a18f3427ec --- lib/RecusHTML.php | 89 +++++++++++++++++++- lib/pdf.css | 126 ----------------------------- templates/versements_activites.tpl | 6 -- 3 files changed, 87 insertions(+), 134 deletions(-) delete mode 100644 lib/pdf.css diff --git a/lib/RecusHTML.php b/lib/RecusHTML.php index 42f37ee..13e0ba9 100644 --- a/lib/RecusHTML.php +++ b/lib/RecusHTML.php @@ -148,14 +148,99 @@ FDD; protected function entete() { - $styleSheet = \Garradin\PLUGIN_ROOT . "/lib/pdf.css"; +// $styleSheet = \Garradin\PLUGIN_ROOT . "/lib/pdf.css"; +// error_log("pdf.css = " . $styleSheet); ob_start(); echo << - +
diff --git a/lib/pdf.css b/lib/pdf.css deleted file mode 100644 index 58a80c3..0000000 --- a/lib/pdf.css +++ /dev/null @@ -1,126 +0,0 @@ -/* organisation spatiale */ - -@page -{ - size: A4 portrait; - margin: 1cm; -} - - -body -{ - font-family: Serif; - font-size: 11pt; - background-color: white; - display: grid; - grid-template-areas: - 'entete' - 'beneficiaire' - 'donateur' - 'versements' - 'signature'; -} - -#entete -{ - grid-area: entete; -} - -#logoCerfa -{ - line-height: 40px; - width: 100px; - background-color: rgb(0, 0, 128); - border-radius : 50%; - text-align : center; - margin : 2mm; -} - -.centre -{ - display : inline-block; - vertical-align : middle; - line-height: 20px; /* moitié de la hauteur du logo */ - color : white; - font-weight: bold; - font-size : 14pt; -} - -#numCerfa -{ - width: 100px; /* largeur du logo */ - text-align: center; -} - -#titre -{ - margin : 0 4cm 0 4cm; - text-align : center; - font-size : 14pt; - font-weight: bold; -} - -#articles -{ - margin : 0 4cm 0 4cm; /* idem titre */ - text-align : center; -} - -#numRecu -{ - text-align : right; -} - -#beneficiaire -{ - grid-area: beneficiaire; -} - -#donateur -{ - grid-area: donateur; -} - -#versements -{ - grid-area: versements; -} - -#final -{ - grid-area: signature; - height : 5cm; -} - -.rubrique -{ - background-color : rgb(200, 200, 250); - padding : 2mm; -} - -.cartouche -{ - margin : 2mm auto; - padding : 0 2mm; - border : 1px solid rgb(0, 0, 128); - border-radius : 8px; -} - -.titre, .important -{ - font-weight:bold; -} - -#signature -{ - display: block; - max-width : 7cm; - max-height : 2cm; - margin: 0 auto; - padding-bottom : 2mm; -} - -#fonction, #nom -{ - text-align : center; -} diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 83dc026..1ab91ae 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -8,12 +8,6 @@
-{* -
- -
-*} -
From 106adaa3b7a502803f102fbfe57aed779dc4259b Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 11 Mar 2022 10:51:28 +0000 Subject: [PATCH 008/137] suppression lib/RecusPDF.php FossilOrigin-Name: 154973f4d2ddf3e0c4d83d250da237c4cb038000e4a99c779ae8e20b1e4c1590 --- lib/RecusPDF.php | 196 ----------------------------------------------- 1 file changed, 196 deletions(-) delete mode 100644 lib/RecusPDF.php diff --git a/lib/RecusPDF.php b/lib/RecusPDF.php deleted file mode 100644 index 9891cc2..0000000 --- a/lib/RecusPDF.php +++ /dev/null @@ -1,196 +0,0 @@ -AddFont($family, - '', - $family.$style.".ttf", - true); - // bold - $this->AddFont($family, - 'B', - $family.$style."-Bold.ttf", - true); - $this->nomAsso = $nomAsso; - $this->adresseAsso = $adresseAsso; - $this->logoCerfa = $logo; - $this->signature = $signature; - } - - // Header - function Header() - { - parent::Header(); - // Logo - $this->Image($this->logoCerfa, 10, 6, 30); - - // document title - $this->SetTextColor(0, 0, 0); - $this->SetFont('DejaVu','B',12); - $titre = "Reçu au titre des dons à certains organismes d'intérêt général"; - $this->SetXY(50, 10); - // Titre - $this->MultiCell(100, - 6, - $titre, - 0, - 'C'); - - // numéro de Cerfa - $cerfa = "N° 11580*3"; - $this->SetFont('DejaVu', 'B', 10); - $this->SetXY(10, 25); - $this->Cell(100, 0, $cerfa); - - // Articles - $this->SetFont('DejaVu', '', 9); - $this->SetXY(50, 25); - $this->Cell(100, 0, 'Article 200, 238 bis et 885-0 V bis A du code général des impôts'); - } - - // imprimer les informations du bénéficiaire - function imprimer_beneficiaire($nom, $adresse) - { - $this->titre_rubrique("Bénéficiaire des versements"); - $this->SetFont('DejaVu', 'B', 11); - $this->Cell(0, 6, 'Association « ' . $nom . ' »', 'LR', 1); - $this->Cell(0, 6, str_replace(array("\r\n", "\n", "\r"), " ", $adresse), 'LR', 1); - $this->imprimer_description("Objet : ", - "célébrer le culte protestant évangélique et pourvoir aux frais et besoins de ce culte."); - $this->Cell(0, 6, "", 'LRB', 1); - } - - // imprimer un libellé précédé de son titre en gras - function imprimer_description($titre, $libelle) - { - $this->SetFont('DejaVu', 'B', 11); - $this->Cell($this->GetStringWidth($titre), 6, $titre, 'L', 0); - $this->SetFont('DejaVu', '', 11); - $this->Cell(0, 6, $libelle, 'R', 1); - } - - // imprimer le montant de la réduction et un libellé - function imprimer_montant($texte, $montant, $libelle = "") - { - $this->SetFont('DejaVu'); - $this->Cell($this->GetStringWidth($texte), - 6, - $texte, - 'L', - 0); - $this->SetFont('DejaVu','B'); - $valeur = number_format($montant, 2, "," , "") . " euros"; - $this->Cell($this->GetStringWidth($valeur), - 6, - $valeur, - '', - 0); - $this->SetFont('DejaVu'); - if ($libelle != "") - { - $this->Cell(0, - 6, - " : " . $libelle, - 'R', - 1); - } - else - { - $this->Cell(0, 6, "", 'R', 1); - } - } - - function titre_rubrique($texte) - { - $this->SetFont('DejaVu','B',12); - $largeur_texte = $this->GetStringWidth($texte); - $this->setX(10); - $this->SetFillColor(0, 255, 255); - $this->Cell(0, 6, $texte, 'LTR', 1, 'C', true); - $this->Cell(0, 6, "", 'LR', 1); - } - - // imprimer le reçu - function imprimer_recu($annee_recu, - $numero, - $nom, - $lesMontants, - $adresse, - $code_postal, - $ville) - { - - $this->AddPage(); - // Numéro de reçu - $this->SetFont('DejaVu', 'B', 11); - $this->MultiCell(0, 20, 'Reçu numéro ' . $annee_recu . '/' . $numero); - - // bénéficiaire - $this->imprimer_beneficiaire($this->nomAsso, $this->adresseAsso); - - // donateur - $this->Ln(10); - $this->titre_rubrique("Donateur"); - $this->SetFont('DejaVu', 'B', 11); - $this->Cell(0, 6, $nom, 'LR', 1); - $this->Cell(0, 6, $adresse, 'LR', 1); - $this->Cell(0, 6, $code_postal . " " . $ville, 'LR', 1); - $this->Cell(0, 6, "", 'LRB', 1); - - // Montant et autres informations - $this->Ln(10); - $this->SetFont('DejaVu', '', 11); - $this->Cell(0, - 6, - "Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt :", - 'LTR', - 1); - foreach ($lesMontants as $taux => $montant) - { - $this->imprimer_montant(" - la somme de ", $montant, Utils::getLigneReduction($taux)); - } - $this->Cell(0, 3, "", 'LR', 1); - $this->imprimer_description('Date des versements : ', - 'année ' . $annee_recu); - $this->Cell(0, 3, "", 'LR', 1); - $this->MultiCell(0, 6, - "Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction -d'impôt prévue à l’article 200 du CGI", - 'LR'); - $this->Cell(0, 3, "", 'LR', 1); - $this->imprimer_description("Forme du don : ", "Autre"); - $this->Cell(0, 3, "", 'LR', 1); - $this->imprimer_description("Nature du don : ", "Numéraire"); - $this->Cell(0, 3, "", 'LR', 1); - $this->imprimer_description("Mode de versement : ", "chèque et/ou virement"); - $this->Cell(0, 0, "", 'LRB', 1); - - // cartouche final - $this->Ln(10); - $this->Cell(0, 6, "", 'LRT', 1); - $this->Cell(0, 6, "Rennes le " . date("j/m/Y"), 'LR', 1, 'R'); - $this->Cell(0, 36, "", 'LR', 1); - $this->Cell(0, 0, "", 'LBR', 1); - $this->SetXY(100, 220); - $this->Image($this->signature, null, null, 50); - } -} // class RecusPDF From 2d643f51668735ddc0afef489d636454d8730faf Mon Sep 17 00:00:00 2001 From: engel <> Date: Mon, 14 Mar 2022 17:58:20 +0000 Subject: [PATCH 009/137] =?UTF-8?q?ajout=20correction=20d=C3=A9sinstallati?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: abe813c05e1ada1f3c8403c9ab4ad1adc2004599405e18c977cb95845effc77c --- uninstall.php | 1 + 1 file changed, 1 insertion(+) diff --git a/uninstall.php b/uninstall.php index 5f8bdeb..86e35bf 100644 --- a/uninstall.php +++ b/uninstall.php @@ -18,3 +18,4 @@ if (null !== $signature) { $sig_file->delete(); } } +unset($_SESSION['sig_file']); From d2289b49dbe883346bc35653811e46ae301858fe Mon Sep 17 00:00:00 2001 From: engel <> Date: Mon, 14 Mar 2022 19:46:48 +0000 Subject: [PATCH 010/137] =?UTF-8?q?=C2=AB=20am=C3=A9lioration=20=C2=BB=20p?= =?UTF-8?q?r=C3=A9sentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 8679f6447d447430c2b642ab784f06609fec9e39d3e4447d582830b069e7a70a --- README.md | 20 ++++++++++++-------- templates/_nav.tpl | 4 ++-- templates/index.tpl | 10 ++++++++-- templates/versements_activites.tpl | 2 +- templates/versements_personnes.tpl | 2 +- www/admin/style.css | 5 +++++ 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3e4bc27..bc42852 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,20 @@ Plugin de reçus fiscaux pour le logiciel de gestion d'association Garradin (htt Source : https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin ## Installation -Vous pouvez télécharger [l'archive .tar.gz](https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin/-/archive/master/recus-fiscaux-garradin-master.tar.gz), et la désarchiver dans le dossier plugins de Garradin. +Vous pouvez télécharger [l'archive .tar.gz](https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin/-/archive/master/recus-fiscaux-garradin-master.tar.gz), et la copier ou la désarchiver dans le dossier plugins de Garradin. ## Fonctionnalités -- Créer des reçus fiscaux pour des dons et génération du cerfa correspondant - - reçu par activité et tarif : 1, n ou tous - - reçu par personne : 1, n ou tous - - reçu par versement : 1, n ou tous +- Créer des reçus fiscaux pour les dons des membres + - reçu par activité et tarif : 1, plusieurs ou tous + - reçu par personne : 1, plusieurs ou tous - distinguer les différents taux de réduction ## Configuration -- Objet (but) de l'association -- Sélection des articles du CGI concernés par la réduction fiscale -- Enregistrement de la signature du responsable (image) +- association + - Objet (but) de l'association + - articles du CGI concernés par la réduction fiscale + - taux de réduction applicables +- responsable + - nom + - fonction + - signature (image) diff --git a/templates/_nav.tpl b/templates/_nav.tpl index 3c501aa..6ab82c4 100644 --- a/templates/_nav.tpl +++ b/templates/_nav.tpl @@ -4,9 +4,9 @@
+
+ Autres informations +
+
+

Précède la date sur le formulaire

+ {input type="text" name="ville_asso" source=$plugin.config label="" maxlength=50} +
+
+ +

N'oubliez pas d'enregistrer, sinon les modifications ne seront pas prises en compte !

diff --git a/www/admin/config.php b/www/admin/config.php index ebd1137..58c8b0b 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -59,6 +59,10 @@ if (f('save') && $form->check('recusfiscaux_config')) $plugin->setConfig('signature', $_SESSION['sig_file'][0]->path); } + // autres informations + // ville + $plugin->setConfig('ville_asso', trim(f('ville_asso')); + \Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok'); } catch (UserException $e) diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index 524d3d1..1b57127 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -41,6 +41,7 @@ foreach ($versementsSelectionnes as $ligne) $plugin->getConfig('objet_asso'), $plugin->getConfig('nom_responsable'), $plugin->getConfig('fonction_responsable'), + $plugin->getConfig('ville_asso'); $articlesCGI, $signature ); From fad85533458278ac8bf46795dc74fd0b82b816ae Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 17 Mar 2022 15:00:35 +0000 Subject: [PATCH 012/137] =?UTF-8?q?param=C3=A8trage=20ville=20avant=20date?= =?UTF-8?q?=20sur=20formulaire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 23ef0327f14e2bd7aff68dad738edcd2437bb31445b972c77131104fb891455b --- lib/RecusHTML.php | 4 +++- www/admin/config.php | 2 +- www/admin/generer_personnes.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/RecusHTML.php b/lib/RecusHTML.php index c2c722f..82c36cb 100644 --- a/lib/RecusHTML.php +++ b/lib/RecusHTML.php @@ -23,6 +23,7 @@ class RecusHTML $objetAsso, $nomResponsable, $fonctionResponsable, + $villeAsso, $articlesCGI, $signature) { @@ -31,6 +32,7 @@ class RecusHTML $this->objetAsso = $objetAsso; $this->nomResponsable = $nomResponsable; $this->fonctionResponsable = $fonctionResponsable; + $this->villeAsso = $villeAsso; $this->signature = $signature; $this->articlesCGI = $articlesCGI; $this->html = $this->entete(); @@ -116,7 +118,7 @@ FDD; $date = date("j/m/Y"); echo << -

{this->villeAsso} le {$date}

+

{$this->villeAsso} le {$date}

$this->nomResponsable

$this->fonctionResponsable

diff --git a/www/admin/config.php b/www/admin/config.php index 58c8b0b..ea4b386 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -61,7 +61,7 @@ if (f('save') && $form->check('recusfiscaux_config')) // autres informations // ville - $plugin->setConfig('ville_asso', trim(f('ville_asso')); + $plugin->setConfig('ville_asso', trim(f('ville_asso'))); \Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok'); } diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index 1b57127..763cd60 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -41,7 +41,7 @@ foreach ($versementsSelectionnes as $ligne) $plugin->getConfig('objet_asso'), $plugin->getConfig('nom_responsable'), $plugin->getConfig('fonction_responsable'), - $plugin->getConfig('ville_asso'); + $plugin->getConfig('ville_asso'), $articlesCGI, $signature ); From 9ced82c8baa5d1e2c620217d3d121b5cdcb271fc Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 17 Mar 2022 15:05:45 +0000 Subject: [PATCH 013/137] =?UTF-8?q?s=C3=A9curisation=20montant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: c9f2bdd4ffa1fd02df85023f7db185a1cf51308869f518ec2ef1179e8d31c001 --- lib/RecusHTML.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/RecusHTML.php b/lib/RecusHTML.php index 82c36cb..ecdac5a 100644 --- a/lib/RecusHTML.php +++ b/lib/RecusHTML.php @@ -142,7 +142,7 @@ FDD; function imprimer_montant($montant, $libelle = "") { $valeur = number_format($montant, 2, ',', ''); - echo "
  • la somme de {$valeur} euros"; + echo "
  • la somme de ***{$valeur}*** euros"; if ($libelle != "") { echo " ({$libelle})"; } From 5995f33efdcd2245e64c2c43780f80165fbfb385 Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 18 Mar 2022 08:30:41 +0000 Subject: [PATCH 014/137] =?UTF-8?q?param=C3=A8trage=20ville=20avant=20date?= =?UTF-8?q?=20sur=20formulaire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 082a2ce7d637df8593614e9ba3bbf8ef57c1c4da815eb7dff803657fc722b483 --- www/admin/generer_activites.php | 1 + 1 file changed, 1 insertion(+) diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index ea42398..043dd81 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -43,6 +43,7 @@ foreach ($totalPersonnes as $idPersonne => $personne) $plugin->getConfig('objet_asso'), $plugin->getConfig('nom_responsable'), $plugin->getConfig('fonction_responsable'), + $plugin->getConfig('ville_asso'), $articlesCGI, $signature ); From a3aa6fa2000350363839fa6960bc65b224c1a82d Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 18 Mar 2022 19:39:02 +0000 Subject: [PATCH 015/137] =?UTF-8?q?prise=20en=20compte=20de=20diff=C3=A9re?= =?UTF-8?q?nts=20champs=20nom=20et=20pr=C3=A9nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 2895a7a5054d102c3262500e9e67557129592b607830a406d30fd3596cdfe6a9 --- lib/Utils.php | 66 ++++++++++++---- templates/config.tpl | 97 ++++++++++++++++-------- templates/index.tpl | 118 +++++++++++++++-------------- www/admin/config.php | 42 +++++++++- www/admin/index.php | 12 +++ www/admin/style.css | 5 ++ www/admin/versements_activites.php | 20 ++++- www/admin/versements_personnes.php | 19 ++++- 8 files changed, 271 insertions(+), 108 deletions(-) diff --git a/lib/Utils.php b/lib/Utils.php index 14e414d..0df1fb7 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -43,10 +43,12 @@ class Utils * @return versements correspondants à l'année et aux tarifs donnés * @param $annee * @param array $tarifs + * @param array $champsNom : liste non vide des champs de nom/prénom */ - public static function getVersementsTarifs($annee, $tarifs) + public static function getVersementsTarifs($annee, $tarifs, $champsNom) { $db = DB::getInstance(); + $tri = Utils::combinerTri($champsNom); $sql = sprintf( 'SELECT services_fees.id as idTarif, @@ -65,21 +67,25 @@ class Utils services_fees.%s AND acc_transactions_lines.credit > 0) - ORDER by services_fees.id, membres.nom, acc_transactions.date', + ORDER by services_fees.id, %s, acc_transactions.date', '"%Y"', $annee, - $db->where('id', $tarifs)); + $db->where('id', $tarifs), + $tri + ); return $db->get($sql); } /** * Versements totaux par personne pour une année donnée * @param année + * @param array $champsNom : liste non vide des champs de nom/prénom */ - public static function getVersementsTotaux($annee) + public static function getVersementsTotaux($annee, $champsNom) { - $sql = - "SELECT + $tri = Utils::combinerTri($champsNom); + $sql = sprintf( + 'SELECT membres.id as idUser, sum(acc_transactions_lines.credit) AS versement FROM @@ -89,7 +95,7 @@ class Utils INNER JOIN acc_transactions_lines ON acc_transactions_lines.id_transaction = acc_transactions.id WHERE ( - strftime('%Y', acc_transactions.date) = ? + strftime(%s, acc_transactions.date) = "%d" AND acc_transactions_lines.credit > 0 AND @@ -98,21 +104,55 @@ class Utils acc_transactions_users.id_user = membres.id ) GROUP by acc_transactions_users.id_user - ORDER by membres.nom COLLATE U_NOCASE; - "; - return DB::getInstance()->get($sql, $annee); + ORDER by %s COLLATE U_NOCASE', + '"%Y"', + $annee, + $tri); + return DB::getInstance()->get($sql); + } + + /** + * combiner les champs avec un opérateur + * @param array $champs : liste (non vide) de champs + * @return chaîne combinée + */ + private static function combinerChamps($champs) + { + $op = ' || " " || '; + $result = 'ifnull(membres.' . $champs[0] . ', "")'; + for ($i = 1; $i < count($champs); ++$i) + { + $result .= $op . 'ifnull(membres.' . $champs[$i] . ', "")'; + } + return $result; + } + + private static function combinerTri($champs) + { + $tri = 'membres.' . $champs[0]; + for ($i = 1; $i < count($champs); ++$i) + { + $tri .= ', membres.' . $champs[$i]; + } + return $tri; } /** * @return personnes ayant versé des dons pour une année donnée * @param $annee + * @param array $champsNom : champs qui définissent le nom et le prénom d'une personne */ - public static function getDonateurs($annee) + public static function getDonateurs($annee, $champsNom) { + // concaténer les champs nom/prénoms pour la sélection + $nom = Utils::combinerChamps($champsNom) . ' as nom,'; + // et pour le tri + $tri = Utils::combinerTri($champsNom); $sql = "SELECT membres.id as idUser, - membres.nom as nom, + " . + $nom . " membres.adresse as adresse, membres.code_postal as codePostal, membres.ville as ville @@ -132,7 +172,7 @@ class Utils acc_transactions_users.id_user = membres.id ) GROUP by membres.id - ORDER by membres.nom COLLATE U_NOCASE; + ORDER by " . $tri . " COLLATE U_NOCASE "; return DB::getInstance()->get($sql, $annee); } diff --git a/templates/config.tpl b/templates/config.tpl index df61059..79029a4 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -13,47 +13,41 @@
    -{* - Objet (but) de l'association -*}
    (obligatoire)
    {input type="textarea" name="objet_asso" source=$plugin.config label="" required="required" cols="50" rows="4" maxlength=300}
    -{* -
    -
    - Droit à la réduction d'impôt -*}
    - (obligatoire ; sélectionnez tous les articles qui s'appliquent à l'asociation) + (obligatoire ; sélectionnez tous les articles qui s'appliquent à + l'asociation)
    {foreach from=$plugin_config->articlesCGI key="key" item="article"} -{* - À VÉRIFIER : {input : checked ne fonctionne pas si l'attribut name est un tableau... + {* + À VÉRIFIER : {input : checked ne fonctionne pas si l'attribut name est un tableau... {input type="checkbox" name="articlesCGI[]" value=$key label=$article.titre} *} -
    - +
    + -
    +
    {/foreach}
    - (obligatoire ; sélectionnez tous les taux qui s'appliquent à l'asociation) + (obligatoire ; sélectionnez tous les taux qui s'appliquent à + l'asociation)
    {foreach from=$plugin_config->reduction key="key" item="taux"} -
    - - {/if} -
    +
    + + {/if} +
    {/foreach}
    @@ -72,25 +66,42 @@
    -

    L'image de la signature doit être d'une taille « raisonnable » et avoir un fond transparent

    - {if $plugin_config.signature != ''} - - {else} - - {/if} - {linkbutton shape="upload" label="Changer de signature" target="_dialog" href="upload.php?p=%s"|args:$path} +

    L'image de la signature doit être d'une taille « raisonnable » et avoir un fond transparent

    + {if $plugin_config.signature != ''} + + {else} + + {/if} + {linkbutton shape="upload" label="Changer de signature" target="_dialog" href="upload.php?p=%s"|args:$path}
    Autres informations -
    +

    Précède la date sur le formulaire

    {input type="text" name="ville_asso" source=$plugin.config label="" maxlength=50}
    -
    + {* les champs de nom *} + +
    +
    +

    Sélectionnez et classez le(s) champ(s) qui représente(nt) le nom et le prénom du donateur

    + +
    + {foreach from=$nomChamps key="nom" item="champ"} +
    + + +
    +
    +
    + {/foreach} +
    +
    +

    N'oubliez pas d'enregistrer, sinon les modifications ne seront pas prises en compte !

    @@ -98,4 +109,26 @@ {csrf_field key="recusfiscaux_config"} {button type="submit" name="save" label="Enregistrer" shape="right" class="main"}

    - \ No newline at end of file + + +{literal} + +{/literal} \ No newline at end of file diff --git a/templates/index.tpl b/templates/index.tpl index 97a05d9..356628d 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -28,7 +28,8 @@ Tous les versements des membres font l'objet d'un reçu, sans tenir compte des activités et tarifs -

    Choisissez cette option si vous voulez sélectionner tous les versements d'une, plusieurs ou toutes les personnes

    +

    Choisissez cette option si vous voulez sélectionner tous les versements d'une, plusieurs + ou toutes les personnes

    @@ -44,8 +45,8 @@

    Choisissez cette option si vous voulez sélectionner :

      -
    • certaines activités ou certains tarifs
    • -
    • certains versements de certaines personnes
    • +
    • certaines activités ou certains tarifs
    • +
    • certains versements de certaines personnes
    @@ -58,19 +59,20 @@

    Choisir le taux de réduction

    {if $nbTaux == 0} -

    Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de configuration

    - {else} +

    Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de + configuration

    + {/if} + {if $nbChamps == 0} +

    Vous devez d'abord sélectionner au moins un champ pour le nom et le prénom dans l'onglet + de configuration

    + {/if} + {if $nbTaux > 0 && $nbChamps > 0} {foreach from=$plugin_config->reduction item="reduc"} {if $reduc->valeur == 1} - - + + {/if} {/foreach} @@ -88,10 +90,13 @@ @@ -161,24 +163,24 @@ {literal} + } + }); + } + {/literal} diff --git a/www/admin/config.php b/www/admin/config.php index ea4b386..ec15380 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -5,8 +5,27 @@ use Garradin\Files\Files; use Garradin\Entities\Files\File; $session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN); -$art_sel=f('articlesCGI') ? : []; +$art_sel = f('articlesCGI') ? : []; $taux_sel = f('tauxReduction') ? : []; +$noms_sel = f('champsNom') ? : []; + +$confNoms = $plugin->getConfig('nomChamps'); +if (! isset($confNoms)) +{ + // récupérer les champs des membres utilisés pour le nom et le prénom + $nomChamps = array(); + foreach ($config->get('champs_membres')->listAssocNames() as $name => $title) + { + if (stristr($title, 'nom')) + { + $champ = new \stdClass(); + $champ->titre = $title; + $champ->position = 0; + $nomChamps[$name] = $champ; + } + } + $plugin->setConfig('nomChamps', $nomChamps); +} $path = qg('path') ?: File::CONTEXT_CONFIG; $context = Files::getContext($path); @@ -63,6 +82,19 @@ if (f('save') && $form->check('recusfiscaux_config')) // ville $plugin->setConfig('ville_asso', trim(f('ville_asso'))); + // champs pour le nom et prénom + $confNoms = (array)$plugin->getConfig('nomChamps'); + foreach ($confNoms as $nom => $champ) + { + $champ->position = 0; + } + $i = -count($noms_sel); + foreach ($noms_sel as $nom) + { + $confNoms[$nom]->position = $i++; + } + $plugin->setConfig('nomChamps', $confNoms); + \Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok'); } catch (UserException $e) @@ -71,9 +103,17 @@ if (f('save') && $form->check('recusfiscaux_config')) } } +// trier les champs de nom pour l'affichage +$nomChamps = (array) $plugin->getConfig('nomChamps'); +uasort($nomChamps, function ($a, $b) +{ + return $a->position - $b->position; +}); + $tpl->assign('ok', qg('ok') !== null); $tpl->assign('path', $path); $tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"); $tpl->assign('plugin_config', $plugin->getConfig()); +$tpl->assign('nomChamps', $nomChamps); $tpl->assign('plugin_css', ['style.css']); $tpl->display(PLUGIN_ROOT . '/templates/config.tpl'); diff --git a/www/admin/index.php b/www/admin/index.php index 48559e8..1dc3f17 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -13,6 +13,7 @@ if ($anneesFiscales[0] < $anneeCourante) { // libellés pour les taux de réduction $_SESSION['ligneReduction'] = Utils::getLignesReduction($plugin->getConfig('reduction')); + // compter le nombre de taux de réduction activés $nbTaux = 0; foreach ($plugin->getConfig('reduction') as $taux) @@ -20,6 +21,16 @@ foreach ($plugin->getConfig('reduction') as $taux) if ($taux->valeur == 1) { ++$nbTaux; } } +// idem avec les champs nom/prénom +$nbChamps = 0; +if (null !== $plugin->getConfig('nomChamps')) +{ + foreach ($plugin->getConfig('nomChamps') as $nom => $champ) + { + if ($champ->position != 0) { ++$nbChamps; } + } +} + // liste des activités, cotisations et comptes associés $activitesTarifsComptes = Utils::getActivitesTarifsEtComptes(); @@ -30,6 +41,7 @@ $tpl->assign('activitesTarifsComptes', $activitesTarifsComptes); $tpl->assign('nbTarifs', count($activitesTarifsComptes)); $tpl->assign('plugin_config', $plugin->getConfig()); $tpl->assign('nbTaux', $nbTaux); +$tpl->assign('nbChamps', $nbChamps); $tpl->assign('plugin_css', ['style.css']); // envoyer au template diff --git a/www/admin/style.css b/www/admin/style.css index 4e37b73..7247f39 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -39,3 +39,8 @@ div.explications ul { list-style : initial; } + +div.actions +{ + display : inline; +} diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index 4f263c1..8828415 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -12,6 +12,19 @@ $_SESSION['annee_recu'] = f('annee_recu'); if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { \Garradin\Utils::redirect(PLUGIN_URL . 'index.php'); } + +// champs pour le nom et prénom +$confNoms = (array) $plugin->getConfig('nomChamps'); +uasort($confNoms, function ($a, $b) +{ + return $a->position - $b->position; +}); +$champsNom = array(); +foreach ($confNoms as $nom => $champ) +{ + if ($champ->position != 0) { $champsNom[] = $nom; } +} + // récupérer les infos du formulaire $tarifsSelectionnes = f('tarifs') ?: []; @@ -39,11 +52,14 @@ foreach (Utils::getActivites($tarifsSelectionnes) as $activite) { $_SESSION['lesActivites'] = $lesActivites; // versements correspondants aux tarifs sélectionnés -$_SESSION['lesVersements'] = Utils::getVersementsTarifs($_SESSION['annee_recu'], $tarifsSelectionnes); +$_SESSION['lesVersements'] = Utils::getVersementsTarifs($_SESSION['annee_recu'], + $tarifsSelectionnes, + $champsNom); // membres donateurs +$versementsMembres = Utils::getDonateurs($_SESSION['annee_recu'], + $champsNom); $membresDonateurs = array(); -$versementsMembres = Utils::getDonateurs($_SESSION['annee_recu']); foreach ($versementsMembres as $versement) { $membresDonateurs[$versement->idUser] = new Personne($versement->idUser, $versement->nom, diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 496a76f..b7ebd0e 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -12,12 +12,27 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { } $_SESSION['taux_reduction'] = $_POST['taux_reduction']; +// champs pour le nom et prénom +$confNoms = (array) $plugin->getConfig('nomChamps'); +uasort($confNoms, function ($a, $b) +{ + return $a->position - $b->position; +}); +$champsNom = array(); +foreach ($confNoms as $nom => $champ) +{ + if ($champ->position != 0) { $champsNom[] = $nom; } +} + // versements totaux par personne -$_SESSION['lesVersementsTotaux'] = Utils::getVersementsTotaux($_SESSION['annee_recu']); +$_SESSION['lesVersementsTotaux'] = + Utils::getVersementsTotaux($_SESSION['annee_recu'], + $champsNom); // membres donateurs +$versementsMembres = Utils::getDonateurs($_SESSION['annee_recu'], + $champsNom); $membresDonateurs = array(); -$versementsMembres = Utils::getDonateurs($_SESSION['annee_recu']); foreach ($versementsMembres as $versement) { $membresDonateurs[$versement->idUser] = new Personne($versement->idUser, $versement->nom, From 9f764057d51baa9b32eed06d71c81880086b5e0d Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 18 Mar 2022 20:23:42 +0000 Subject: [PATCH 016/137] =?UTF-8?q?petite=20am=C3=A9lioration=20cosm=C3=A9?= =?UTF-8?q?tique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 535e828a6476f6a60af202a6aaa07deee78eaf011bc0ae625eda95a4e38fff64 --- lib/Utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Utils.php b/lib/Utils.php index 0df1fb7..f6bed5b 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -145,7 +145,7 @@ class Utils public static function getDonateurs($annee, $champsNom) { // concaténer les champs nom/prénoms pour la sélection - $nom = Utils::combinerChamps($champsNom) . ' as nom,'; + $nom = 'trim(' . Utils::combinerChamps($champsNom) . ') as nom,'; // et pour le tri $tri = Utils::combinerTri($champsNom); $sql = From cfef913a469f26dc31d16aa529ef6ebcbdce5fa1 Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 18 Mar 2022 20:39:29 +0000 Subject: [PATCH 017/137] =?UTF-8?q?mise=20=C3=A0=20jour=20num=C3=A9ro=20ve?= =?UTF-8?q?rsion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 555a015452d49d6335584a42fa1febeb1b0282ec2ba15df8d79c5b354defea30 --- garradin_plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/garradin_plugin.ini b/garradin_plugin.ini index 9b0cdc8..3193717 100644 --- a/garradin_plugin.ini +++ b/garradin_plugin.ini @@ -2,7 +2,7 @@ nom="Reçus fiscaux" description="Génération de reçus fiscaux pour les dons des membres" auteur="jce" url="https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin" -version="0.5" +version="0.6" menu=1 config=1 min_version="1.1" From acc18fc83238082f3297cf2c99ed1af88f2f87bb Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 23 Mar 2022 08:05:43 +0000 Subject: [PATCH 018/137] =?UTF-8?q?corrections=20orthographiques=20et=20co?= =?UTF-8?q?sm=C3=A9tiques=20mineures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: d1a7ae2e8d9d46f8daa45dd88671dbf680db6754ba0d6063245b7efa93f7adcf --- lib/RecusHTML.php | 3 --- templates/config.tpl | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/RecusHTML.php b/lib/RecusHTML.php index ecdac5a..98e6d3e 100644 --- a/lib/RecusHTML.php +++ b/lib/RecusHTML.php @@ -151,8 +151,6 @@ FDD; protected function entete() { -// $styleSheet = \Garradin\PLUGIN_ROOT . "/lib/pdf.css"; -// error_log("pdf.css = " . $styleSheet); ob_start(); echo << @@ -160,7 +158,6 @@ echo << From 944f819fecdf449a2c97724f505b30dc75374e1d Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 23 Mar 2022 10:00:37 +0000 Subject: [PATCH 020/137] remplacement logo CERFA par logo association ; ticket cba1436170 FossilOrigin-Name: 629e57908a411fe551d90efe1eb054ec4357c20d05f325bdc7fa0a0e24858598 --- install.php | 6 ++++ lib/RecusHTML.php | 53 ++++++++++++++++----------------- uninstall.php | 6 ++++ upgrade.php | 18 +++++++++++ www/admin/generer_activites.php | 9 +++++- www/admin/generer_personnes.php | 8 ++++- 6 files changed, 71 insertions(+), 29 deletions(-) create mode 100644 upgrade.php diff --git a/install.php b/install.php index 1117fa6..a5bedd9 100644 --- a/install.php +++ b/install.php @@ -8,3 +8,9 @@ $default_signature_file = (new File)->createAndStore('skel/plugin/recusfiscaux', 'default_signature.png', $path, null); +// « logo » par défaut +$path = __DIR__ . '/data/default_logo.png'; +$default_logo_file = (new File)->createAndStore('skel/plugin/recusfiscaux', + 'default_logo.png', + $path, + null); diff --git a/lib/RecusHTML.php b/lib/RecusHTML.php index 9709d64..eb5eaf2 100644 --- a/lib/RecusHTML.php +++ b/lib/RecusHTML.php @@ -8,6 +8,7 @@ class RecusHTML { private $nomAsso; private $adresseAsso; + private $logoAsso; private $objetAsso; private $nomResponsable; private $fonctionResponsable; @@ -20,6 +21,7 @@ class RecusHTML */ function __construct($nomAsso, $adresseAsso, + $logoAsso, $objetAsso, $nomResponsable, $fonctionResponsable, @@ -29,6 +31,7 @@ class RecusHTML { $this->nomAsso = $nomAsso; $this->adresseAsso = $adresseAsso; + $this->logoAsso = $logoAsso; $this->objetAsso = $objetAsso; $this->nomResponsable = $nomResponsable; $this->fonctionResponsable = $fonctionResponsable; @@ -174,47 +177,48 @@ echo <<
    -
    - Cerfa -
    -
    - N° 11580*4 -
    +

    Reçu au titre des dons à certains organismes d'intérêt général

    Articles 200, 238 bis et 978 du code général des impôts

    diff --git a/uninstall.php b/uninstall.php index 86e35bf..84fda2a 100644 --- a/uninstall.php +++ b/uninstall.php @@ -10,6 +10,12 @@ if (null !== $default_signature_file) { $default_signature_file->delete(); } +// logo par défaut +$default_logo_file = \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); +if (null !== $default_logo_file) { + $default_logo_file->delete(); +} + // signature réelle $signature = $plugin->getConfig('signature'); if (null !== $signature) { diff --git a/upgrade.php b/upgrade.php new file mode 100644 index 0000000..cece83e --- /dev/null +++ b/upgrade.php @@ -0,0 +1,18 @@ +getInfos('version'); + +if (version_compare($old_version, '0.6.0', '<')) +{ + $path = __DIR__ . '/data/default_logo.png'; + $default_logo_file = (new File)->createAndStore('skel/plugin/recusfiscaux', + 'default_logo.png', + $path, + null); +} diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index 043dd81..0c3853d 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -17,7 +17,7 @@ foreach ($lesLignes as $ligne) { // cumuler les versements d'une personne $totalPersonnes = cumulerVersements($versementsSelectionnes); -// générer les reçus +// informations pour les reçus $nomAsso = Utils::getNomAsso(); $adresseAsso = Utils::getAdresseAsso(); $signature = @@ -25,6 +25,12 @@ $signature = \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : ""; +// logo +$logoAsso = + (null !== $config->fileURL('logo')) ? + $config->fileURL('logo') : + \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); + // articles du CGI $articlesCGI = array(); foreach ($plugin->getConfig('articlesCGI') as $article) @@ -40,6 +46,7 @@ foreach ($totalPersonnes as $idPersonne => $personne) $html = new RecusHTML( $nomAsso, $adresseAsso, + $logoAsso, $plugin->getConfig('objet_asso'), $plugin->getConfig('nom_responsable'), $plugin->getConfig('fonction_responsable'), diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index 763cd60..af9daa3 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -15,13 +15,18 @@ foreach ($lesLignes as $ligne) { $versementsSelectionnes[] = $_SESSION['lesVersementsTotaux'][$ligne]; } -// générer les reçus +// informations pour les reçus $nomAsso = Utils::getNomAsso(); $adresseAsso = Utils::getAdresseAsso(); $signature = (null !== $plugin->getConfig('signature')) ? \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : ""; +// logo +$logoAsso = + (null !== $config->fileURL('logo')) ? + $config->fileURL('logo') : + \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); // articles du CGI $articlesCGI = array(); @@ -38,6 +43,7 @@ foreach ($versementsSelectionnes as $ligne) $html = new RecusHTML( $nomAsso, $adresseAsso, + $logoAsso, $plugin->getConfig('objet_asso'), $plugin->getConfig('nom_responsable'), $plugin->getConfig('fonction_responsable'), From bc21f2733e5d96abbc584cef88a8079db89a6ec6 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 23 Mar 2022 10:29:11 +0000 Subject: [PATCH 021/137] =?UTF-8?q?mise=20=C3=A0=20jour=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 2605c908d15054133549cadad542c29b7f6e625f1c9f5c355dbd638902934f47 --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index bc42852..6818957 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,6 @@ Vous pouvez télécharger [l'archive .tar.gz](https://git.roflcopter.fr/lesanges - nom - fonction - signature (image) +- autres + - ville (précède la date sur le formulaire) + - champs pour le nom et prénom (le libellé doit contenir le terme 'nom', casse indifférente) From cd545d60c78fd3c81ecf473b9dcb9c8fac4df5b2 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 24 Mar 2022 10:20:58 +0000 Subject: [PATCH 022/137] correction mineure script.js FossilOrigin-Name: 177672cde1bca47812287731c1072a207b5be70b8cf882cf1d57329097c7e33d --- www/admin/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/admin/script.js b/www/admin/script.js index 04b177e..4ae7ec9 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -25,7 +25,7 @@ function cocherDecocherTout(idCaseGlobale) } // changer le message var message = idCaseGlobale.nextElementSibling; - if (idCase.checked) { + if (idCaseGlobale.checked) { message.innerHTML = "Cliquer pour dé-cocher toutes les lignes"; } else { message.innerHTML = "Cliquer pour cocher toutes les lignes"; From 2e8eb26e5a56c51478268de661902bdd21307c9d Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 24 Mar 2022 17:58:36 +0000 Subject: [PATCH 023/137] simplification gestion logo FossilOrigin-Name: 91a2a75c24b4c340d69c6c80c9779b8e1454a8708181c92db13115a843e06281 --- install.php | 6 ------ uninstall.php | 6 ------ upgrade.php | 5 ----- 3 files changed, 17 deletions(-) diff --git a/install.php b/install.php index a5bedd9..1117fa6 100644 --- a/install.php +++ b/install.php @@ -8,9 +8,3 @@ $default_signature_file = (new File)->createAndStore('skel/plugin/recusfiscaux', 'default_signature.png', $path, null); -// « logo » par défaut -$path = __DIR__ . '/data/default_logo.png'; -$default_logo_file = (new File)->createAndStore('skel/plugin/recusfiscaux', - 'default_logo.png', - $path, - null); diff --git a/uninstall.php b/uninstall.php index 84fda2a..86e35bf 100644 --- a/uninstall.php +++ b/uninstall.php @@ -10,12 +10,6 @@ if (null !== $default_signature_file) { $default_signature_file->delete(); } -// logo par défaut -$default_logo_file = \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); -if (null !== $default_logo_file) { - $default_logo_file->delete(); -} - // signature réelle $signature = $plugin->getConfig('signature'); if (null !== $signature) { diff --git a/upgrade.php b/upgrade.php index cece83e..a0a8751 100644 --- a/upgrade.php +++ b/upgrade.php @@ -10,9 +10,4 @@ $old_version = $plugin->getInfos('version'); if (version_compare($old_version, '0.6.0', '<')) { - $path = __DIR__ . '/data/default_logo.png'; - $default_logo_file = (new File)->createAndStore('skel/plugin/recusfiscaux', - 'default_logo.png', - $path, - null); } From af7816d97fff220a66e2082a7f11997ea27bafeb Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 24 Mar 2022 18:00:39 +0000 Subject: [PATCH 024/137] =?UTF-8?q?d=C3=A9but=20refonte=20gestion=20versem?= =?UTF-8?q?ents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 1be54b8a985d3fb24895bae4cc5481743edf0a68dbb0eb4278580df3ce7f530d --- lib/Personne.php | 2 +- lib/Utils.php | 67 +++++++++++++++++++++++ templates/_nav.tpl | 2 +- templates/versements_personnes.tpl | 67 ++++++++++------------- www/admin/config.php | 5 +- www/admin/generer_activites.php | 62 ++++++++++++--------- www/admin/generer_personnes.php | 88 ++++++++++++++++++++++++++---- www/admin/script.js | 67 +++++++++++++++-------- www/admin/style.css | 4 ++ www/admin/versements_activites.php | 4 +- www/admin/versements_personnes.php | 66 ++++++++++++++++++++-- 11 files changed, 322 insertions(+), 112 deletions(-) diff --git a/lib/Personne.php b/lib/Personne.php index 118aca1..2f695f6 100644 --- a/lib/Personne.php +++ b/lib/Personne.php @@ -35,7 +35,6 @@ class Personne /** * return copie d'une personne - */ public function clone() { return new Personne( @@ -46,6 +45,7 @@ class Personne $this->ville, $this->courriel); } + */ /** * ajouter un versement diff --git a/lib/Utils.php b/lib/Utils.php index f6bed5b..e29e92a 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -39,6 +39,37 @@ class Utils return $db->get($sql); } + /** + * @return versements correspondants à l'année donnée + * @param $annee + * @param array $champsNom : liste non vide des champs de nom/prénom + */ + public static function getVersementsPersonnes($annee, $champsNom) + { + $db = DB::getInstance(); + $tri = Utils::combinerTri($champsNom); + $sql = sprintf( + 'SELECT + membres.id as idUser, + acc_transactions_lines.credit as versement, + acc_transactions.date + FROM acc_transactions_users + INNER JOIN membres on acc_transactions_users.id_user = membres.id + INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id + INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id + INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id + WHERE + (strftime(%s, acc_transactions.date) = "%d" + AND + acc_transactions_lines.credit > 0) + ORDER by %s, acc_transactions.date', + '"%Y"', + $annee, + $tri + ); + return $db->get($sql); + } + /** * @return versements correspondants à l'année et aux tarifs donnés * @param $annee @@ -76,6 +107,42 @@ class Utils return $db->get($sql); } + /** + * @return versements correspondants à l'année et aux comptes donnés + * @param $annee + * @param array $comptes + * @param array $champsNom : liste non vide des champs de nom/prénom + */ + public static function getVersementsComptes($annee, $comptes, $champsNom) + { + $db = DB::getInstance(); + $tri = Utils::combinerTri($champsNom); + $sql = sprintf( + 'SELECT + acc_accounts.code as compte, + membres.id as idUser, + acc_transactions_lines.credit as versement, + acc_transactions.date + FROM acc_transactions_users + INNER JOIN membres on acc_transactions_users.id_user = membres.id + INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id + INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id + INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id + WHERE + (strftime(%s, acc_transactions.date) = "%d" + AND + acc_accounts.%s + AND + acc_transactions_lines.credit > 0) + ORDER by acc_accounts.code, %s, acc_transactions.date', + '"%Y"', + $annee, + $db->where('code', $comptes), + $tri + ); + return $db->get($sql); + } + /** * Versements totaux par personne pour une année donnée * @param année diff --git a/templates/_nav.tpl b/templates/_nav.tpl index 6ab82c4..140e031 100644 --- a/templates/_nav.tpl +++ b/templates/_nav.tpl @@ -5,7 +5,7 @@
    + idUser; + ?> + {afficher_debut_personne versement=$versement} + {afficher_versement versement=$versement rang=$i} + {else} + {* même personne *} + {afficher_versement versement=$versement rang=$i} + {/if} + {/foreach} {* Itération sur les personnes *} + @@ -48,4 +41,4 @@ -{include file="admin/_foot.tpl"} \ No newline at end of file +{include file="admin/_foot.tpl"} diff --git a/www/admin/config.php b/www/admin/config.php index ec15380..64c0506 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -27,10 +27,6 @@ if (! isset($confNoms)) $plugin->setConfig('nomChamps', $nomChamps); } -$path = qg('path') ?: File::CONTEXT_CONFIG; -$context = Files::getContext($path); -$context_ref = Files::getContextRef($path); - if (f('save') && $form->check('recusfiscaux_config')) { try { @@ -111,6 +107,7 @@ uasort($nomChamps, function ($a, $b) }); $tpl->assign('ok', qg('ok') !== null); +$path = qg('path') ?: File::CONTEXT_CONFIG; $tpl->assign('path', $path); $tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"); $tpl->assign('plugin_config', $plugin->getConfig()); diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index 0c3853d..d298eae 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -2,6 +2,9 @@ namespace Garradin; +use Garradin\Files\Files; +use Garradin\Entities\Files\File; + use Garradin\Plugin\RecusFiscaux\RecusHTML; use Garradin\Plugin\RecusFiscaux\Utils; use Garradin\Plugin\RecusFiscaux\Personne; @@ -14,22 +17,28 @@ $versementsSelectionnes = array(); foreach ($lesLignes as $ligne) { $versementsSelectionnes[] = $_SESSION['lesVersements'][$ligne]; } -// cumuler les versements d'une personne + +// cumuler les versements d'une personne : id => Personne $totalPersonnes = cumulerVersements($versementsSelectionnes); // informations pour les reçus -$nomAsso = Utils::getNomAsso(); -$adresseAsso = Utils::getAdresseAsso(); +$nomAsso = $config->get('nom_asso'); +$adresseAsso = $config->get('adresse_asso'); $signature = - (null !== $plugin->getConfig('signature')) ? - \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : + (null !== $plugin->getConfig('signature')) + ? + \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() + : ""; // logo +$logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); $logoAsso = - (null !== $config->fileURL('logo')) ? - $config->fileURL('logo') : - \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); + (null !== $logo_file) + ? + Files::get($logo_file->path)->fullpath() + : + ""; // articles du CGI $articlesCGI = array(); @@ -39,6 +48,7 @@ foreach ($plugin->getConfig('articlesCGI') as $article) $articlesCGI[] = $article->titre; } } + $listeFichiers = array(); // fichiers pdf générés foreach ($totalPersonnes as $idPersonne => $personne) { @@ -100,31 +110,32 @@ $fichierZip = Utils::makeArchive( function cumulerVersements($versements) { $totalPersonnes = array(); - $idTarif_courant = -1; - $idPersonne_courant = -1; + $idTarifCourant = -1; + $idPersonneCourant = -1; $totalVersements = 0; foreach ($versements as $ligne) { if ( - $ligne->idTarif != $idTarif_courant || - $ligne->idUser != $idPersonne_courant + $ligne->idTarif != $idTarifCourant || + $ligne->idUser != $idPersonneCourant ) { - if ($idTarif_courant != -1) { - $totalPersonnes[$idPersonne_courant]->ajouterVersement( - $_SESSION['lesTarifs'][$idTarif_courant]->idActivite, - $idTarif_courant, + if ($idTarifCourant != -1) { + $totalPersonnes[$idPersonneCourant]->ajouterVersement( + $_SESSION['lesTarifs'][$idTarifCourant]->idActivite, + $idTarifCourant, $totalVersements/100, - $_SESSION['tauxSelectionnes'][$idTarif_courant] + $_SESSION['tauxSelectionnes'][$idTarifCourant] ); } - $idTarif_courant = $ligne->idTarif; - $idPersonne_courant = $ligne->idUser; + $idTarifCourant = $ligne->idTarif; + $idPersonneCourant = $ligne->idUser; $totalVersements = $ligne->versement; // créer les infos de la personne, sauf si elle est déjà présente - if (!array_key_exists($idPersonne_courant, $totalPersonnes)) + if (!array_key_exists($idPersonneCourant, $totalPersonnes)) { - $totalPersonnes["$idPersonne_courant"] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); + // $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); + $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]; } } else { // cumuler versements @@ -132,12 +143,11 @@ function cumulerVersements($versements) } } // et le dernier - $totalPersonnes[$idPersonne_courant]->ajouterVersement( - $_SESSION['lesTarifs'][$idTarif_courant]->idActivite, - $idTarif_courant, + $totalPersonnes[$idPersonneCourant]->ajouterVersement( + $_SESSION['lesTarifs'][$idTarifCourant]->idActivite, + $idTarifCourant, $totalVersements/100, - $_SESSION['tauxSelectionnes'][$idTarif_courant] + $_SESSION['tauxSelectionnes'][$idTarifCourant] ); - return $totalPersonnes; } diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index af9daa3..a5ad25a 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -2,6 +2,9 @@ namespace Garradin; +use Garradin\Files\Files; +use Garradin\Entities\Files\File; + use Garradin\Plugin\RecusFiscaux\RecusHTML; use Garradin\Plugin\RecusFiscaux\Utils; use Garradin\Plugin\RecusFiscaux\Personne; @@ -12,21 +15,29 @@ $lesLignes = f('selected'); // filtrer les versements sélectionnés $versementsSelectionnes = array(); foreach ($lesLignes as $ligne) { - $versementsSelectionnes[] = $_SESSION['lesVersementsTotaux'][$ligne]; + $versementsSelectionnes[] = $_SESSION['lesVersements'][$ligne]; } +// cumuler les versements d'une personne : id => Personne +$totalPersonnes = cumulerVersements($versementsSelectionnes); + // informations pour les reçus -$nomAsso = Utils::getNomAsso(); -$adresseAsso = Utils::getAdresseAsso(); +$nomAsso = $config->get('nom_asso'); +$adresseAsso = $config->get('adresse_asso'); $signature = - (null !== $plugin->getConfig('signature')) ? - \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : + (null !== $plugin->getConfig('signature')) + ? + Files::get($plugin->getConfig('signature'))->fullpath() + : ""; // logo +$logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); $logoAsso = - (null !== $config->fileURL('logo')) ? - $config->fileURL('logo') : - \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); + (null !== $logo_file) + ? + Files::get($logo_file->path)->fullpath() + : + ""; // articles du CGI $articlesCGI = array(); @@ -36,8 +47,9 @@ foreach ($plugin->getConfig('articlesCGI') as $article) $articlesCGI[] = $article->titre; } } + $listeFichiers = array(); // fichiers pdf générés -foreach ($versementsSelectionnes as $ligne) +foreach ($totalPersonnes as $idPersonne => $personne) { // générer un fichier par reçu $html = new RecusHTML( @@ -53,8 +65,16 @@ foreach ($versementsSelectionnes as $ligne) ); // extraire les montants des versements - $lesMontants[$_SESSION['taux_reduction']] = $ligne->versement/100; - $personne = $_SESSION['membresDonateurs'][$ligne->idUser]; + $lesMontants = array(); + foreach ($personne->versements as $versement) + { + if (array_key_exists($versement->tauxReduction, $lesMontants)) { + $lesMontants[$versement->tauxReduction] += $versement->montant; + } + else { + $lesMontants[$versement->tauxReduction] = $versement->montant; + } + } $html->imprimer_recu( $_SESSION['annee_recu'], $personne->id, @@ -81,3 +101,49 @@ $fichierZip = Utils::makeArchive( $_SESSION['annee_recu'], PLUGIN_ROOT . "/zip" ); + +/** + * Cumuler les versements de chaque personne + * @param tableau des versements triés par idUser, date + * @return tableau des versements cumulés : id => Personne + */ +function cumulerVersements($versements) +{ + $totalPersonnes = array(); + $idPersonneCourant = -1; + $totalVersements = 0; + foreach ($versements as $ligne) + { + if ($ligne->idUser != $idPersonneCourant) + { + // changement de personne + if ($idPersonneCourant != -1) + { + $totalPersonnes[$idPersonneCourant]->ajouterVersement( + 0, + 0, + $totalVersements/100, + $_SESSION['taux_reduction'] + ); + } + $idPersonneCourant = $ligne->idUser; + $totalVersements = $ligne->versement; + // créer les infos de la personne, sauf si elle est déjà présente + if (!array_key_exists($idPersonneCourant, $totalPersonnes)) + { + $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]; + } + } else { + // cumuler versements + $totalVersements += $ligne->versement; + } + } + // et le dernier + $totalPersonnes[$idPersonneCourant]->ajouterVersement( + 0, + 0, + $totalVersements/100, + $_SESSION['taux_reduction'] + ); + return $totalPersonnes; +} diff --git a/www/admin/script.js b/www/admin/script.js index 04b177e..3f5b501 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -9,31 +9,43 @@ function cocherDecocherTout(idCaseGlobale) var formulaire = idCaseGlobale.closest("form"); // itérer sur la liste des éléments détails : 1 par couple var lesDetails = formulaire.querySelectorAll("details"); - for (var i = 0; i < lesDetails.length; ++i) { + for (var i = 0; i < lesDetails.length; ++i) + { // itérer sur les personnes var lesH3 = lesDetails[i].querySelectorAll("h3.personne"); - for (var j = 0; j < lesH3.length; ++j) { - // trouver l'élément total de la personne - var idTotal = lesH3[j].querySelector("span"); - // puis la case à cocher - var fieldset = lesH3[j].nextElementSibling; - var idCase = fieldset.querySelector("input"); - idCase.checked = idCaseGlobale.checked; - // puis traiter toutes les cases de la personne - cocherDecocherPersonne(idCase, idTotal); - } + cocherDecocherLesPersonnes(idCaseGlobale, lesH3); } // changer le message - var message = idCaseGlobale.nextElementSibling; - if (idCase.checked) { - message.innerHTML = "Cliquer pour dé-cocher toutes les lignes"; - } else { - message.innerHTML = "Cliquer pour cocher toutes les lignes"; + changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); +} + +/** + * idem dans le cas des versements des personnes +*/ +function cocherDecocherToutesLesPersonnes(formulaire, idCaseGlobale) +{ + var lesH3 = formulaire.querySelectorAll("h3.personne"); + cocherDecocherLesPersonnes(idCaseGlobale, lesH3); + changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); +} + +function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) +{ + for (var j = 0; j < lesPersonnes.length; ++j) + { + // trouver l'élément total de la personne + var idTotal = lesPersonnes[j].querySelector("span"); + // puis la case à cocher + var fieldset = lesPersonnes[j].nextElementSibling; + var idCase = fieldset.querySelector("input"); + idCase.checked = idCaseGlobale.checked; + // puis traiter toutes les cases de la personne + cocherDecocherPersonne(idCase, idTotal); } } /** - * Fonction appelée quand on (dé)coche la case d'une personne + * Fonction appelée quand on (dé)coche la case globale d'une personne * - (dé)sélectionner toutes les cases à cocher * - faire le total des cases cochées et l'afficher * @@ -49,16 +61,11 @@ function cocherDecocherPersonne(idCase, idTotal) { listeCases[i].checked = idCase.checked; } - // changer le message - var message = idCase.nextElementSibling; - if (idCase.checked) { - message.innerHTML = "Cliquer pour dé-cocher toutes les lignes"; - } else { - message.innerHTML = "Cliquer pour cocher toutes les lignes"; - } // calculer et afficher le total var listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); + // changer le message + changerMessage(idCase.nextElementSibling, idCase); } /** @@ -98,6 +105,18 @@ function calculerTotal(listeCases, listeMontants, idTotal) minimumFractionDigits: 2}); } +/** + * changer le message en fonction de l'état coché de la case +*/ +function changerMessage(message, idCase) +{ + if (idCase.checked) { + message.innerHTML = "Cliquer pour dé-cocher toutes les lignes"; + } else { + message.innerHTML = "Cliquer pour cocher toutes les lignes"; + } +} + /** * fonction appelée lors de la validation du formulaire * @return vrai si au moins un choix a été fait diff --git a/www/admin/style.css b/www/admin/style.css index 7247f39..938186b 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -18,6 +18,10 @@ div span { td.montant { text-align : right; } +span.montant { + width : 5em; + text-align : right; +} summary.activite { background: rgba(var(--gMainColor), 0.25); } diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index 8828415..a618731 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -107,7 +107,7 @@ $tpl->register_function('afficher_debut_personne', function ($params) $versement = $params['versement']; $idUser = $versement->idUser; $personne = $_SESSION['membresDonateurs'][$idUser]; - $idVersement = $versement->idTarif . "_" . $versement->idUser; + $idVersement = $versement->idTarif . "_" . $versement->idUser; $out = sprintf('

    Versements de %s : 0,00 €

    ', $personne->nomPrenom, $idVersement); @@ -134,7 +134,7 @@ $tpl->register_function('afficher_versement', function ($params) { $versement = $params['versement']; $rang = $params['rang']; - $idVersement = $versement->idTarif . "_" . $versement->idUser; + $idVersement = $versement->idTarif . "_" . $versement->idUser; $out = '
    ' : 'impair">'; $out .= sprintf(' diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index b7ebd0e..5d6df3b 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -24,10 +24,9 @@ foreach ($confNoms as $nom => $champ) if ($champ->position != 0) { $champsNom[] = $nom; } } -// versements totaux par personne -$_SESSION['lesVersementsTotaux'] = - Utils::getVersementsTotaux($_SESSION['annee_recu'], - $champsNom); +// versements par personne +$_SESSION['lesVersements'] = Utils::getVersementsPersonnes($_SESSION['annee_recu'], + $champsNom); // membres donateurs $versementsMembres = Utils::getDonateurs($_SESSION['annee_recu'], @@ -42,9 +41,64 @@ foreach ($versementsMembres as $versement) { } $_SESSION['membresDonateurs'] = $membresDonateurs; +// ------------------------------------------------------------------------ +// fonctions pour l'affichage + +// afficher les informations d'une personne +$tpl->register_function('afficher_debut_personne', function ($params) +{ + $versement = $params['versement']; + $idUser = $versement->idUser; + $personne = $_SESSION['membresDonateurs'][$idUser]; + $idVersement = $versement->idUser; + $out = sprintf('

    Versements de %s : 0,00 €

    ', + $personne->nomPrenom, + $idVersement); + $out .= sprintf(' +
    ', + $idVersement); + $out .= sprintf(' + ', + $idVersement, + $idVersement); + $out .= sprintf(' + ', + $idVersement); + $out .= '
    +
    '; + return $out; +}); + +// afficher un versement +$tpl->register_function('afficher_versement', function ($params) +{ + $versement = $params['versement']; + $rang = $params['rang']; + $idVersement = $versement->idUser; + $out = '
    ' : 'impair">'; + $out .= sprintf(' + + + %.2f + %s +
    ', + $idVersement, $idVersement, + $rang, $rang, + $idVersement, $rang, $idVersement, $idVersement, $rang, + $versement->versement/100, + date_format(date_create($versement->date),"d/m/Y")); + return $out; +}); +// ------------------------------------------------------------------------ + // préparation de l'affichage -$tpl->assign('lesVersementsTotaux', $_SESSION['lesVersementsTotaux']); -$tpl->assign('lesDonateurs', $membresDonateurs); +$tpl->assign('lesVersements', $_SESSION['lesVersements']); $tpl->assign('plugin_css', ['style.css']); // envoyer au template From d132832c774dd03b5c10ee94c8e3eb126b849e02 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 24 Mar 2022 18:01:32 +0000 Subject: [PATCH 025/137] =?UTF-8?q?petite=20am=C3=A9lioration=20cosm=C3=A9?= =?UTF-8?q?tique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 29abdc0d7b28a1579d9a621b986b2926e704b1ef2e444f876f75966c957885dc --- www/admin/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/admin/style.css b/www/admin/style.css index 7247f39..938186b 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -18,6 +18,10 @@ div span { td.montant { text-align : right; } +span.montant { + width : 5em; + text-align : right; +} summary.activite { background: rgba(var(--gMainColor), 0.25); } From 7d4d305cfa60d0a0f9e42b6e49cff1d0d31f8a4d Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 25 Mar 2022 08:02:00 +0000 Subject: [PATCH 026/137] simplification gestion logo FossilOrigin-Name: b87bde43d3a8108761b33901f1555143153c30819b16f5ddf5120f9e968da491 --- install.php | 6 ------ uninstall.php | 6 ------ upgrade.php | 5 ----- www/admin/config.php | 5 +---- www/admin/generer_activites.php | 16 ++++++++++------ www/admin/generer_personnes.php | 22 +++++++++++++++------- 6 files changed, 26 insertions(+), 34 deletions(-) diff --git a/install.php b/install.php index a5bedd9..1117fa6 100644 --- a/install.php +++ b/install.php @@ -8,9 +8,3 @@ $default_signature_file = (new File)->createAndStore('skel/plugin/recusfiscaux', 'default_signature.png', $path, null); -// « logo » par défaut -$path = __DIR__ . '/data/default_logo.png'; -$default_logo_file = (new File)->createAndStore('skel/plugin/recusfiscaux', - 'default_logo.png', - $path, - null); diff --git a/uninstall.php b/uninstall.php index 84fda2a..86e35bf 100644 --- a/uninstall.php +++ b/uninstall.php @@ -10,12 +10,6 @@ if (null !== $default_signature_file) { $default_signature_file->delete(); } -// logo par défaut -$default_logo_file = \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); -if (null !== $default_logo_file) { - $default_logo_file->delete(); -} - // signature réelle $signature = $plugin->getConfig('signature'); if (null !== $signature) { diff --git a/upgrade.php b/upgrade.php index cece83e..a0a8751 100644 --- a/upgrade.php +++ b/upgrade.php @@ -10,9 +10,4 @@ $old_version = $plugin->getInfos('version'); if (version_compare($old_version, '0.6.0', '<')) { - $path = __DIR__ . '/data/default_logo.png'; - $default_logo_file = (new File)->createAndStore('skel/plugin/recusfiscaux', - 'default_logo.png', - $path, - null); } diff --git a/www/admin/config.php b/www/admin/config.php index ec15380..64c0506 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -27,10 +27,6 @@ if (! isset($confNoms)) $plugin->setConfig('nomChamps', $nomChamps); } -$path = qg('path') ?: File::CONTEXT_CONFIG; -$context = Files::getContext($path); -$context_ref = Files::getContextRef($path); - if (f('save') && $form->check('recusfiscaux_config')) { try { @@ -111,6 +107,7 @@ uasort($nomChamps, function ($a, $b) }); $tpl->assign('ok', qg('ok') !== null); +$path = qg('path') ?: File::CONTEXT_CONFIG; $tpl->assign('path', $path); $tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"); $tpl->assign('plugin_config', $plugin->getConfig()); diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index 0c3853d..8420719 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -2,6 +2,9 @@ namespace Garradin; +use Garradin\Files\Files; +use Garradin\Entities\Files\File; + use Garradin\Plugin\RecusFiscaux\RecusHTML; use Garradin\Plugin\RecusFiscaux\Utils; use Garradin\Plugin\RecusFiscaux\Personne; @@ -18,18 +21,19 @@ foreach ($lesLignes as $ligne) { $totalPersonnes = cumulerVersements($versementsSelectionnes); // informations pour les reçus -$nomAsso = Utils::getNomAsso(); -$adresseAsso = Utils::getAdresseAsso(); +$nomAsso = $config->get('nom_asso'); +$adresseAsso = $config->get('adresse_asso'); $signature = (null !== $plugin->getConfig('signature')) ? - \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : + Files::get($plugin->getConfig('signature'))->fullpath() : ""; // logo +$logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); $logoAsso = - (null !== $config->fileURL('logo')) ? - $config->fileURL('logo') : - \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); + (null !== $logo_file) ? + Files::get($logo_file->path)->fullpath() : + ""; // articles du CGI $articlesCGI = array(); diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index af9daa3..bd0a99c 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -2,6 +2,9 @@ namespace Garradin; +use Garradin\Files\Files; +use Garradin\Entities\Files\File; + use Garradin\Plugin\RecusFiscaux\RecusHTML; use Garradin\Plugin\RecusFiscaux\Utils; use Garradin\Plugin\RecusFiscaux\Personne; @@ -16,17 +19,22 @@ foreach ($lesLignes as $ligne) { } // informations pour les reçus -$nomAsso = Utils::getNomAsso(); -$adresseAsso = Utils::getAdresseAsso(); +$nomAsso = $config->get('nom_asso'); +$adresseAsso = $config->get('adresse_asso'); $signature = - (null !== $plugin->getConfig('signature')) ? - \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() : + (null !== $plugin->getConfig('signature')) + ? + Files::get($plugin->getConfig('signature'))->fullpath() + : ""; // logo +$logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); $logoAsso = - (null !== $config->fileURL('logo')) ? - $config->fileURL('logo') : - \Garradin\Files\Files::get('skel/plugin/recusfiscaux/default_logo.png'); + (null !== $logo_file) + ? + Files::get($logo_file->path)->fullpath() + : + ""; // articles du CGI $articlesCGI = array(); From 356ad4b6c872e12d004c667f6f09f55b4a0a118d Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 25 Mar 2022 09:08:46 +0000 Subject: [PATCH 027/137] suppression fonctions inutiles et simplification FossilOrigin-Name: 7c7598c1fc713bdd0a5dfdf5d8e68372a97a22f4c5f535eff57ba02bfee3ca4b --- lib/Utils.php | 22 ---------------------- www/admin/generer_activites.php | 12 ++++-------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/lib/Utils.php b/lib/Utils.php index e29e92a..b973f9e 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -286,28 +286,6 @@ class Utils ); } - /** - * @return nom de l'association - */ - public static function getNomAsso() { - return DB::getInstance()->first( - "SELECT value - FROM config - WHERE key = 'nom_asso'" - )->value; - } - - /** - * @return adresse de l'association - */ - public static function getAdresseAsso() { - return DB::getInstance()->first( - "SELECT value - FROM config - WHERE key = 'adresse_asso'" - )->value; - } - /** * @return liste des années fiscales */ diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index d298eae..566a82d 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -25,19 +25,15 @@ $totalPersonnes = cumulerVersements($versementsSelectionnes); $nomAsso = $config->get('nom_asso'); $adresseAsso = $config->get('adresse_asso'); $signature = - (null !== $plugin->getConfig('signature')) - ? - \Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() - : + (null !== $plugin->getConfig('signature')) ? + Files::get($plugin->getConfig('signature'))->fullpath() : ""; // logo $logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); $logoAsso = - (null !== $logo_file) - ? - Files::get($logo_file->path)->fullpath() - : + (null !== $logo_file) ? + Files::get($logo_file->path)->fullpath() : ""; // articles du CGI From 83cc830fb1c95fc9cdccd8b6a370dd1a81a07652 Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 25 Mar 2022 10:27:03 +0000 Subject: [PATCH 028/137] =?UTF-8?q?r=C3=A9tablissement=20clonage=20pour=20?= =?UTF-8?q?r=C3=A9gler=20probl=C3=A8me=20accumulation=20montants=20verseme?= =?UTF-8?q?nts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 782e9e0f8724a42731d25d263730cf203398d4d4e4add5131dcf581d09a06afb --- lib/Personne.php | 2 +- www/admin/generer_activites.php | 4 ++-- www/admin/generer_personnes.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Personne.php b/lib/Personne.php index 2f695f6..118aca1 100644 --- a/lib/Personne.php +++ b/lib/Personne.php @@ -35,6 +35,7 @@ class Personne /** * return copie d'une personne + */ public function clone() { return new Personne( @@ -45,7 +46,6 @@ class Personne $this->ville, $this->courriel); } - */ /** * ajouter un versement diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index 566a82d..f73abf8 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -20,6 +20,7 @@ foreach ($lesLignes as $ligne) { // cumuler les versements d'une personne : id => Personne $totalPersonnes = cumulerVersements($versementsSelectionnes); +error_log("totalPersonnes = " . print_r($totalPersonnes, true)); // informations pour les reçus $nomAsso = $config->get('nom_asso'); @@ -130,8 +131,7 @@ function cumulerVersements($versements) // créer les infos de la personne, sauf si elle est déjà présente if (!array_key_exists($idPersonneCourant, $totalPersonnes)) { - // $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); - $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]; + $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); } } else { // cumuler versements diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index a5ad25a..b638c8b 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -131,7 +131,7 @@ function cumulerVersements($versements) // créer les infos de la personne, sauf si elle est déjà présente if (!array_key_exists($idPersonneCourant, $totalPersonnes)) { - $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]; + $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); } } else { // cumuler versements From b1645828fc75dc111df0bc768adb8057e67d1843 Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 25 Mar 2022 15:09:55 +0000 Subject: [PATCH 029/137] simplification cumul versements FossilOrigin-Name: e4a942b3cc6913da11da2dfd480b2f71703c1781911e8d7c5e0a57c1b170bfd8 --- lib/Personne.php | 29 +++++++++++++---------------- lib/Utils.php | 14 ++++++++++++-- www/admin/generer_activites.php | 30 +++++++++--------------------- www/admin/generer_personnes.php | 25 +++++-------------------- www/admin/versements_activites.php | 18 ++++-------------- www/admin/versements_personnes.php | 12 +----------- 6 files changed, 44 insertions(+), 84 deletions(-) diff --git a/lib/Personne.php b/lib/Personne.php index 118aca1..9a10979 100644 --- a/lib/Personne.php +++ b/lib/Personne.php @@ -13,7 +13,7 @@ class Personne public $codePostal; public $ville; public $courriel; - public $versements; // tableau des versements totaux par activité/tarif + public $versements; // versements par taux de réduction public function __construct( $id, @@ -30,7 +30,7 @@ class Personne $this->codePostal = $codePostal; $this->ville = $ville; $this->courriel = $courriel; - $this->versements = array(); + $this->versements = array(); // clé = tarif, valeur = montant } /** @@ -49,24 +49,21 @@ class Personne /** * ajouter un versement - * @param $idActivite - * @param $idTarif - * @param $montant * @param $tauxReduction + * @param $montant */ public function ajouterVersement( - $idActivite, - $idTarif, - $montant, - $tauxReduction + $tauxReduction, + $montant ) { - $this->versements[] = - new Versement( - $idActivite, - $idTarif, - $montant, - $tauxReduction - ); + if (array_key_exists($tauxReduction, $this->versements)) + { + $this->versements[$tauxReduction] += $montant; + } + else + { + $this->versements[$tauxReduction] = $montant; + } } } diff --git a/lib/Utils.php b/lib/Utils.php index b973f9e..c9f6121 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -72,6 +72,7 @@ class Utils /** * @return versements correspondants à l'année et aux tarifs donnés + * triés par tarif, nom, date * @param $annee * @param array $tarifs * @param array $champsNom : liste non vide des champs de nom/prénom @@ -209,7 +210,7 @@ class Utils * @param $annee * @param array $champsNom : champs qui définissent le nom et le prénom d'une personne */ - public static function getDonateurs($annee, $champsNom) + public static function getDonateurs($annee, $champsNom) : array { // concaténer les champs nom/prénoms pour la sélection $nom = 'trim(' . Utils::combinerChamps($champsNom) . ') as nom,'; @@ -241,7 +242,16 @@ class Utils GROUP by membres.id ORDER by " . $tri . " COLLATE U_NOCASE "; - return DB::getInstance()->get($sql, $annee); + $donateurs = array(); + foreach (DB::getInstance()->iterate($sql, $annee) as $personne) + { + $donateurs[$personne->idUser] = new Personne($personne->idUser, + $personne->nom, + $personne->adresse, + $personne->codePostal, + $personne->ville); + } + return $donateurs; } public static function getLignesReduction($lesTaux) diff --git a/www/admin/generer_activites.php b/www/admin/generer_activites.php index f73abf8..39e66cf 100644 --- a/www/admin/generer_activites.php +++ b/www/admin/generer_activites.php @@ -61,22 +61,12 @@ foreach ($totalPersonnes as $idPersonne => $personne) $articlesCGI, $signature ); - // extraire les montants des versements - $lesMontants = array(); - foreach ($personne->versements as $versement) - { - if (array_key_exists($versement->tauxReduction, $lesMontants)) { - $lesMontants[$versement->tauxReduction] += $versement->montant; - } - else { - $lesMontants[$versement->tauxReduction] = $versement->montant; - } - } + $html->imprimer_recu( $_SESSION['annee_recu'], $personne->id, $personne->nomPrenom, - $lesMontants, + $personne->versements, $personne->adresse, $personne->codePostal, $personne->ville @@ -117,12 +107,12 @@ function cumulerVersements($versements) $ligne->idUser != $idPersonneCourant ) { - if ($idTarifCourant != -1) { + if ($idTarifCourant != -1) + { + // changement de tarif ou de personne $totalPersonnes[$idPersonneCourant]->ajouterVersement( - $_SESSION['lesTarifs'][$idTarifCourant]->idActivite, - $idTarifCourant, - $totalVersements/100, - $_SESSION['tauxSelectionnes'][$idTarifCourant] + $_SESSION['tauxSelectionnes'][$idTarifCourant], + $totalVersements/100 ); } $idTarifCourant = $ligne->idTarif; @@ -140,10 +130,8 @@ function cumulerVersements($versements) } // et le dernier $totalPersonnes[$idPersonneCourant]->ajouterVersement( - $_SESSION['lesTarifs'][$idTarifCourant]->idActivite, - $idTarifCourant, - $totalVersements/100, - $_SESSION['tauxSelectionnes'][$idTarifCourant] + $_SESSION['tauxSelectionnes'][$idTarifCourant], + $totalVersements/100 ); return $totalPersonnes; } diff --git a/www/admin/generer_personnes.php b/www/admin/generer_personnes.php index b638c8b..8d3b1f7 100644 --- a/www/admin/generer_personnes.php +++ b/www/admin/generer_personnes.php @@ -64,22 +64,11 @@ foreach ($totalPersonnes as $idPersonne => $personne) $signature ); - // extraire les montants des versements - $lesMontants = array(); - foreach ($personne->versements as $versement) - { - if (array_key_exists($versement->tauxReduction, $lesMontants)) { - $lesMontants[$versement->tauxReduction] += $versement->montant; - } - else { - $lesMontants[$versement->tauxReduction] = $versement->montant; - } - } $html->imprimer_recu( $_SESSION['annee_recu'], $personne->id, $personne->nomPrenom, - $lesMontants, + $personne->versements, $personne->adresse, $personne->codePostal, $personne->ville @@ -120,10 +109,8 @@ function cumulerVersements($versements) if ($idPersonneCourant != -1) { $totalPersonnes[$idPersonneCourant]->ajouterVersement( - 0, - 0, - $totalVersements/100, - $_SESSION['taux_reduction'] + $_SESSION['taux_reduction'], + $totalVersements/100 ); } $idPersonneCourant = $ligne->idUser; @@ -140,10 +127,8 @@ function cumulerVersements($versements) } // et le dernier $totalPersonnes[$idPersonneCourant]->ajouterVersement( - 0, - 0, - $totalVersements/100, - $_SESSION['taux_reduction'] + $_SESSION['taux_reduction'], + $totalVersements/100 ); return $totalPersonnes; } diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index a618731..68fa738 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -40,14 +40,14 @@ $_SESSION['tauxSelectionnes'] = $tauxSelectionnes; // obtenir les instances de tarifs correspondant à la sélection $lesTarifs = array(); foreach (Utils::getTarifs($tarifsSelectionnes) as $ot) { - $lesTarifs[$ot->id] = Tarif::copier($ot); + $lesTarifs[$ot->id] = $ot; } $_SESSION['lesTarifs'] = $lesTarifs; // activités correspondants aux tarifs sélectionnés $lesActivites = array(); foreach (Utils::getActivites($tarifsSelectionnes) as $activite) { - $lesActivites[$activite->id] = Activite::copier($activite); + $lesActivites[$activite->id] = $activite; } $_SESSION['lesActivites'] = $lesActivites; @@ -57,18 +57,8 @@ $_SESSION['lesVersements'] = Utils::getVersementsTarifs($_SESSION['annee_recu'], $champsNom); // membres donateurs -$versementsMembres = Utils::getDonateurs($_SESSION['annee_recu'], - $champsNom); -$membresDonateurs = array(); -foreach ($versementsMembres as $versement) { - $membresDonateurs[$versement->idUser] = new Personne($versement->idUser, - $versement->nom, - $versement->adresse, - $versement->codePostal, - $versement->ville); -} -$_SESSION['membresDonateurs'] = $membresDonateurs; - +$_SESSION['membresDonateurs'] = Utils::getDonateurs($_SESSION['annee_recu'], + $champsNom); // ------------------------------------------------------------------------ // fonctions pour l'affichage diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 5d6df3b..59a3ae6 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -29,18 +29,8 @@ $_SESSION['lesVersements'] = Utils::getVersementsPersonnes($_SESSION['annee_recu $champsNom); // membres donateurs -$versementsMembres = Utils::getDonateurs($_SESSION['annee_recu'], +$_SESSION['membresDonateurs'] = Utils::getDonateurs($_SESSION['annee_recu'], $champsNom); -$membresDonateurs = array(); -foreach ($versementsMembres as $versement) { - $membresDonateurs[$versement->idUser] = new Personne($versement->idUser, - $versement->nom, - $versement->adresse, - $versement->codePostal, - $versement->ville); -} -$_SESSION['membresDonateurs'] = $membresDonateurs; - // ------------------------------------------------------------------------ // fonctions pour l'affichage From 3e53f194532c682dc22f95b576fefa0e77536319 Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 25 Mar 2022 19:28:57 +0000 Subject: [PATCH 030/137] =?UTF-8?q?am=C3=A9lioration=20gestion=20champs=20?= =?UTF-8?q?nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 2e194af9739c1603c6471619fe3b9720beb014d8d11442d01a42fc722ca9e790 --- garradin_plugin.ini | 2 +- lib/Utils.php | 47 ++++++++++++++++++++++++++++++ templates/config.tpl | 4 +-- upgrade.php | 13 +++++---- www/admin/config.php | 32 +++++--------------- www/admin/index.php | 4 +-- www/admin/versements_activites.php | 6 ++-- www/admin/versements_personnes.php | 2 +- 8 files changed, 72 insertions(+), 38 deletions(-) diff --git a/garradin_plugin.ini b/garradin_plugin.ini index 3193717..8e00b99 100644 --- a/garradin_plugin.ini +++ b/garradin_plugin.ini @@ -2,7 +2,7 @@ nom="Reçus fiscaux" description="Génération de reçus fiscaux pour les dons des membres" auteur="jce" url="https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin" -version="0.6" +version="0.6.2" menu=1 config=1 min_version="1.1" diff --git a/lib/Utils.php b/lib/Utils.php index f6bed5b..22e74d0 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -257,6 +257,53 @@ class Utils return $anneesFiscales; } + /** + * récupérer dans la config du plugin les champs des membres + * utilisés pour le nom et le prénom ; ajouter/supprimer les + * modifications par rapport à la config garradin + * @return tableau des champs : clé = nom, valeur = { titre, position } + */ + public static function getChampsNom($config, $plugin) : array + { + // récupérer dans la config du plugin les champs mémorisés + // pour le nom et le prénom (le tableau est vide si pas mémorisé) + $champsNom = (array) $plugin->getConfig('champsNom'); + + // récupérer dans la config Garradin les champs des membres + // utilisés pour le nom et le préno + $champsGarradin = $config->get('champs_membres')->listAssocNames(); + + foreach ($champsGarradin as $name => $title) + { + if (stristr($title, 'nom')) + { + // retenir les champs dont le titre contient le term 'nom' + // est-il présent dans la config du plugin ? + if (! array_key_exists($name, $champsNom)) + { + // absent => l'ajouter + $champ = new \stdClass(); + $champ->titre = $title; + $champ->position = 0; + $champsNom[$name] = $champ; + } + } + } + // opération symétrique : un champ mémorisé dans la config du + // plugin a-t-il disparu de la config garradin ? + foreach ($champsNom as $nom => $champ) + { + if (! array_key_exists($nom, $champsGarradin)) + { + // absent => le supprimer + unset($champsNom[$nom]); + } + } + // mettre à jour la config du plugin + $plugin->setConfig('champsNom', $champsNom); + return $champsNom; + } + /** * enregistrer les fichiers dans une archive zip * @param $fileList : liste des fichiers à archiver diff --git a/templates/config.tpl b/templates/config.tpl index f106aeb..f7433f1 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -85,13 +85,13 @@ {* les champs de nom *} - +

    Sélectionnez et classez le(s) champ(s) qui représente(nt) le nom et le prénom du donateur

    - {foreach from=$nomChamps key="nom" item="champ"} + {foreach from=$champsNom key="nom" item="champ"}
    diff --git a/upgrade.php b/upgrade.php index a0a8751..c733afd 100644 --- a/upgrade.php +++ b/upgrade.php @@ -2,12 +2,15 @@ namespace Garradin; -use Garradin\Entities\Files\File; - -$db = DB::getInstance(); - $old_version = $plugin->getInfos('version'); -if (version_compare($old_version, '0.6.0', '<')) +if (version_compare($old_version, '0.6.2', '<')) { + // changement de nom de la configuration des champs nom + $champsNom = $plugin->getConfig('nomChamps'); + if (null !== $champsNom) + { + $plugin->setConfig('champsNom', $champsNom); + $plugin->setConfig('nomChamps', null); + } } diff --git a/www/admin/config.php b/www/admin/config.php index 64c0506..aaf9498 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -3,29 +3,15 @@ namespace Garradin; use Garradin\Files\Files; use Garradin\Entities\Files\File; +use Garradin\Plugin\RecusFiscaux\Utils; $session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN); $art_sel = f('articlesCGI') ? : []; $taux_sel = f('tauxReduction') ? : []; $noms_sel = f('champsNom') ? : []; -$confNoms = $plugin->getConfig('nomChamps'); -if (! isset($confNoms)) -{ - // récupérer les champs des membres utilisés pour le nom et le prénom - $nomChamps = array(); - foreach ($config->get('champs_membres')->listAssocNames() as $name => $title) - { - if (stristr($title, 'nom')) - { - $champ = new \stdClass(); - $champ->titre = $title; - $champ->position = 0; - $nomChamps[$name] = $champ; - } - } - $plugin->setConfig('nomChamps', $nomChamps); -} +// récupérer les champs des noms +$champsNom = Utils::getChampsNom($config, $plugin); if (f('save') && $form->check('recusfiscaux_config')) { @@ -79,17 +65,16 @@ if (f('save') && $form->check('recusfiscaux_config')) $plugin->setConfig('ville_asso', trim(f('ville_asso'))); // champs pour le nom et prénom - $confNoms = (array)$plugin->getConfig('nomChamps'); - foreach ($confNoms as $nom => $champ) + foreach ($champsNom as $nom => $champ) { $champ->position = 0; } $i = -count($noms_sel); foreach ($noms_sel as $nom) { - $confNoms[$nom]->position = $i++; + $champsNom[$nom]->position = $i++; } - $plugin->setConfig('nomChamps', $confNoms); + $plugin->setConfig('champsNom', $champsNom); \Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok'); } @@ -100,8 +85,7 @@ if (f('save') && $form->check('recusfiscaux_config')) } // trier les champs de nom pour l'affichage -$nomChamps = (array) $plugin->getConfig('nomChamps'); -uasort($nomChamps, function ($a, $b) +uasort($champsNom, function ($a, $b) { return $a->position - $b->position; }); @@ -111,6 +95,6 @@ $path = qg('path') ?: File::CONTEXT_CONFIG; $tpl->assign('path', $path); $tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"); $tpl->assign('plugin_config', $plugin->getConfig()); -$tpl->assign('nomChamps', $nomChamps); +$tpl->assign('champsNom', $champsNom); $tpl->assign('plugin_css', ['style.css']); $tpl->display(PLUGIN_ROOT . '/templates/config.tpl'); diff --git a/www/admin/index.php b/www/admin/index.php index 1dc3f17..1e999df 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -23,9 +23,9 @@ foreach ($plugin->getConfig('reduction') as $taux) // idem avec les champs nom/prénom $nbChamps = 0; -if (null !== $plugin->getConfig('nomChamps')) +if (null !== $plugin->getConfig('champsNom')) { - foreach ($plugin->getConfig('nomChamps') as $nom => $champ) + foreach ($plugin->getConfig('champsNom') as $nom => $champ) { if ($champ->position != 0) { ++$nbChamps; } } diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index 8828415..d4a66b8 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -14,7 +14,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { } // champs pour le nom et prénom -$confNoms = (array) $plugin->getConfig('nomChamps'); +$confNoms = (array) $plugin->getConfig('champsNom'); uasort($confNoms, function ($a, $b) { return $a->position - $b->position; @@ -40,14 +40,14 @@ $_SESSION['tauxSelectionnes'] = $tauxSelectionnes; // obtenir les instances de tarifs correspondant à la sélection $lesTarifs = array(); foreach (Utils::getTarifs($tarifsSelectionnes) as $ot) { - $lesTarifs[$ot->id] = Tarif::copier($ot); + $lesTarifs[$ot->id] = $ot; } $_SESSION['lesTarifs'] = $lesTarifs; // activités correspondants aux tarifs sélectionnés $lesActivites = array(); foreach (Utils::getActivites($tarifsSelectionnes) as $activite) { - $lesActivites[$activite->id] = Activite::copier($activite); + $lesActivites[$activite->id] = $activite; } $_SESSION['lesActivites'] = $lesActivites; diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index b7ebd0e..258a93b 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -13,7 +13,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { $_SESSION['taux_reduction'] = $_POST['taux_reduction']; // champs pour le nom et prénom -$confNoms = (array) $plugin->getConfig('nomChamps'); +$confNoms = (array) $plugin->getConfig('champsNom'); uasort($confNoms, function ($a, $b) { return $a->position - $b->position; From dda2000399d19f8358c107b0fb7995dd69c4c1ed Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 26 Mar 2022 19:14:18 +0000 Subject: [PATCH 031/137] =?UTF-8?q?encore=20une=20am=C3=A9lioration=20dans?= =?UTF-8?q?=20la=20gestion=20des=20champs=20nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 0322812522d5aab61205617cf4e8f85994fd93315f2abaaf205c0f8b784d4fbf --- www/admin/index.php | 6 ++++-- www/admin/versements_activites.php | 2 +- www/admin/versements_personnes.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/www/admin/index.php b/www/admin/index.php index 1e999df..3791e44 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -23,9 +23,11 @@ foreach ($plugin->getConfig('reduction') as $taux) // idem avec les champs nom/prénom $nbChamps = 0; -if (null !== $plugin->getConfig('champsNom')) +$champsNom = Utils::getChampsNom($config, $plugin); + +if (null !== $champsNom) { - foreach ($plugin->getConfig('champsNom') as $nom => $champ) + foreach ($champsNom as $nom => $champ) { if ($champ->position != 0) { ++$nbChamps; } } diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index d4a66b8..0c44d40 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -14,7 +14,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { } // champs pour le nom et prénom -$confNoms = (array) $plugin->getConfig('champsNom'); +$confNoms = Utils::getChampsNom($config, $plugin); uasort($confNoms, function ($a, $b) { return $a->position - $b->position; diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 258a93b..aa3612f 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -13,7 +13,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { $_SESSION['taux_reduction'] = $_POST['taux_reduction']; // champs pour le nom et prénom -$confNoms = (array) $plugin->getConfig('champsNom'); +$confNoms = Utils::getChampsNom($config, $plugin); uasort($confNoms, function ($a, $b) { return $a->position - $b->position; From 2bdd771a70a56395debdf926573a513400f835f2 Mon Sep 17 00:00:00 2001 From: engel <> Date: Tue, 29 Mar 2022 12:49:03 +0000 Subject: [PATCH 032/137] =?UTF-8?q?am=C3=A9lioration=20gestion=20champs=20?= =?UTF-8?q?nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 23841b8b267a439702b01a11c2066c9be6469638b660b334c28d695f2c149f83 --- lib/Utils.php | 50 +++++++++++++++++++++++++++++++++++++++++++- templates/config.tpl | 4 ++-- www/admin/config.php | 33 ++++++++--------------------- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/lib/Utils.php b/lib/Utils.php index c9f6121..d2c3400 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -299,7 +299,8 @@ class Utils /** * @return liste des années fiscales */ - public static function getAnneesFiscales() { + public static function getAnneesFiscales() : array + { $rows = DB::getInstance()->get( "SELECT strftime('%Y', start_date) as annee FROM acc_years @@ -312,6 +313,53 @@ class Utils return $anneesFiscales; } + /** + * récupérer dans la config du plugin les champs des membres + * utilisés pour le nom et le prénom ; ajouter/supprimer les + * modifications par rapport à la config garradin + * @return tableau des champs : clé = nom, valeur = { titre, position } + */ + public static function getChampsNom($config, $plugin) : array + { + // récupérer dans la config du plugin les champs mémorisés + // pour le nom et le prénom (le tableau est vide si pas mémorisé) + $champsNom = (array) $plugin->getConfig('champsNom'); + + // récupérer dans la config Garradin les champs des membres + // utilisés pour le nom et le préno + $champsGarradin = $config->get('champs_membres')->listAssocNames(); + + foreach ($champsGarradin as $name => $title) + { + if (stristr($title, 'nom')) + { + // retenir les champs dont le titre contient le terme 'nom' + // est-il présent dans la config du plugin ? + if (! array_key_exists($name, $champsNom)) + { + // absent => l'ajouter + $champ = new \stdClass(); + $champ->titre = $title; + $champ->position = 0; + $champsNom[$name] = $champ; + } + } + } + // opération symétrique : un champ mémorisé dans la config du + // plugin a-t-il disparu de la config garradin ? + foreach ($champsNom as $nom => $champ) + { + if (! array_key_exists($nom, $champsGarradin)) + { + // absent => le supprimer + unset($champsNom[$nom]); + } + } + // mettre à jour la config du plugin + $plugin->setConfig('champsNom', $champsNom); + return $champsNom; + } + /** * enregistrer les fichiers dans une archive zip * @param $fileList : liste des fichiers à archiver diff --git a/templates/config.tpl b/templates/config.tpl index f106aeb..f7433f1 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -85,13 +85,13 @@
    {* les champs de nom *} - +

    Sélectionnez et classez le(s) champ(s) qui représente(nt) le nom et le prénom du donateur

    - {foreach from=$nomChamps key="nom" item="champ"} + {foreach from=$champsNom key="nom" item="champ"}
    diff --git a/www/admin/config.php b/www/admin/config.php index 64c0506..c5b406a 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -1,31 +1,18 @@ requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN); $art_sel = f('articlesCGI') ? : []; $taux_sel = f('tauxReduction') ? : []; $noms_sel = f('champsNom') ? : []; -$confNoms = $plugin->getConfig('nomChamps'); -if (! isset($confNoms)) -{ - // récupérer les champs des membres utilisés pour le nom et le prénom - $nomChamps = array(); - foreach ($config->get('champs_membres')->listAssocNames() as $name => $title) - { - if (stristr($title, 'nom')) - { - $champ = new \stdClass(); - $champ->titre = $title; - $champ->position = 0; - $nomChamps[$name] = $champ; - } - } - $plugin->setConfig('nomChamps', $nomChamps); -} +// récupérer les champs des noms +$champsNom = Utils::getChampsNom($config, $plugin); if (f('save') && $form->check('recusfiscaux_config')) { @@ -79,17 +66,16 @@ if (f('save') && $form->check('recusfiscaux_config')) $plugin->setConfig('ville_asso', trim(f('ville_asso'))); // champs pour le nom et prénom - $confNoms = (array)$plugin->getConfig('nomChamps'); - foreach ($confNoms as $nom => $champ) + foreach ($champsNom as $nom => $champ) { $champ->position = 0; } $i = -count($noms_sel); foreach ($noms_sel as $nom) { - $confNoms[$nom]->position = $i++; + $champsNom[$nom]->position = $i++; } - $plugin->setConfig('nomChamps', $confNoms); + $plugin->setConfig('champsNom', $champsNom); \Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok'); } @@ -100,8 +86,7 @@ if (f('save') && $form->check('recusfiscaux_config')) } // trier les champs de nom pour l'affichage -$nomChamps = (array) $plugin->getConfig('nomChamps'); -uasort($nomChamps, function ($a, $b) +uasort($champsNom, function ($a, $b) { return $a->position - $b->position; }); @@ -111,6 +96,6 @@ $path = qg('path') ?: File::CONTEXT_CONFIG; $tpl->assign('path', $path); $tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png"); $tpl->assign('plugin_config', $plugin->getConfig()); -$tpl->assign('nomChamps', $nomChamps); +$tpl->assign('champsNom', $champsNom); $tpl->assign('plugin_css', ['style.css']); $tpl->display(PLUGIN_ROOT . '/templates/config.tpl'); From 2fddc192f9281970375b7ea7699508e66ef69c27 Mon Sep 17 00:00:00 2001 From: engel <> Date: Tue, 29 Mar 2022 12:49:54 +0000 Subject: [PATCH 033/137] =?UTF-8?q?am=C3=A9lioration=20gestion=20champs=20?= =?UTF-8?q?nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 488779d3afad6864200d59e0ee7443c89214925ccb0b157c0fd462373b685750 --- www/admin/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/www/admin/index.php b/www/admin/index.php index 1dc3f17..3791e44 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -23,9 +23,11 @@ foreach ($plugin->getConfig('reduction') as $taux) // idem avec les champs nom/prénom $nbChamps = 0; -if (null !== $plugin->getConfig('nomChamps')) +$champsNom = Utils::getChampsNom($config, $plugin); + +if (null !== $champsNom) { - foreach ($plugin->getConfig('nomChamps') as $nom => $champ) + foreach ($champsNom as $nom => $champ) { if ($champ->position != 0) { ++$nbChamps; } } From 328789b92302ba09a4d10886165f07fe86f01bae Mon Sep 17 00:00:00 2001 From: engel <> Date: Tue, 29 Mar 2022 12:50:25 +0000 Subject: [PATCH 034/137] =?UTF-8?q?harmonisation=20pr=C3=A9sentation=20per?= =?UTF-8?q?sonnes-activit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 53550421b288837f1c2120259c638952fdf2853441a1315359d7af51c57c80d8 --- templates/versements_activites.tpl | 49 +++++++++++++++++++----------- templates/versements_personnes.tpl | 39 +++++++++++++++++++----- www/admin/script.js | 28 ++++++++--------- www/admin/style.css | 8 +++-- www/admin/versements_activites.php | 43 +++++++++++++++++--------- www/admin/versements_personnes.php | 41 ++++++++++++++++--------- 6 files changed, 137 insertions(+), 71 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index c36a1c7..1ead4a4 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -3,17 +3,18 @@

    Versements par activité et tarif

    -
    - - -
    - -
    - -
    +
    + {*
    *} -
    + + + + + {*
    *} +
    + + {* Itération sur les versements *} {foreach from=$lesVersements key="i" item="versement"} @@ -31,7 +32,8 @@ {if $versement.idTarif != $tarifCourant} {* changement de tarif *} {* fin versements d'une personne *} - + {* fin versements d'une personne *} + {* fin tarif *} idTarif; $personneCourante = $versement->idUser; @@ -42,6 +44,7 @@ {elseif $versement.idUser != $personneCourante} {* changement de personne *} + idUser; ?> @@ -53,8 +56,9 @@ {/if} {/if} {/foreach} {* Itération sur les versements *} - - + {* fin versements d'une personne *} + {* fin versements d'une personne *} + {* fin tarif *} @@ -64,14 +68,25 @@ {literal} +{literal} + +{/literal} + -{include file="admin/_foot.tpl"} +{include file="admin/_foot.tpl"} \ No newline at end of file diff --git a/www/admin/script.js b/www/admin/script.js index 3f5b501..4a7eaad 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -5,14 +5,12 @@ */ function cocherDecocherTout(idCaseGlobale) { - // chercher le formulaire englobant - var formulaire = idCaseGlobale.closest("form"); // itérer sur la liste des éléments détails : 1 par couple - var lesDetails = formulaire.querySelectorAll("details"); + var lesDetails = document.querySelectorAll("details.activite"); for (var i = 0; i < lesDetails.length; ++i) { // itérer sur les personnes - var lesH3 = lesDetails[i].querySelectorAll("h3.personne"); + var lesH3 = lesDetails[i].querySelectorAll("h4.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesH3); } // changer le message @@ -22,9 +20,9 @@ function cocherDecocherTout(idCaseGlobale) /** * idem dans le cas des versements des personnes */ -function cocherDecocherToutesLesPersonnes(formulaire, idCaseGlobale) +function cocherDecocherToutesLesPersonnes(idCaseGlobale) { - var lesH3 = formulaire.querySelectorAll("h3.personne"); + var lesH3 = document.querySelectorAll("h4.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesH3); changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); } @@ -36,11 +34,11 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) // trouver l'élément total de la personne var idTotal = lesPersonnes[j].querySelector("span"); // puis la case à cocher - var fieldset = lesPersonnes[j].nextElementSibling; + var fieldset = lesPersonnes[j].closest("details").querySelector("fieldset"); var idCase = fieldset.querySelector("input"); idCase.checked = idCaseGlobale.checked; // puis traiter toutes les cases de la personne - cocherDecocherPersonne(idCase, idTotal); + cocherDecocherPersonne(idCase, idTotal, false); } } @@ -51,13 +49,14 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) * * @param id de la case qui a été cochée * @param id de l'élément où afficher le total + * @param changerMessage : vrai, s'il faut changer le message de la personne */ -function cocherDecocherPersonne(idCase, idTotal) +function cocherDecocherPersonne(idCase, idTotal, changerMessage = true) { - // chercher le fieldset englobant - var fieldset = idCase.closest("fieldset"); + // chercher le fieldset des versements + var fieldset = idCase.closest("details").querySelector("fieldset"); var listeCases = fieldset.querySelectorAll("input[type=checkbox]"); - for (var i = 1; i < listeCases.length; ++i) + for (var i = 0; i < listeCases.length; ++i) { listeCases[i].checked = idCase.checked; } @@ -65,13 +64,12 @@ function cocherDecocherPersonne(idCase, idTotal) var listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); // changer le message - changerMessage(idCase.nextElementSibling, idCase); + if (changerMessage) { changerMessage(idCase.nextElementSibling, idCase); } } /** * Fonction appelée quand on (dé)coche la case d'un versement - * - (dé)sélectionner cette case (?) - * - faire le total des cases cochées et l'afficher + * Faire le total des cases cochées et l'afficher * * @param id de la case qui a été cochée * @param id de l'élément où afficher le total diff --git a/www/admin/style.css b/www/admin/style.css index 938186b..6ec9810 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -25,8 +25,8 @@ span.montant { summary.activite { background: rgba(var(--gMainColor), 0.25); } -h3.personne { - background: rgba(var(--gSecondColor), 0.35); +h3.personne, h4.personne { + background: rgba(var(--gSecondColor), 0.15); } #signature { @@ -48,3 +48,7 @@ div.actions { display : inline; } +input.check_global +{ + margin : 0.2em 0.5em; +} diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index 68fa738..0c6a804 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -14,7 +14,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { } // champs pour le nom et prénom -$confNoms = (array) $plugin->getConfig('nomChamps'); +$confNoms = Utils::getChampsNom($config, $plugin); uasort($confNoms, function ($a, $b) { return $a->position - $b->position; @@ -71,7 +71,7 @@ $tpl->register_function('afficher_debut_tarif', function ($params) $idActivite = $tarif->idActivite; $activite = $_SESSION['lesActivites'][$idActivite]; - $out = '
    + $out = '
    '; $out .= sprintf('

    Activité « %s »

    ', $activite->label); @@ -91,22 +91,24 @@ $tpl->register_function('afficher_debut_tarif', function ($params) return $out; }); -// afficher les informations d'une personne +// Afficher les informations d'une personne $tpl->register_function('afficher_debut_personne', function ($params) { $versement = $params['versement']; $idUser = $versement->idUser; $personne = $_SESSION['membresDonateurs'][$idUser]; $idVersement = $versement->idTarif . "_" . $versement->idUser; - $out = sprintf('

    Versements de %s : 0,00 €

    ', + $out = '
    + '; + $out .= sprintf('

    Versements de %s : 0,00 €', $personne->nomPrenom, $idVersement); + $out .= '

    '; $out .= sprintf('
    ', $idVersement); $out .= sprintf(' - ', $idVersement, @@ -128,17 +130,28 @@ $tpl->register_function('afficher_versement', function ($params) $out = '
    ' : 'impair">'; $out .= sprintf(' - - - %.2f + ', + $idVersement, + $idVersement, $rang, + $rang, + $idVersement, $rang, $idVersement + ); + $out .= sprintf(' + ', + $idVersement, $rang + ); + $out .= sprintf(' + %.2f', + $versement->versement/100 + ); + $out .= sprintf(' %s
    ', - $idVersement, $idVersement, - $rang, $rang, - $idVersement, $rang, $idVersement, $idVersement, $rang, - $versement->versement/100, date_format(date_create($versement->date),"d/m/Y")); return $out; }); diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 59a3ae6..648f52d 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -13,7 +13,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { $_SESSION['taux_reduction'] = $_POST['taux_reduction']; // champs pour le nom et prénom -$confNoms = (array) $plugin->getConfig('nomChamps'); +$confNoms = Utils::getChampsNom($config, $plugin); uasort($confNoms, function ($a, $b) { return $a->position - $b->position; @@ -34,22 +34,24 @@ $_SESSION['membresDonateurs'] = Utils::getDonateurs($_SESSION['annee_recu'], // ------------------------------------------------------------------------ // fonctions pour l'affichage -// afficher les informations d'une personne +// Afficher les informations d'une personne $tpl->register_function('afficher_debut_personne', function ($params) { $versement = $params['versement']; $idUser = $versement->idUser; $personne = $_SESSION['membresDonateurs'][$idUser]; $idVersement = $versement->idUser; - $out = sprintf('

    Versements de %s : 0,00 €

    ', + $out = '
    + '; + $out .= sprintf('

    Versements de %s : 0,00 €

    ', $personne->nomPrenom, $idVersement); + $out .= '
    '; $out .= sprintf('
    ', $idVersement); $out .= sprintf(' - ', $idVersement, @@ -71,17 +73,28 @@ $tpl->register_function('afficher_versement', function ($params) $out = '
    ' : 'impair">'; $out .= sprintf(' - - - %.2f + ', + $idVersement, + $idVersement, $rang, + $rang, + $idVersement, $rang, $idVersement + ); + $out .= sprintf(' + ', + $idVersement, $rang + ); + $out .= sprintf(' + %.2f', + $versement->versement/100 + ); + $out .= sprintf(' %s
    ', - $idVersement, $idVersement, - $rang, $rang, - $idVersement, $rang, $idVersement, $idVersement, $rang, - $versement->versement/100, date_format(date_create($versement->date),"d/m/Y")); return $out; }); From 1d6225ae6d347d8da8f521cd27618330c660c4df Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 30 Mar 2022 07:52:19 +0000 Subject: [PATCH 035/137] =?UTF-8?q?simplification=20affichage=20d=C3=A9tai?= =?UTF-8?q?ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: e47b52d7676b4829e1dea5de3acf64bb3fd7da6c9b3dccef76390856d985f461 --- templates/versements_activites.tpl | 39 +++--------------------------- templates/versements_personnes.tpl | 23 ++---------------- www/admin/script.js | 33 ++++++++++++++++++++++--- 3 files changed, 36 insertions(+), 59 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 1ead4a4..c18fa8c 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -4,14 +4,10 @@

    Versements par activité et tarif

    - {*
    *} - - - - - {*
    *} + +
    @@ -55,7 +51,7 @@ {afficher_versement versement=$versement rang=$i} {/if} {/if} - {/foreach} {* Itération sur les versements *} + {/foreach} {* Itération sur les versements *}
    {* fin versements d'une personne *}
    {* fin versements d'une personne *}
    {* fin tarif *} @@ -63,35 +59,8 @@ -{* scripts pour cases à cocher *} +{* scripts divers *} -{literal} - -{/literal} - {include file="admin/_foot.tpl"} \ No newline at end of file diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index 1daa290..b9ee8fb 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -4,13 +4,10 @@

    Versements par personne

    - {*
    *} - - - {*
    *} +
    @@ -44,24 +41,8 @@
    -{* scripts pour cases à cocher *} +{* scripts divers *} -{literal} - -{/literal} - {include file="admin/_foot.tpl"} \ No newline at end of file diff --git a/www/admin/script.js b/www/admin/script.js index 4a7eaad..550c641 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -49,9 +49,9 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) * * @param id de la case qui a été cochée * @param id de l'élément où afficher le total - * @param changerMessage : vrai, s'il faut changer le message de la personne + * @param changer : vrai, s'il faut changer le message de la personne */ -function cocherDecocherPersonne(idCase, idTotal, changerMessage = true) +function cocherDecocherPersonne(idCase, idTotal, changer = true) { // chercher le fieldset des versements var fieldset = idCase.closest("details").querySelector("fieldset"); @@ -64,7 +64,7 @@ function cocherDecocherPersonne(idCase, idTotal, changerMessage = true) var listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); // changer le message - if (changerMessage) { changerMessage(idCase.nextElementSibling, idCase); } + if (changer) { changerMessage(idCase.nextElementSibling, idCase); } } /** @@ -195,3 +195,30 @@ function verifierRadio(idElem) alert("Erreur : il faut sélectionner un taux de réduction"); return false; } + +function montrerMasquerDetails(idElem, classe, texte) +{ + var lesDetails = document.querySelectorAll(classe); + if (lesDetails.length > 0) + { + var leBouton = document.getElementById(idElem); + if (leBouton.textContent.startsWith('Replier')) + { + // masquer + lesDetails.forEach((e) => { + e.removeAttribute('open'); + }); + leBouton.textContent = "Déplier " + texte; + leBouton.setAttribute('data-icon', '↓'); + } + else + { + // montrer + lesDetails.forEach((e) => { + e.setAttribute('open', 'open'); + }); + leBouton.textContent = "Replier " + texte; + leBouton.setAttribute('data-icon', '↑'); + } + } +} From e509995c1363ab6af49a8d4c70526d2e6474e49b Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 30 Mar 2022 07:52:41 +0000 Subject: [PATCH 036/137] =?UTF-8?q?petite=20am=C3=A9lioration=20cosm=C3=A9?= =?UTF-8?q?tique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: ecd15c4fa074ff5c85aa828c58b9cafcd1e10cdd62389759e2f421fb38b047c9 --- www/admin/style.css | 10 ++++++++++ www/admin/versements_activites.php | 2 +- www/admin/versements_personnes.php | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/www/admin/style.css b/www/admin/style.css index 6ec9810..f5ab0ef 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -22,10 +22,20 @@ span.montant { width : 5em; text-align : right; } +span.total +{ + font-weight : bold; +} summary.activite { background: rgba(var(--gMainColor), 0.25); + margin-bottom : 0.5em; +} +summary.personne +{ + margin-bottom : 0.5em; } h3.personne, h4.personne { + font-weight : normal; background: rgba(var(--gSecondColor), 0.15); } #signature diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index 0c6a804..8cb04c5 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -100,7 +100,7 @@ $tpl->register_function('afficher_debut_personne', function ($params) $idVersement = $versement->idTarif . "_" . $versement->idUser; $out = '
    '; - $out .= sprintf('

    Versements de %s : 0,00 €', + $out .= sprintf('

    Versements de %s : 0,00 €', $personne->nomPrenom, $idVersement); $out .= '

    '; diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 648f52d..1849624 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -43,7 +43,7 @@ $tpl->register_function('afficher_debut_personne', function ($params) $idVersement = $versement->idUser; $out = '
    '; - $out .= sprintf('

    Versements de %s : 0,00 €

    ', + $out .= sprintf('

    Versements de %s : 0,00 €

    ', $personne->nomPrenom, $idVersement); $out .= '
    '; From 8f0e4bbfd73e7dad9c03799fb6a5d286f0c7a609 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 30 Mar 2022 09:30:13 +0000 Subject: [PATCH 037/137] ajout commentaires FossilOrigin-Name: 85ed34428934f56680881b15a2104bb265521e84211e0e8b3bbeca4b56fb3349 --- templates/index.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/index.tpl b/templates/index.tpl index 356628d..9b6fa50 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -55,6 +55,7 @@
    + {* Toutes les personnes *} + {* Activités et tarifs *} - -
    -

    Bénéficiaire des versements

    -

    Association « {$this->nomAsso} »
    - {$this->adresseAsso}
    - Objet : {$this->objetAsso}

    -
    - -
    -

    Donateur

    -

    {$nom}
    - {$adresse}
    - {$code_postal} {$ville}

    -
    - -
    -

    Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt :

    -
      - -FDD; - - foreach ($lesMontants as $taux => $montant) - { - $this->imprimer_montant($montant, - Utils::getLigneReduction($taux)); - } - echo "
    \n"; - $this->imprimer_description("Date des versements :", - "année {$annee_recu}"); - $this->imprimer_description("Nature du don : ", - "Numéraire"); - $this->imprimer_description("Mode de versement : ", - "chèque et/ou virement"); - - // articles du CGI - $nbArticles = count($this->articlesCGI); - if ($nbArticles == 1) - { - echo "

    Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d'impôt prévue à l’article "; - printf("%s du code général des impôts

    \n", $this->articlesCGI[0]); - } - else if ($nbArticles > 1) - { - echo "

    Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d'impôt prévue aux articles "; - for ($i = 0; $i < $nbArticles; ++$i) { - printf("%s", $this->articlesCGI[$i]); - if ($i < $nbArticles - 2) { - echo ", "; - } - else if ($i == $nbArticles - 2) { - echo " et "; - } - } - echo " du code général des impôts

    \n"; - } - echo "
    \n"; - - // cartouche final - $date = date("j/m/Y"); -echo << -

    {$this->villeAsso} le {$date}
    - -

    -
    - $this->nomResponsable
    - $this->fonctionResponsable -
    - - - -FDD; - $this->html .= ob_get_clean(); - } - - // imprimer un libellé précédé de son titre en gras - function imprimer_description($titre, $libelle) - { - echo <<{$titre} {$libelle}

    - -FDD; - } - - // imprimer le montant du versement et un libellé - function imprimer_montant($montant, $libelle = "") - { - $valeur = number_format($montant, 2, ',', ''); - echo "
  • la somme de ***{$valeur}*** euros"; - if ($libelle != "") { - echo " ({$libelle})"; - } - echo "
  • \n"; - } - - protected function entete() - { - ob_start(); -echo << - - - - - - -
    - -

    Reçu au titre des dons à certains organismes d'intérêt général

    -

    Articles 200, 238 bis et 978 du code général des impôts

    - -FDD; - return ob_get_clean(); - } -} diff --git a/templates/recu.skel b/templates/recu.skel new file mode 100644 index 0000000..8638f19 --- /dev/null +++ b/templates/recu.skel @@ -0,0 +1,141 @@ + + + + + + + + +
    + +

    Reçu au titre des dons à certains organismes d'intérêt général

    +

    Articles 200, 238 bis et 978 du code général des impôts

    +
    +

    Reçu numéro {{$annee_recu}}/{{$numero}}

    +
    +
    + +
    +

    Bénéficiaire des versements

    +

    Association « {{$config.nom_asso}} »
    + {{$config.adresse_asso}}
    + Objet : {{$objet_asso}}

    +
    + +
    +

    Donateur

    +

    {{$nom}}
    + {{$adresse}}
    + {{$code_postal}} {{$ville}}

    +
    + +
    +

    Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt :

    +
      + {{#versements}} +
    • + la somme de ***{{$montant|raw|money}}*** euros + {{if $libelle != ""}} + ({{$libelle}}) + {{/if}} +
    • + {{/versements}} +
    + + {{#informations}} +

    {{$titre}} {{$libelle}}

    + {{/informations}} + +

    Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d'impôt prévue {{$texteArticles}} du code général des impôts.

    +
    + +
    +

    {{$ville_asso}} le {{$date}}
    + +

    +
    + {{$nom_responsable}}
    + {{$fonction_responsable}} +
    +
    + + diff --git a/www/admin/action.php b/www/admin/action.php index 421e8be..53bce04 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -130,6 +130,7 @@ $tpl->register_function('afficher_versement', function ($params) }); // ------------------------------------------------------------------------ +// aiguillage // ------------------------------------------------------------------------ if ($_GET['action'] == 'personne') { diff --git a/www/admin/generer_recus.php b/www/admin/generer_recus.php index d2d3868..18d2965 100644 --- a/www/admin/generer_recus.php +++ b/www/admin/generer_recus.php @@ -4,15 +4,54 @@ namespace Garradin; use Garradin\Files\Files; use Garradin\Entities\Files\File; +use Garradin\UserTemplate\UserTemplate; -use Garradin\Plugin\RecusFiscaux\RecusHTML; +//use Garradin\Plugin\RecusFiscaux\RecusHTML; use Garradin\Plugin\RecusFiscaux\Utils; use Garradin\Plugin\RecusFiscaux\Personne; -// récupérer les lignes sélectionnées -$lesLignes = f('selected'); +// signature +$signature = + (null !== $plugin->getConfig('signature')) ? + Files::get($plugin->getConfig('signature'))->fullpath() : + ""; + +// logo +$logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); +$logo_asso = + (null !== $logo_file) ? + Files::get($logo_file->path)->fullpath() : + ""; + +// articles du CGI +$articlesCGI = array(); +foreach ($plugin->getConfig('articlesCGI') as $article) +{ + if ($article->valeur == 1) { + $articlesCGI[] = $article->titre; + } +} +$nbArticles = count($articlesCGI); +if ($nbArticles == 1) +{ + $texteArticles = 'à l’article ' . $articlesCGI[0]; +} +elseif ($nbArticles > 1) +{ + $texteArticles = 'aux articles '; + for ($i = 0; $i < $nbArticles; ++$i) { + $texteArticles .= $articlesCGI[$i]; + if ($i < $nbArticles - 2) { + $texteArticles .= ", "; + } + else if ($i == $nbArticles - 2) { + $texteArticles .= " et "; + } + } +} // filtrer les versements sélectionnés +$lesLignes = f('selected'); $versementsSelectionnes = array(); foreach ($lesLignes as $ligne) { $versementsSelectionnes[] = $_SESSION['lesVersements'][$ligne]; @@ -28,69 +67,77 @@ elseif ($_GET['type'] == 'activite') $totalPersonnes = cumulerVersementsTarif($versementsSelectionnes); } -// informations pour les reçus -$nomAsso = $config->get('nom_asso'); -$adresseAsso = $config->get('adresse_asso'); -$signature = - (null !== $plugin->getConfig('signature')) ? - Files::get($plugin->getConfig('signature'))->fullpath() : - ""; - -// logo -$logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); -$logoAsso = - (null !== $logo_file) ? - Files::get($logo_file->path)->fullpath() : - ""; - -// articles du CGI -$articlesCGI = array(); -foreach ($plugin->getConfig('articlesCGI') as $article) -{ - if ($article->valeur == 1) { - $articlesCGI[] = $article->titre; - } -} - // générer les reçus -$listeFichiers = array(); // fichiers pdf générés +$listeFichiersPDF = array(); foreach ($totalPersonnes as $idPersonne => $personne) { - $html = new RecusHTML( - $nomAsso, - $adresseAsso, - $logoAsso, - $plugin->getConfig('objet_asso'), - $plugin->getConfig('nom_responsable'), - $plugin->getConfig('fonction_responsable'), - $plugin->getConfig('ville_asso'), - $articlesCGI, - $signature - ); + $tpl = new UserTemplate(); + $tpl->setSource(PLUGIN_ROOT . '/templates/recu.skel'); - $html->imprimer_recu( - $_SESSION['annee_recu'], - $personne->id, - $personne->nomPrenom, - $personne->versements, - $personne->adresse, - $personne->codePostal, - $personne->ville + $tpl->assignArray(compact('signature', 'logo_asso', 'texteArticles')); + $tpl->assign('objet_asso', $plugin->getConfig('objet_asso')); + $tpl->assign('nom_responsable', $plugin->getConfig('nom_responsable')); + $tpl->assign('fonction_responsable', $plugin->getConfig('fonction_responsable')); + $tpl->assign('ville_asso', $plugin->getConfig('ville_asso')); + $tpl->assign('annee_recu', $_SESSION['annee_recu']); + $tpl->assign('numero', $personne->id); + $tpl->assign('nom', $personne->nomPrenom); + $tpl->assign('adresse', $personne->adresse); + $tpl->assign('code_postal', $personne->codePostal); + $tpl->assign('ville', $personne->ville); + $tpl->assign('date', date("j/m/Y")); + + // les versements + $tpl->registerSection('versements', + function () use($personne) + { + foreach ($personne->versements as $taux => $montant) + { + $ligne['montant'] = $montant; + $ligne['libelle'] = Utils::getLigneReduction($taux); + yield $ligne; + } + }); + + // mentions complémentaires + $donnees = array( + 'Date des versements : ' => "année " . $_SESSION['annee_recu'], + 'Nature du don : ' => "Numéraire", + 'Mode de versement : ' => "chèque et/ou virement" ); + $infos = array(); + foreach ($donnees as $titre => $libelle) + { + $elem = new \stdClass(); + $elem->titre = $titre; + $elem->libelle = $libelle; + $infos[] = $elem; + } + + $tpl->registerSection('informations', + function () use ($infos) + { + foreach ($infos as $elem) + { + yield (array) $elem; + } + }); + // fabriquer le fichier PDF - $nomPDF = \Garradin\Utils::filePDF($html->get()); + $result = $tpl->fetch(); + $nomPDF = \Garradin\Utils::filePDF($result); // changer le nom du fichier $nom = str_replace(' ', '_', $personne->nomPrenom); $nom = str_replace("'", "", $nom); $nomFichier = "recu_" . $_SESSION['annee_recu'] . "_" . $nom . ".pdf"; rename($nomPDF, $nomFichier); // ajouter le nom du fichier à la liste pour mettre dans une archive - $listeFichiers[] = $nomFichier; + $listeFichiersPDF[] = $nomFichier; } // faire une archive zip $fichierZip = Utils::makeArchive( - $listeFichiers, + $listeFichiersPDF, $_SESSION['annee_recu'], PLUGIN_ROOT . "/zip" ); @@ -114,7 +161,7 @@ function cumulerVersementsPersonne($versements) { $totalPersonnes[$idPersonneCourant]->ajouterVersement( $_SESSION['taux_reduction'], - $totalVersements/100 + $totalVersements ); } $idPersonneCourant = $ligne->idUser; @@ -132,7 +179,7 @@ function cumulerVersementsPersonne($versements) // et le dernier $totalPersonnes[$idPersonneCourant]->ajouterVersement( $_SESSION['taux_reduction'], - $totalVersements/100 + $totalVersements ); return $totalPersonnes; } @@ -160,7 +207,7 @@ function cumulerVersementsTarif($versements) // changement de tarif ou de personne $totalPersonnes[$idPersonneCourant]->ajouterVersement( $_SESSION['tauxSelectionnes'][$idTarifCourant], - $totalVersements/100 + $totalVersements ); } $idTarifCourant = $ligne->idTarif; @@ -179,7 +226,7 @@ function cumulerVersementsTarif($versements) // et le dernier $totalPersonnes[$idPersonneCourant]->ajouterVersement( $_SESSION['tauxSelectionnes'][$idTarifCourant], - $totalVersements/100 + $totalVersements ); return $totalPersonnes; } From 78f6a982a42b49fa966ae1af394ac242f066854d Mon Sep 17 00:00:00 2001 From: engel <> Date: Mon, 4 Apr 2022 09:37:17 +0000 Subject: [PATCH 042/137] =?UTF-8?q?modifications=20cosm=C3=A9tiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 0bc8dabc0b76bcea1f097568ec9a986e27e314e6f3bd90cb756f6717a42af107 --- www/admin/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/admin/script.js b/www/admin/script.js index 0957a3b..f97f5c9 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -10,8 +10,8 @@ function cocherDecocherTout(idCaseGlobale) for (var i = 0; i < lesDetails.length; ++i) { // itérer sur les personnes - var lesH3 = lesDetails[i].querySelectorAll("h4.personne"); - cocherDecocherLesPersonnes(idCaseGlobale, lesH3); + var lesPersonnes = lesDetails[i].querySelectorAll("h4.personne"); + cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); } // changer le message changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); @@ -22,8 +22,8 @@ function cocherDecocherTout(idCaseGlobale) */ function cocherDecocherToutesLesPersonnes(idCaseGlobale) { - var lesH3 = document.querySelectorAll("h4.personne"); - cocherDecocherLesPersonnes(idCaseGlobale, lesH3); + var lesPersonnes = document.querySelectorAll("h4.personne"); + cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); } From bbfba688c6ffb9b03a778c64cb73eaf526e1f035 Mon Sep 17 00:00:00 2001 From: engel <> Date: Sun, 24 Apr 2022 12:07:36 +0000 Subject: [PATCH 043/137] =?UTF-8?q?ajout=20bouton=20g=C3=A9n=C3=A9rer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: c4ee1e2f9ebe9c1a99adb825034569a4274d92e953df1a30475210c08bc3aa28 --- lib/Personne.php | 12 +-- lib/Utils.php | 164 +++++++++++++++++++---------- templates/versements_activites.tpl | 1 + templates/versements_personnes.tpl | 1 + www/admin/versements_personnes.php | 70 +++++++++++- 5 files changed, 187 insertions(+), 61 deletions(-) diff --git a/lib/Personne.php b/lib/Personne.php index 9a10979..31b4344 100644 --- a/lib/Personne.php +++ b/lib/Personne.php @@ -8,28 +8,28 @@ namespace Garradin\Plugin\RecusFiscaux; class Personne { public $id; + public $rang; // par ordre alpha de nomPrenom ; sert aux tris public $nomPrenom; public $adresse; public $codePostal; public $ville; - public $courriel; public $versements; // versements par taux de réduction public function __construct( $id, + $rang, $nomPrenom, $adresse, $codePostal, - $ville, - $courriel = "" + $ville ) { $this->id = $id; + $this->rang = $rang; $this->nomPrenom = $nomPrenom; $this->adresse = $adresse; $this->codePostal = $codePostal; $this->ville = $ville; - $this->courriel = $courriel; $this->versements = array(); // clé = tarif, valeur = montant } @@ -40,11 +40,11 @@ class Personne { return new Personne( $this->id, + $this->rang, $this->nomPrenom, $this->adresse, $this->codePostal, - $this->ville, - $this->courriel); + $this->ville); } /** diff --git a/lib/Utils.php b/lib/Utils.php index d2c3400..7d7dc29 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -111,40 +111,135 @@ class Utils /** * @return versements correspondants à l'année et aux comptes donnés * @param $annee + * @param $op : opérateur de combinaison des comptes * @param array $comptes * @param array $champsNom : liste non vide des champs de nom/prénom + * exemples : + * op = 'in', comptes = ['706', '7780', '756'] + * op = 'like', comptes = '7%' */ - public static function getVersementsComptes($annee, $comptes, $champsNom) + public static function getVersementsComptes($annee, $op, $comptes, $champsNom) { $db = DB::getInstance(); $tri = Utils::combinerTri($champsNom); $sql = sprintf( 'SELECT - acc_accounts.code as compte, - membres.id as idUser, - acc_transactions_lines.credit as versement, - acc_transactions.date + services_fees.id as idTarif, + acc_accounts.code as compte, + membres.id as idUser, + acc_transactions_lines.credit as versement, + acc_transactions.date FROM acc_transactions_users - INNER JOIN membres on acc_transactions_users.id_user = membres.id - INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id - INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id - INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id + INNER JOIN membres + ON acc_transactions_users.id_user = membres.id + INNER JOIN acc_transactions + ON acc_transactions_users.id_transaction = acc_transactions.id + INNER JOIN services_users + ON acc_transactions_users.id_service_user = services_users.id + INNER JOIN services_fees + ON services_users.id_fee = services_fees.id + INNER JOIN acc_transactions_lines + ON acc_transactions_lines.id_transaction = acc_transactions.id + INNER JOIN acc_accounts + ON acc_transactions_lines.id_account = acc_accounts.id WHERE - (strftime(%s, acc_transactions.date) = "%d" + (strftime(%s, acc_transactions.date) = "%d" AND - acc_accounts.%s + acc_accounts.%s AND - acc_transactions_lines.credit > 0) - ORDER by acc_accounts.code, %s, acc_transactions.date', + acc_transactions_lines.credit > 0) + ORDER by %s, acc_transactions.date', '"%Y"', $annee, - $db->where('code', $comptes), + $db->where('code', $op, $comptes), $tri ); return $db->get($sql); } /** + * @return personnes ayant versé des dons pour une année donnée + * @param $annee + * @param array $champsNom : champs qui définissent le nom et le prénom d'une personne + */ + public static function getDonateurs($annee, $champsNom) : array + { + // concaténer les champs nom/prénoms pour la sélection + $nom = Utils::combinerChamps($champsNom); + // et pour le tri + $tri = Utils::combinerTri($champsNom); + $sql = sprintf( + 'SELECT + membres.id as idUser, + row_number() over(order by %s) as rang, + %s as nom, + membres.adresse as adresse, + membres.code_postal as codePostal, + membres.ville as ville + FROM + acc_transactions_users, + membres, + acc_transactions + INNER JOIN acc_transactions_lines + ON acc_transactions_lines.id_transaction = acc_transactions.id + WHERE ( + strftime(%s, acc_transactions.date) = "%d" + AND + acc_transactions_lines.credit > 0 + AND + acc_transactions_users.id_transaction = acc_transactions.id + AND + acc_transactions_users.id_user = membres.id + ) + GROUP by membres.id + ORDER by %1$s COLLATE U_NOCASE + ', + $tri, + $nom, + '"%Y"', + $annee + ); + // error_log("getDonateurs = " . print_r($sql, true)); + $donateurs = array(); + foreach (DB::getInstance()->iterate($sql) as $personne) + { + $donateurs[$personne->idUser] = new Personne($personne->idUser, + $personne->rang, + $personne->nom, + $personne->adresse, + $personne->codePostal, + $personne->ville); + } + return $donateurs; + } + + /** + * combiner les champs avec un opérateur + * @param array $champs : liste (non vide) de champs + * @return chaîne combinée + */ + private static function combinerChamps($champs) + { + $op = ' || " " || '; + $result = 'ifnull(membres.' . $champs[0] . ', "")'; + for ($i = 1; $i < count($champs); ++$i) + { + $result .= $op . 'ifnull(membres.' . $champs[$i] . ', "")'; + } + return 'trim(' . $result . ')'; + } + + private static function combinerTri($champs) + { + $tri = 'membres.' . $champs[0]; + for ($i = 1; $i < count($champs); ++$i) + { + $tri .= ', membres.' . $champs[$i]; + } + return $tri; + } + + /** OBSOLETE * Versements totaux par personne pour une année donnée * @param année * @param array $champsNom : liste non vide des champs de nom/prénom @@ -179,38 +274,7 @@ class Utils return DB::getInstance()->get($sql); } - /** - * combiner les champs avec un opérateur - * @param array $champs : liste (non vide) de champs - * @return chaîne combinée - */ - private static function combinerChamps($champs) - { - $op = ' || " " || '; - $result = 'ifnull(membres.' . $champs[0] . ', "")'; - for ($i = 1; $i < count($champs); ++$i) - { - $result .= $op . 'ifnull(membres.' . $champs[$i] . ', "")'; - } - return $result; - } - - private static function combinerTri($champs) - { - $tri = 'membres.' . $champs[0]; - for ($i = 1; $i < count($champs); ++$i) - { - $tri .= ', membres.' . $champs[$i]; - } - return $tri; - } - - /** - * @return personnes ayant versé des dons pour une année donnée - * @param $annee - * @param array $champsNom : champs qui définissent le nom et le prénom d'une personne - */ - public static function getDonateurs($annee, $champsNom) : array + public static function getDonateurs_old($annee, $champsNom) : array { // concaténer les champs nom/prénoms pour la sélection $nom = 'trim(' . Utils::combinerChamps($champsNom) . ') as nom,'; @@ -258,17 +322,11 @@ class Utils { foreach ($lesTaux as $elem) { - /* - $ligne = "taux " . $elem->taux . ", ligne " . $elem->ligne; - if ($elem->remarque != "") { - $ligne .= ", " . $elem->remarque; - } - $lignes[$elem->taux] = $ligne; - */ $lignes[$elem->taux] = $elem->remarque; } return $lignes; } + public static function getLigneReduction($taux) { return $_SESSION['ligneReduction'][$taux]; diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 6762f0e..1abcd10 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -8,6 +8,7 @@ + diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index cae6d14..de7c87d 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -8,6 +8,7 @@ onclick="cocherDecocherToutesLesPersonnes(check_global)" /> + diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 56376a0..1a16cca 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -8,8 +8,74 @@ use Garradin\Plugin\RecusFiscaux\Utils; $_SESSION['taux_reduction'] = $_POST['taux_reduction']; // versements par personne -$_SESSION['lesVersements'] = Utils::getVersementsPersonnes($_SESSION['annee_recu'], - $champsNom); +$_SESSION['lesVersements'] = Utils::getVersementsComptes($_SESSION['annee_recu'], + "like", + '7%', + $champsNom); + + // Utils::getVersementsPersonnes($_SESSION['annee_recu'], + // $champsNom); + +// ------------------------------------------------------------------------ +// tests +// ------------------------------------------------------------------------ +/* +$versementsComptes = Utils::getVersementsComptes("2021", + // "in", + // ['706', '7780', '756'], + "like", + '7%', + $champsNom); +// table triée par nom, date +// error_log("versementsComptes triée par nom, date = " . print_r($versementsComptes, true)); + +// comparer 2 lignes selon le nom +function comparerNoms($ligne1, $ligne2) +{ + return + $_SESSION['membresDonateurs'][$ligne1->idUser]->rang + - + $_SESSION['membresDonateurs'][$ligne2->idUser]->rang; +} + +// comparer 2 lignes selon la date +function comparerDate($ligne1, $ligne2) +{ + return + strtotime($ligne1->date) - strtotime($ligne2->date); +} + +// comparer 2 lignes selon un champ +function comparerChamp($ligne1, $ligne2, $champ) +{ + return $ligne1->$champ - $ligne2->$champ; +} + +// autres tris +// par tarif, nom, date +usort($versementsComptes, function($ligne1, $ligne2) +{ + $result = comparerChamp($ligne1, $ligne2, 'idTarif'); //$ligne1->idTarif - $ligne2->idTarif; + if ($result == 0) { $result = comparerNoms($ligne1, $ligne2); } + if ($result == 0) { $result = comparerDate($ligne1, $ligne2); } + return $result; +}); +// error_log("versementsComptes triée par tarif, nom, date = " . print_r($versementsComptes, true)); + +// par nom, compte, date... +usort($versementsComptes, function($ligne1, $ligne2) +{ + $result = comparerNoms($ligne1, $ligne2); + if ($result == 0) { $result = comparerChamp($ligne1, $ligne2, 'compte'); } + if ($result == 0) { $result = comparerDate($ligne1, $ligne2); } + return $result; +}); + +// error_log("versementsComptes triée par nom, compte, date = " . print_r($versementsComptes, true)); +*/ +// ------------------------------------------------------------------------ +// fin tests +// ------------------------------------------------------------------------ // préparation de l'affichage $tpl->assign('lesVersements', $_SESSION['lesVersements']); From 6533f9d1b44ad6fbb202a3128c6a99a895087c56 Mon Sep 17 00:00:00 2001 From: engel <> Date: Sun, 24 Apr 2022 19:07:09 +0000 Subject: [PATCH 044/137] =?UTF-8?q?ajout=20bouton=20g=C3=A9n=C3=A9rer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: bf5d9a934a53a3937daab7d8f75707bf62ec255b57bf074d5f0752c7ba947c91 --- templates/versements_activites.tpl | 1 + templates/versements_personnes.tpl | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 6762f0e..1abcd10 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -8,6 +8,7 @@ + diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index cae6d14..de7c87d 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -8,6 +8,7 @@ onclick="cocherDecocherToutesLesPersonnes(check_global)" /> + From 4b4cd9111002ff3c189e8fd1b90600dcc7bb39da Mon Sep 17 00:00:00 2001 From: engel <> Date: Mon, 25 Apr 2022 06:53:47 +0000 Subject: [PATCH 045/137] =?UTF-8?q?simplification=20pr=C3=A9sentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 7a7f325fb3557295b7c06f70c4e493155a76e7021000f49c2416470ac46312b6 --- www/admin/action.php | 25 +++++++++++++------------ www/admin/script.js | 26 ++++++++++++-------------- www/admin/style.css | 8 ++++++-- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/www/admin/action.php b/www/admin/action.php index 53bce04..d96bf12 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -71,25 +71,26 @@ $tpl->register_function('afficher_debut_personne', function ($params) $personne = $_SESSION['membresDonateurs'][$idUser]; $out = '
    - '; - $out .= sprintf('

    Versements de %s : 0,00 €

    ', - $personne->nomPrenom, - $idVersement); - $out .= '
    '; + +

    '; $out .= sprintf(' -
    ', - $idVersement); - $out .= sprintf(' - ', $idVersement, $idVersement); $out .= sprintf(' - ', + ', $idVersement); - $out .= '
    -
    '; + $out .= sprintf('%s : 0,00 €', + $personne->nomPrenom, + $idVersement); + $out .= '

    '; + $out .= sprintf(' +
    ', + $idVersement); + // $out .= '
    + //
    '; return $out; }); diff --git a/www/admin/script.js b/www/admin/script.js index f97f5c9..c122c92 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -1,3 +1,5 @@ +"use strict"; + /** * Fonction appelée quand on (dé)coche la case de sélection globale * (dé)sélectionner toutes les cases à cocher de toutes les activités @@ -19,7 +21,7 @@ function cocherDecocherTout(idCaseGlobale) /** * idem dans le cas des versements des personnes -*/ + */ function cocherDecocherToutesLesPersonnes(idCaseGlobale) { var lesPersonnes = document.querySelectorAll("h4.personne"); @@ -34,11 +36,10 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) // trouver l'élément total de la personne var idTotal = lesPersonnes[j].querySelector("span"); // puis la case à cocher - var fieldset = lesPersonnes[j].closest("details").querySelector("fieldset"); - var idCase = fieldset.querySelector("input"); + var idCase = lesPersonnes[j].closest("summary").querySelector("input"); idCase.checked = idCaseGlobale.checked; // puis traiter toutes les cases de la personne - cocherDecocherPersonne(idCase, idTotal, false); + cocherDecocherPersonne(idCase, idTotal); } } @@ -49,9 +50,8 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) * * @param id de la case qui a été cochée * @param id de l'élément où afficher le total - * @param changer : vrai, s'il faut changer le message de la personne */ -function cocherDecocherPersonne(idCase, idTotal, changer = true) +function cocherDecocherPersonne(idCase, idTotal) { // chercher le fieldset des versements var fieldset = idCase.closest("details").querySelector("fieldset"); @@ -63,8 +63,6 @@ function cocherDecocherPersonne(idCase, idTotal, changer = true) // calculer et afficher le total var listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); - // changer le message - if (changer) { changerMessage(idCase.nextElementSibling, idCase); } } /** @@ -87,17 +85,17 @@ function cocherDecocherVersement(idCase, idTotal) * @param listes des cases * @param listes des montants associés * @param id de l'élément où afficher le total -*/ + */ function calculerTotal(listeCases, listeMontants, idTotal) { var total = 0; - for (var i = 1; i < listeCases.length; ++i) + for (var i = 0; i < listeCases.length; ++i) { if (listeCases[i].checked) { - total += parseFloat(listeMontants[i-1].textContent.replace(/\s/g, "")); + total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "")); } } - // "afficher" le total + // afficher le total idTotal.innerHTML = total.toLocaleString('fr-FR', {style: 'currency', currency: 'EUR', minimumFractionDigits: 2}); @@ -105,7 +103,7 @@ function calculerTotal(listeCases, listeMontants, idTotal) /** * changer le message en fonction de l'état coché de la case -*/ + */ function changerMessage(message, idCase) { if (idCase.checked) { @@ -119,7 +117,7 @@ function changerMessage(message, idCase) * fonction appelée lors de la validation du formulaire * @return vrai si au moins un choix a été fait * @param : formulaire -*/ + */ function verifierChoix(formulaire) { var listeCheck = formulaire.getElementsByTagName("input"); diff --git a/www/admin/style.css b/www/admin/style.css index f5ab0ef..ccbf4a9 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -26,15 +26,19 @@ span.total { font-weight : bold; } -summary.activite { +summary.activite +{ background: rgba(var(--gMainColor), 0.25); margin-bottom : 0.5em; } summary.personne { margin-bottom : 0.5em; + padding-top : 0; + padding-bottom : 0; } -h3.personne, h4.personne { +h3.personne, h4.personne +{ font-weight : normal; background: rgba(var(--gSecondColor), 0.15); } From 9b20a54f43c27ecd7f7ce6e715f8fee98784428c Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 27 Apr 2022 11:42:45 +0000 Subject: [PATCH 046/137] modernisation code FossilOrigin-Name: 3f69a7f4de9baf3dec9ba1b83b2affdfaaa5337c424d31a5298dfc39913e1cd7 --- lib/Utils.php | 59 ++++++++++++--------- www/admin/script.js | 123 +++++++++++++++++++++++++++----------------- 2 files changed, 113 insertions(+), 69 deletions(-) diff --git a/lib/Utils.php b/lib/Utils.php index d2c3400..0080075 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -9,9 +9,9 @@ class Utils { /** * @return tarifs demandés - * @param array $tarifs + * @param $tarifs */ - public static function getTarifs($tarifs) + public static function getTarifs(array $tarifs) : array { $db = DB::getInstance(); $sql = sprintf( @@ -24,9 +24,9 @@ class Utils /** * @return activités correspondant aux tarifs demandés - * @param array $tarifs + * @param $tarifs */ - public static function getActivites($tarifs) + public static function getActivites(array $tarifs) : array { $db = DB::getInstance(); $sql = sprintf( @@ -42,9 +42,9 @@ class Utils /** * @return versements correspondants à l'année donnée * @param $annee - * @param array $champsNom : liste non vide des champs de nom/prénom + * @param $champsNom : liste non vide des champs de nom/prénom */ - public static function getVersementsPersonnes($annee, $champsNom) + public static function getVersementsPersonnes($annee, array $champsNom) : array { $db = DB::getInstance(); $tri = Utils::combinerTri($champsNom); @@ -74,10 +74,12 @@ class Utils * @return versements correspondants à l'année et aux tarifs donnés * triés par tarif, nom, date * @param $annee - * @param array $tarifs - * @param array $champsNom : liste non vide des champs de nom/prénom + * @param $tarifs + * @param $champsNom : liste non vide des champs de nom/prénom */ - public static function getVersementsTarifs($annee, $tarifs, $champsNom) + public static function getVersementsTarifs($annee, + array $tarifs, + array $champsNom) : array { $db = DB::getInstance(); $tri = Utils::combinerTri($champsNom); @@ -111,10 +113,12 @@ class Utils /** * @return versements correspondants à l'année et aux comptes donnés * @param $annee - * @param array $comptes - * @param array $champsNom : liste non vide des champs de nom/prénom + * @param $comptes + * @param $champsNom : liste non vide des champs de nom/prénom */ - public static function getVersementsComptes($annee, $comptes, $champsNom) + public static function getVersementsComptes($annee, + array $comptes, + array $champsNom) : array { $db = DB::getInstance(); $tri = Utils::combinerTri($champsNom); @@ -147,9 +151,9 @@ class Utils /** * Versements totaux par personne pour une année donnée * @param année - * @param array $champsNom : liste non vide des champs de nom/prénom + * @param $champsNom : liste non vide des champs de nom/prénom */ - public static function getVersementsTotaux($annee, $champsNom) + public static function getVersementsTotaux($annee, array $champsNom) : array { $tri = Utils::combinerTri($champsNom); $sql = sprintf( @@ -181,10 +185,10 @@ class Utils /** * combiner les champs avec un opérateur - * @param array $champs : liste (non vide) de champs + * @param $champs : liste (non vide) de champs * @return chaîne combinée */ - private static function combinerChamps($champs) + private static function combinerChamps(array $champs) : string { $op = ' || " " || '; $result = 'ifnull(membres.' . $champs[0] . ', "")'; @@ -195,7 +199,12 @@ class Utils return $result; } - private static function combinerTri($champs) + /** + * combiner les clés de tri + * @param clés de tri + * @return chaîne combinée + */ + private static function combinerTri(array $champs) : string { $tri = 'membres.' . $champs[0]; for ($i = 1; $i < count($champs); ++$i) @@ -208,9 +217,9 @@ class Utils /** * @return personnes ayant versé des dons pour une année donnée * @param $annee - * @param array $champsNom : champs qui définissent le nom et le prénom d'une personne + * @param $champsNom : champs qui définissent le nom et le prénom d'une personne */ - public static function getDonateurs($annee, $champsNom) : array + public static function getDonateurs($annee, array $champsNom) : array { // concaténer les champs nom/prénoms pour la sélection $nom = 'trim(' . Utils::combinerChamps($champsNom) . ') as nom,'; @@ -254,7 +263,10 @@ class Utils return $donateurs; } - public static function getLignesReduction($lesTaux) + /** + * renvoie un tableau avec les remarques de chaque taux de réduction + */ + public static function getLignesReduction(array $lesTaux) : array { foreach ($lesTaux as $elem) { @@ -269,13 +281,14 @@ class Utils } return $lignes; } + public static function getLigneReduction($taux) { return $_SESSION['ligneReduction'][$taux]; } /** - * @return liste de toutes les activités, tarifs et comptes associés + * @return array liste de toutes les activités, tarifs et comptes associés */ public static function getActivitesTarifsEtComptes() { @@ -297,7 +310,7 @@ class Utils } /** - * @return liste des années fiscales + * @return array liste des années fiscales */ public static function getAnneesFiscales() : array { @@ -317,7 +330,7 @@ class Utils * récupérer dans la config du plugin les champs des membres * utilisés pour le nom et le prénom ; ajouter/supprimer les * modifications par rapport à la config garradin - * @return tableau des champs : clé = nom, valeur = { titre, position } + * @return array tableau des champs : clé = nom, valeur = { titre, position } */ public static function getChampsNom($config, $plugin) : array { diff --git a/www/admin/script.js b/www/admin/script.js index c122c92..8be4be6 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -3,16 +3,16 @@ /** * Fonction appelée quand on (dé)coche la case de sélection globale * (dé)sélectionner toutes les cases à cocher de toutes les activités - * @param id de la case globale + * @param {HTMLInputElement} idCaseGlobale id de la case globale */ function cocherDecocherTout(idCaseGlobale) { // itérer sur la liste des éléments détails : 1 par couple - var lesDetails = document.querySelectorAll("details.activite"); - for (var i = 0; i < lesDetails.length; ++i) + let lesDetails = document.querySelectorAll("details.activite"); + for (let i = 0; i < lesDetails.length; ++i) { // itérer sur les personnes - var lesPersonnes = lesDetails[i].querySelectorAll("h4.personne"); + let lesPersonnes = lesDetails[i].querySelectorAll("h4.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); } // changer le message @@ -21,22 +21,27 @@ function cocherDecocherTout(idCaseGlobale) /** * idem dans le cas des versements des personnes + * @param {HTMLInputElement} idCaseGlobale id de la case globale */ function cocherDecocherToutesLesPersonnes(idCaseGlobale) { - var lesPersonnes = document.querySelectorAll("h4.personne"); + let lesPersonnes = document.querySelectorAll("h4.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); } +/** + * @param {HTMLInputElement} idCaseGlobale + * @param {NodeListOf} lesPersonnes + */ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) { - for (var j = 0; j < lesPersonnes.length; ++j) + for (let j = 0; j < lesPersonnes.length; ++j) { // trouver l'élément total de la personne - var idTotal = lesPersonnes[j].querySelector("span"); + let idTotal = lesPersonnes[j].querySelector("span"); // puis la case à cocher - var idCase = lesPersonnes[j].closest("summary").querySelector("input"); + let idCase = lesPersonnes[j].closest("summary").querySelector("input"); idCase.checked = idCaseGlobale.checked; // puis traiter toutes les cases de la personne cocherDecocherPersonne(idCase, idTotal); @@ -47,21 +52,20 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) * Fonction appelée quand on (dé)coche la case globale d'une personne * - (dé)sélectionner toutes les cases à cocher * - faire le total des cases cochées et l'afficher - * - * @param id de la case qui a été cochée - * @param id de l'élément où afficher le total + * @param {HTMLInputElement} idCase id de la case qui a été cochée + * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ function cocherDecocherPersonne(idCase, idTotal) { // chercher le fieldset des versements - var fieldset = idCase.closest("details").querySelector("fieldset"); - var listeCases = fieldset.querySelectorAll("input[type=checkbox]"); - for (var i = 0; i < listeCases.length; ++i) + let fieldset = idCase.closest("details").querySelector("fieldset"); + let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); + for (let i = 0; i < listeCases.length; ++i) { listeCases[i].checked = idCase.checked; } // calculer et afficher le total - var listeMontants = fieldset.querySelectorAll("span.montant"); + let listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); } @@ -69,27 +73,27 @@ function cocherDecocherPersonne(idCase, idTotal) * Fonction appelée quand on (dé)coche la case d'un versement * Faire le total des cases cochées et l'afficher * - * @param id de la case qui a été cochée - * @param id de l'élément où afficher le total + * @param {HTMLInputElement} idCase id de la case qui a été cochée + * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ function cocherDecocherVersement(idCase, idTotal) { - var fieldset = idCase.closest("fieldset"); - var listeCases = fieldset.querySelectorAll("input[type=checkbox]"); - var listeMontants = fieldset.querySelectorAll("span.montant"); + let fieldset = idCase.closest("fieldset"); + let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); + let listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); } /** * Faire le total des cases cochées et l'afficher - * @param listes des cases - * @param listes des montants associés - * @param id de l'élément où afficher le total + * @param {NodeListOf} listeCases liste des cases + * @param {NodeListOf} listeMontants liste des montants associés + * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ function calculerTotal(listeCases, listeMontants, idTotal) { - var total = 0; - for (var i = 0; i < listeCases.length; ++i) + let total = 0; + for (let i = 0; i < listeCases.length; ++i) { if (listeCases[i].checked) { total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "")); @@ -103,6 +107,8 @@ function calculerTotal(listeCases, listeMontants, idTotal) /** * changer le message en fonction de l'état coché de la case + * @param {Element} message + * @param {HTMLInputElement} idCase */ function changerMessage(message, idCase) { @@ -116,13 +122,13 @@ function changerMessage(message, idCase) /** * fonction appelée lors de la validation du formulaire * @return vrai si au moins un choix a été fait - * @param : formulaire + * @param {HTMLFormElement} formulaire */ function verifierChoix(formulaire) { - var listeCheck = formulaire.getElementsByTagName("input"); - var ok = false; - for (var i = 1; i < listeCheck.length; ++i) + let listeCheck = formulaire.getElementsByTagName("input"); + let ok = false; + for (let i = 1; i < listeCheck.length; ++i) { if (listeCheck[i].checked) { @@ -137,39 +143,55 @@ function verifierChoix(formulaire) return ok; } +/** + * afficher et masquer des portions de formulaire selon l'action + * @param {HTMLFormElement} formulaire + * @param {string} action après envoi du formulaire + * @param {any} nomClasse1 classe des éléments à afficher + * @param {any} nomClasse2 classe des éléments à masquer + */ function choixMethodeGeneration(formulaire, action, nomClasse1, nomClasse2) { formulaire.setAttribute('action', 'action.php?action=' + action); afficherMasquer(formulaire, nomClasse1, nomClasse2); } +/** + * afficher et masquer des portions de formulaire + * @param {HTMLFormElement} formulaire + * @param {any} nomClasse1 classe des éléments à afficher + * @param {any} nomClasse2 classe des éléments à masquer + */ function afficherMasquer(formulaire, nomClasse1, nomClasse2) { - for (var elem of formulaire.querySelectorAll(nomClasse1)) { + for (let elem of formulaire.querySelectorAll(nomClasse1)) { elem.classList.remove('hidden'); } - for (var elem of formulaire.querySelectorAll(nomClasse2)) { + for (let elem of formulaire.querySelectorAll(nomClasse2)) { elem.classList.add('hidden'); } } -// vérifier -// - qu'au moins une activité/tarif est sélectionnée -// - qu'un radio de chaque activité/tarif sélectionné a été sélectionné :) +/** + * vérifier + * - qu'au moins une activité/tarif est sélectionnée + * - qu'un radio de chaque activité/tarif sélectionné a été sélectionné :) + * @param {string} idElem id du conteneur des cases à vérifier + */ function verifierCases(idElem) { - var div = document.getElementById(idElem); - var nbChoix = 0; + let div = document.getElementById(idElem); + let nbChoix = 0; // parcourir les cases à cocher - for (var idCase of div.querySelectorAll("input[type=checkbox]")) + for (let idCase of div.querySelectorAll("input[type=checkbox]")) { if (idCase.checked) { ++nbChoix; // vérifier qu'un radio de la même ligne est sélectionné - var ligneCorrecte = false; + let ligneCorrecte = false; // trouver la ligne englobante - var ligne = idCase.closest("tr"); - for (var idRadio of ligne.querySelectorAll('input[type=radio]')) + let ligne = idCase.closest("tr"); + for (let idRadio of ligne.querySelectorAll('input[type=radio]')) { if (idRadio.checked) { ligneCorrecte = true; break; } } @@ -185,24 +207,33 @@ function verifierCases(idElem) return nbChoix != 0; } -// vérifier qu'un radio a été sélectionné dans la div paramètre +/** + * vérifier qu'un radio a été sélectionné dans la div paramètre + * @param {string} idElem id du conteneur des radios à vérifier + */ function verifierRadio(idElem) { - var div = document.getElementById(idElem); - for (var idRadio of div.querySelectorAll('input[type=radio]')) + let div = document.getElementById(idElem); + for (let idRadio of div.querySelectorAll('input[type=radio]')) { if (idRadio.checked) { return true; } } alert("Erreur : il faut sélectionner un taux de réduction"); - return false; + return false; } +/** + * afficher/masquer les détails + * @param {string} idElem bouton de masquage/affichage + * @param {string} classe des détails à afficher/masquer + * @param {string} texte du bouton + */ function montrerMasquerDetails(idElem, classe, texte) { - var lesDetails = document.querySelectorAll(classe); + let lesDetails = document.querySelectorAll(classe); if (lesDetails.length > 0) { - var leBouton = document.getElementById(idElem); + let leBouton = document.getElementById(idElem); if (leBouton.textContent.startsWith('Replier')) { // masquer From c51bc9a97f3b83b35749dbdf6e2eb7293942fbfd Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 27 Apr 2022 13:14:27 +0000 Subject: [PATCH 047/137] =?UTF-8?q?am=C3=A9liorations=20cosm=C3=A9tiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 7d5cb4f8bf9819281d67cc67f69d1894a1f4e6480b74d52c761f43dbf5d358bb --- templates/versements_activites.tpl | 16 ++++++++++------ templates/versements_personnes.tpl | 28 +++++++++++++++++----------- www/admin/style.css | 15 +++++---------- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 1abcd10..c91b289 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -14,8 +14,9 @@ {* Itération sur les versements *} - {foreach from=$lesVersements key="i" item="versement"} - {if $i == 0} + + {foreach from=$lesVersements item="versement"} + {if $rang == 0} {* premier versement *} idTarif; @@ -23,7 +24,7 @@ ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {else} {* autre versement *} {if $versement.idTarif != $tarifCourant} @@ -32,26 +33,29 @@
    {* fin versements d'une personne *} {* fin tarif *} idTarif; $personneCourante = $versement->idUser; ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} + idUser; ?> {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {/if} {/if} + {/foreach} {* Itération sur les versements *} {* fin versements d'une personne *} {* fin versements d'une personne *} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index de7c87d..519b471 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -4,37 +4,43 @@

    Versements par personne

    - - - - + + + +
    {* Itération sur les personnes *} + {foreach from=$lesVersements key="i" item="versement"} - {if $i == 0} + {if $rang == 0} {* 1ère personne *} idUser; + $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} + idUser; + $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} {/if} + {/foreach} {* Itération sur les personnes *} diff --git a/www/admin/style.css b/www/admin/style.css index ccbf4a9..7253822 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -1,15 +1,10 @@ /* liste des versements */ -div.pair { - padding : 0.1em; - background: rgba(var(--gSecondColor), 0.2); -} div.impair { - padding : 0.1em; + background: rgba(var(--gSecondColor), 0.15); } fieldset { - border:1px solid brown; - -webkit-border-radius:8px; - border-radius:8px; + -webkit-border-radius:8px; + border-radius:8px; } div span { padding-left : 0.5em; @@ -28,7 +23,7 @@ span.total } summary.activite { - background: rgba(var(--gMainColor), 0.25); + background: rgba(var(--gSecondColor), 0.5); margin-bottom : 0.5em; } summary.personne @@ -40,7 +35,7 @@ summary.personne h3.personne, h4.personne { font-weight : normal; - background: rgba(var(--gSecondColor), 0.15); + background: rgba(var(--gSecondColor), 0.25); } #signature { From 3bbe2e4ac9cb20d149a238e644cfcc79980f93d6 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 27 Apr 2022 13:29:13 +0000 Subject: [PATCH 048/137] =?UTF-8?q?am=C3=A9liorations=20cosm=C3=A9tiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 27cde9941860c65a47879f2726b83247dbe8baeba28066f63be07e8c6eed3e4e --- templates/versements_activites.tpl | 16 ++++++++++------ templates/versements_personnes.tpl | 13 ++++++++----- www/admin/style.css | 20 +++++++++----------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 1abcd10..c91b289 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -14,8 +14,9 @@ {* Itération sur les versements *} - {foreach from=$lesVersements key="i" item="versement"} - {if $i == 0} + + {foreach from=$lesVersements item="versement"} + {if $rang == 0} {* premier versement *} idTarif; @@ -23,7 +24,7 @@ ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {else} {* autre versement *} {if $versement.idTarif != $tarifCourant} @@ -32,26 +33,29 @@ {* fin versements d'une personne *} {* fin tarif *} idTarif; $personneCourante = $versement->idUser; ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} + idUser; ?> {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} {/if} {/if} + {/foreach} {* Itération sur les versements *} {* fin versements d'une personne *} {* fin versements d'une personne *} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index de7c87d..cb1f926 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -14,27 +14,30 @@ {* Itération sur les personnes *} - {foreach from=$lesVersements key="i" item="versement"} - {if $i == 0} + + {foreach from=$lesVersements item="versement"} + {if $rang == 0} {* 1ère personne *} idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} + idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$i} + {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} {/if} + {/foreach} {* Itération sur les personnes *} diff --git a/www/admin/style.css b/www/admin/style.css index f5ab0ef..81dc14d 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -1,15 +1,10 @@ /* liste des versements */ -div.pair { - padding : 0.1em; - background: rgba(var(--gSecondColor), 0.2); -} div.impair { - padding : 0.1em; + background: rgba(var(--gSecondColor), 0.15); } fieldset { - border:1px solid brown; - -webkit-border-radius:8px; - border-radius:8px; + -webkit-border-radius:8px; + border-radius:8px; } div span { padding-left : 0.5em; @@ -26,17 +21,20 @@ span.total { font-weight : bold; } -summary.activite { - background: rgba(var(--gMainColor), 0.25); +summary.activite +{ + background: rgba(var(--gSecondColor), 0.5); margin-bottom : 0.5em; } summary.personne { margin-bottom : 0.5em; + padding-top : 0; + padding-bottom : 0; } h3.personne, h4.personne { font-weight : normal; - background: rgba(var(--gSecondColor), 0.15); + background: rgba(var(--gSecondColor), 0.25); } #signature { From 1888314fa7b3bd347e122c1860959666183bd6d2 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 27 Apr 2022 13:49:23 +0000 Subject: [PATCH 049/137] modernisation code ; simplification affichage FossilOrigin-Name: e1b162c4d12b471d8f71c44e29fcce22c466ce789434c6780d2439bb14f3b761 --- garradin_plugin.ini | 2 +- templates/versements_personnes.tpl | 17 ++-- www/admin/action.php | 21 ++--- www/admin/script.js | 143 +++++++++++++++++------------ www/admin/style.css | 3 +- 5 files changed, 109 insertions(+), 77 deletions(-) diff --git a/garradin_plugin.ini b/garradin_plugin.ini index 3193717..41e3323 100644 --- a/garradin_plugin.ini +++ b/garradin_plugin.ini @@ -2,7 +2,7 @@ nom="Reçus fiscaux" description="Génération de reçus fiscaux pour les dons des membres" auteur="jce" url="https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin" -version="0.6" +version="0.6.4" menu=1 config=1 min_version="1.1" diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index cb1f926..da70472 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -4,11 +4,14 @@

    Versements par personne

    - - - - + + + +
    @@ -19,7 +22,7 @@ {if $rang == 0} {* 1ère personne *} idUser; + $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} @@ -29,7 +32,7 @@ idUser; + $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} diff --git a/www/admin/action.php b/www/admin/action.php index 53bce04..3036d84 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -71,14 +71,8 @@ $tpl->register_function('afficher_debut_personne', function ($params) $personne = $_SESSION['membresDonateurs'][$idUser]; $out = '
    - '; - $out .= sprintf('

    Versements de %s : 0,00 €

    ', - $personne->nomPrenom, - $idVersement); - $out .= '
    '; - $out .= sprintf(' -
    ', - $idVersement); + +

    '; $out .= sprintf(' register_function('afficher_debut_personne', function ($params) $idVersement, $idVersement); $out .= sprintf(' - ', + ', + $idVersement); + $out .= sprintf('%s : 0,00 €', + $personne->nomPrenom, + $idVersement); + $out .= '

    '; + $out .= sprintf(' +
    ', $idVersement); - $out .= '
    -
    '; return $out; }); diff --git a/www/admin/script.js b/www/admin/script.js index f97f5c9..0829d99 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -1,16 +1,18 @@ +"use strict"; + /** * Fonction appelée quand on (dé)coche la case de sélection globale * (dé)sélectionner toutes les cases à cocher de toutes les activités - * @param id de la case globale + * @param {HTMLInputElement} idCaseGlobale id de la case globale */ function cocherDecocherTout(idCaseGlobale) { // itérer sur la liste des éléments détails : 1 par couple - var lesDetails = document.querySelectorAll("details.activite"); - for (var i = 0; i < lesDetails.length; ++i) + let lesDetails = document.querySelectorAll("details.activite"); + for (let i = 0; i < lesDetails.length; ++i) { // itérer sur les personnes - var lesPersonnes = lesDetails[i].querySelectorAll("h4.personne"); + let lesPersonnes = lesDetails[i].querySelectorAll("h4.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); } // changer le message @@ -19,26 +21,30 @@ function cocherDecocherTout(idCaseGlobale) /** * idem dans le cas des versements des personnes -*/ + * @param {HTMLInputElement} idCaseGlobale id de la case globale + */ function cocherDecocherToutesLesPersonnes(idCaseGlobale) { - var lesPersonnes = document.querySelectorAll("h4.personne"); + let lesPersonnes = document.querySelectorAll("h4.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); } +/** + * @param {HTMLInputElement} idCaseGlobale + * @param {NodeListOf} lesPersonnes + */ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) { - for (var j = 0; j < lesPersonnes.length; ++j) + for (let j = 0; j < lesPersonnes.length; ++j) { // trouver l'élément total de la personne - var idTotal = lesPersonnes[j].querySelector("span"); + let idTotal = lesPersonnes[j].querySelector("span"); // puis la case à cocher - var fieldset = lesPersonnes[j].closest("details").querySelector("fieldset"); - var idCase = fieldset.querySelector("input"); + let idCase = lesPersonnes[j].closest("summary").querySelector("input"); idCase.checked = idCaseGlobale.checked; // puis traiter toutes les cases de la personne - cocherDecocherPersonne(idCase, idTotal, false); + cocherDecocherPersonne(idCase, idTotal); } } @@ -46,58 +52,54 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) * Fonction appelée quand on (dé)coche la case globale d'une personne * - (dé)sélectionner toutes les cases à cocher * - faire le total des cases cochées et l'afficher - * - * @param id de la case qui a été cochée - * @param id de l'élément où afficher le total - * @param changer : vrai, s'il faut changer le message de la personne + * @param {HTMLInputElement} idCase id de la case qui a été cochée + * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ -function cocherDecocherPersonne(idCase, idTotal, changer = true) +function cocherDecocherPersonne(idCase, idTotal) { // chercher le fieldset des versements - var fieldset = idCase.closest("details").querySelector("fieldset"); - var listeCases = fieldset.querySelectorAll("input[type=checkbox]"); - for (var i = 0; i < listeCases.length; ++i) + let fieldset = idCase.closest("details").querySelector("fieldset"); + let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); + for (let i = 0; i < listeCases.length; ++i) { listeCases[i].checked = idCase.checked; } // calculer et afficher le total - var listeMontants = fieldset.querySelectorAll("span.montant"); + let listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); - // changer le message - if (changer) { changerMessage(idCase.nextElementSibling, idCase); } } /** * Fonction appelée quand on (dé)coche la case d'un versement * Faire le total des cases cochées et l'afficher * - * @param id de la case qui a été cochée - * @param id de l'élément où afficher le total + * @param {HTMLInputElement} idCase id de la case qui a été cochée + * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ function cocherDecocherVersement(idCase, idTotal) { - var fieldset = idCase.closest("fieldset"); - var listeCases = fieldset.querySelectorAll("input[type=checkbox]"); - var listeMontants = fieldset.querySelectorAll("span.montant"); + let fieldset = idCase.closest("fieldset"); + let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); + let listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); } /** * Faire le total des cases cochées et l'afficher - * @param listes des cases - * @param listes des montants associés - * @param id de l'élément où afficher le total -*/ + * @param {NodeListOf} listeCases liste des cases + * @param {NodeListOf} listeMontants liste des montants associés + * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total + */ function calculerTotal(listeCases, listeMontants, idTotal) { - var total = 0; - for (var i = 1; i < listeCases.length; ++i) + let total = 0; + for (let i = 0; i < listeCases.length; ++i) { if (listeCases[i].checked) { - total += parseFloat(listeMontants[i-1].textContent.replace(/\s/g, "")); + total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "")); } } - // "afficher" le total + // afficher le total idTotal.innerHTML = total.toLocaleString('fr-FR', {style: 'currency', currency: 'EUR', minimumFractionDigits: 2}); @@ -105,7 +107,9 @@ function calculerTotal(listeCases, listeMontants, idTotal) /** * changer le message en fonction de l'état coché de la case -*/ + * @param {Element} message + * @param {HTMLInputElement} idCase + */ function changerMessage(message, idCase) { if (idCase.checked) { @@ -118,13 +122,13 @@ function changerMessage(message, idCase) /** * fonction appelée lors de la validation du formulaire * @return vrai si au moins un choix a été fait - * @param : formulaire -*/ + * @param {HTMLFormElement} formulaire + */ function verifierChoix(formulaire) { - var listeCheck = formulaire.getElementsByTagName("input"); - var ok = false; - for (var i = 1; i < listeCheck.length; ++i) + let listeCheck = formulaire.getElementsByTagName("input"); + let ok = false; + for (let i = 1; i < listeCheck.length; ++i) { if (listeCheck[i].checked) { @@ -139,39 +143,55 @@ function verifierChoix(formulaire) return ok; } +/** + * afficher et masquer des portions de formulaire selon l'action + * @param {HTMLFormElement} formulaire + * @param {string} action après envoi du formulaire + * @param {any} nomClasse1 classe des éléments à afficher + * @param {any} nomClasse2 classe des éléments à masquer + */ function choixMethodeGeneration(formulaire, action, nomClasse1, nomClasse2) { formulaire.setAttribute('action', 'action.php?action=' + action); afficherMasquer(formulaire, nomClasse1, nomClasse2); } +/** + * afficher et masquer des portions de formulaire + * @param {HTMLFormElement} formulaire + * @param {any} nomClasse1 classe des éléments à afficher + * @param {any} nomClasse2 classe des éléments à masquer + */ function afficherMasquer(formulaire, nomClasse1, nomClasse2) { - for (var elem of formulaire.querySelectorAll(nomClasse1)) { + for (let elem of formulaire.querySelectorAll(nomClasse1)) { elem.classList.remove('hidden'); } - for (var elem of formulaire.querySelectorAll(nomClasse2)) { + for (let elem of formulaire.querySelectorAll(nomClasse2)) { elem.classList.add('hidden'); } } -// vérifier -// - qu'au moins une activité/tarif est sélectionnée -// - qu'un radio de chaque activité/tarif sélectionné a été sélectionné :) +/** + * vérifier + * - qu'au moins une activité/tarif est sélectionnée + * - qu'un radio de chaque activité/tarif sélectionné a été sélectionné :) + * @param {string} idElem id du conteneur des cases à vérifier + */ function verifierCases(idElem) { - var div = document.getElementById(idElem); - var nbChoix = 0; + let div = document.getElementById(idElem); + let nbChoix = 0; // parcourir les cases à cocher - for (var idCase of div.querySelectorAll("input[type=checkbox]")) + for (let idCase of div.querySelectorAll("input[type=checkbox]")) { if (idCase.checked) { ++nbChoix; // vérifier qu'un radio de la même ligne est sélectionné - var ligneCorrecte = false; + let ligneCorrecte = false; // trouver la ligne englobante - var ligne = idCase.closest("tr"); - for (var idRadio of ligne.querySelectorAll('input[type=radio]')) + let ligne = idCase.closest("tr"); + for (let idRadio of ligne.querySelectorAll('input[type=radio]')) { if (idRadio.checked) { ligneCorrecte = true; break; } } @@ -187,11 +207,14 @@ function verifierCases(idElem) return nbChoix != 0; } -// vérifier qu'un radio a été sélectionné dans la div paramètre +/** + * vérifier qu'un radio a été sélectionné dans la div paramètre + * @param {string} idElem id du conteneur des radios à vérifier + */ function verifierRadio(idElem) { - var div = document.getElementById(idElem); - for (var idRadio of div.querySelectorAll('input[type=radio]')) + let div = document.getElementById(idElem); + for (let idRadio of div.querySelectorAll('input[type=radio]')) { if (idRadio.checked) { return true; } } @@ -199,12 +222,18 @@ function verifierRadio(idElem) return false; } +/** + * afficher/masquer les détails + * @param {string} idElem bouton de masquage/affichage + * @param {string} classe des détails à afficher/masquer + * @param {string} texte du bouton + */ function montrerMasquerDetails(idElem, classe, texte) { - var lesDetails = document.querySelectorAll(classe); + let lesDetails = document.querySelectorAll(classe); if (lesDetails.length > 0) { - var leBouton = document.getElementById(idElem); + let leBouton = document.getElementById(idElem); if (leBouton.textContent.startsWith('Replier')) { // masquer diff --git a/www/admin/style.css b/www/admin/style.css index 81dc14d..7253822 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -32,7 +32,8 @@ summary.personne padding-top : 0; padding-bottom : 0; } -h3.personne, h4.personne { +h3.personne, h4.personne +{ font-weight : normal; background: rgba(var(--gSecondColor), 0.25); } From 55d2ce0cbb55feec6e4e44448df3f8d8273d5db1 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 27 Apr 2022 13:56:04 +0000 Subject: [PATCH 050/137] simplification affichage FossilOrigin-Name: 442ad95644cd0884b83bfeefd06cc54b77cbce877b564ee96ba0ea4748aa8591 --- templates/index.tpl | 8 ++++---- templates/versements_personnes.tpl | 2 +- www/admin/action.php | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/templates/index.tpl b/templates/index.tpl index 8e54e1b..a2650c9 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -101,8 +101,8 @@ de configuration 0 && $nbChamps > 0} - + @@ -111,6 +111,9 @@ {foreach from=$activitesTarifsComptes item="activite"} + -
    Cocher Activité et TarifCocher Taux de réduction Caractéristiques activité N° et Compte
    + {$activite.titreActivite} - {$activite.titreTarif} + {if $nbTarifs == 1} {input @@ -127,9 +130,6 @@ } {/if} - {$activite.titreActivite} - {$activite.titreTarif} - {foreach from=$plugin_config->reduction item="reduc"} {if $reduc->valeur == 1} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index 519b471..da70472 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -18,7 +18,7 @@ {* Itération sur les personnes *} - {foreach from=$lesVersements key="i" item="versement"} + {foreach from=$lesVersements item="versement"} {if $rang == 0} {* 1ère personne *} register_function('afficher_debut_personne', function ($params) $out .= sprintf('
    ', $idVersement); - // $out .= '
    - //
    '; return $out; }); From c7f5500224188a945a1dde41e07e4d4d6986e359 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 27 Apr 2022 13:57:16 +0000 Subject: [PATCH 051/137] simplification affichage FossilOrigin-Name: 676c58857ae7ff3522d30289744ec302c2254097bfdf2420e1c2178d4ddf4c5d --- templates/index.tpl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/index.tpl b/templates/index.tpl index 8e54e1b..d6c7cba 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -101,8 +101,8 @@ de configuration 0 && $nbChamps > 0} - + @@ -111,6 +111,10 @@ {foreach from=$activitesTarifsComptes item="activite"} + + - ) - var ligne = idCase.closest("tr"); + // chercher la ligne englobante (
  • ) + var ligne = idCase.closest("li"); // itérer sur les radio de cette ligne var lesRadios = ligne.querySelectorAll('input[type=radio]'); for (var idRadio of lesRadios) { diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 4092df0..1ebd69c 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -26,41 +26,51 @@ $pair = true; $tarifCourant = $versement->idTarif; $personneCourante = $versement->idUser; - $compteCourant = $versement->compte; + $compteCourant = $versement->idCompte; ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} + {afficher_debut_compte idCompte=$compteCourant} {elseif $versement.idTarif != $tarifCourant} {* changement de tarif *} + {fin_compte} {fin_personne} {fin_tarif} idTarif; $personneCourante = $versement->idUser; - $compteCourant = $versement->compte; + $compteCourant = $versement->idCompte; ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} + {afficher_debut_compte idCompte=$compteCourant} {elseif $versement.idUser != $personneCourante} {* changement de personne *} + {fin_compte} {fin_personne} idUser; - $compteCourant = $versement->compte; + $compteCourant = $versement->idCompte; ?> {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {elseif $versement.compte != $compteCourant} - {* même personne mais changement de compte *} - compte; ?> -
    + {afficher_debut_compte idCompte=$compteCourant} + {elseif $versement.idCompte != $compteCourant} + {fin_compte} + {* changement de compte *} + idCompte; + ?> + {afficher_debut_compte idCompte=$compteCourant} {else} {* même personne, même compte *} {/if} {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang pair=$pair} {/foreach} {* Itération sur les versements *} + {fin_compte} {fin_personne} {fin_tarif} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index 5d3d731..82ffd04 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -3,6 +3,42 @@

    Versements par personne

    +
    + + +
    @@ -14,7 +50,7 @@ onclick="return verifierChoix(this.form)" />
    -
    + {* Itération sur les personnes *} {foreach from=$lesVersements key="rang" item="versement"} @@ -23,28 +59,36 @@ idUser; - $compteCourant = $versement->compte; + $compteCourant = $versement->idCompte; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} + {afficher_debut_compte idCompte=$compteCourant} {elseif $versement.idUser != $personneCourante} {* changement de personne *} + {fin_compte} {fin_personne} idUser; - $compteCourant = $versement->compte; + $compteCourant = $versement->idCompte; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {elseif $versement.compte != $compteCourant} - {* même personne mais changement de compte *} - compte; ?> -
    + {afficher_debut_compte idCompte=$compteCourant} + {elseif $versement.idCompte != $compteCourant} + {fin_compte} + {* changement de compte *} + idCompte; + ?> + {afficher_debut_compte idCompte=$compteCourant} {else} {* même personne, même compte *} {/if} {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang pair=$pair} {/foreach} {* Itération sur les personnes *} + {fin_compte} {fin_personne} diff --git a/www/admin/action.php b/www/admin/action.php index 05cc7af..67602ac 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -64,31 +64,43 @@ $tpl->register_function('afficher_debut_tarif', function ($params) { $versement = $params['versement']; $idTarif = $versement->idTarif; - $tarif = $_SESSION['lesTarifs'][$idTarif]; - $idActivite = $tarif->idActivite; - $activite = $_SESSION['lesActivites'][$idActivite]; - + $out = sprintf('
    -
    - -
    ', +
    ', $idVersement, $personne->nomPrenom ); return $out; }); +// afficher infos compte +$tpl->register_function('afficher_debut_compte', function ($params) +{ + $idCompte = $params['idCompte']; + $out = sprintf(' +
    +

    Compte N° %1$s : %2$s

    ', + $_SESSION['comptes'][$idCompte]->codeCompte, + $_SESSION['comptes'][$idCompte]->nomCompte); + return $out; +}); + // afficher un versement $tpl->register_function('afficher_versement', function ($params) { @@ -140,24 +163,34 @@ $tpl->register_function('afficher_versement', function ($params) name="selected[]" value="%2$s" onclick="cocherDecocherVersement(check_%1$s_%2$s, total_%1$s)" /> -
    ', $idVersement, $rang, - $versement->versement/100, - date_format(date_create($versement->date),"d/m/Y"), - $versement->compte + number_format( + $versement->versement/100, + 2, + ",", + " " + ), + date_format(date_create($versement->date),"d/m/Y") ); return $out; }); -$tpl->register_function('fin_personne', function ($params) +$tpl->register_function('fin_compte', function () { $out = ' -
    + '; + return $out; +}); + +$tpl->register_function('fin_personne', function () +{ + $out = ' +
    '; return $out; }); @@ -175,6 +208,8 @@ $tpl->register_function('fin_tarif', function ($params) if ($_GET['action'] == 'personne') { require('versements_personnes.php'); -} else { +} else if ($_GET['action'] == 'compte') { + require('versements_personnes.php'); +} else if ($_GET['action'] == 'activite') { require('versements_activites.php'); } diff --git a/www/admin/index.php b/www/admin/index.php index c489221..a7e73a5 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -10,10 +10,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") $_SESSION['annee_recu'] = date("Y") - 1; } -// libellés pour les taux de réduction -$_SESSION['ligneReduction'] = Utils::getLignesReduction($plugin->getConfig('reduction')); - -// compter le nombre de taux de réduction activés +// nombre de taux de réduction activés $nbTaux = 0; foreach ($plugin->getConfig('reduction') as $taux) { @@ -23,7 +20,6 @@ foreach ($plugin->getConfig('reduction') as $taux) // idem avec les champs nom/prénom $nbChamps = 0; $champsNom = Utils::getChampsNom($config, $plugin); - if (null !== $champsNom) { foreach ($champsNom as $nom => $champ) @@ -32,13 +28,36 @@ if (null !== $champsNom) } } +// comptes sur lesquels des versements de membres ont été faits +// pendant l'année fiscale choisie +$_SESSION['comptes'] = Utils::getComptes($_SESSION['annee_recu'], 'like', '7%'); + // liste des activités, cotisations et comptes associés -$activitesTarifsComptes = Utils::getActivitesTarifsEtComptes(); +$activitesTarifsComptes = Utils::getTarifsComptes($_SESSION['annee_recu'], 'like', '7%'); +$_SESSION['lesTarifs'] = Utils::getTarifs(); +$_SESSION['lesActivites'] = Utils::getActivites(); + +// liste des comptes associés à aucune activité +$comptesSansActivite = array(); +foreach ($_SESSION['comptes'] as $id => $elem) +{ + $trouve = false; + foreach ($activitesTarifsComptes as $elem) + { + if ($id == $elem->idCompte) { $trouve = true ; break; } + } + if (! $trouve) { $comptesSansActivite[] = $id; } +} // préparation de l'affichage $tpl->assign('annee_recu', $_SESSION['annee_recu']); +$tpl->assign('lesComptes', $_SESSION['comptes']); +$tpl->assign('lesTarifs', $_SESSION['lesTarifs']); +$tpl->assign('lesActivites', $_SESSION['lesActivites']); $tpl->assign('activitesTarifsComptes', $activitesTarifsComptes); +$tpl->assign('comptesSansActivite', $comptesSansActivite); $tpl->assign('nbTarifs', count($activitesTarifsComptes)); +$tpl->assign('nbComptes', count($_SESSION['comptes'])); $tpl->assign('plugin_config', $plugin->getConfig()); $tpl->assign('nbTaux', $nbTaux); $tpl->assign('nbChamps', $nbChamps); diff --git a/www/admin/style.css b/www/admin/style.css index 26db1bb..e9e9ff0 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -36,7 +36,6 @@ summary.personne } div.activite { - font-weight : normal; background-color: rgba(var(--gSecondColor), 0.4); } div.personne @@ -101,3 +100,13 @@ div.infos margin-left : 1em; width : 20em; } +ul#liste_activites dd +{ + display: inline-block; +} + +ul.reduction span.radio-btn +{ + margin-left : 2em; + border-spacing : 0.1em; +} diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index 68fd0b4..014ef54 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -7,42 +7,57 @@ use Garradin\Plugin\RecusFiscaux\Personne; use Garradin\Plugin\RecusFiscaux\Tarif; use Garradin\Plugin\RecusFiscaux\Utils; +// ------------------------------------------------------------ // récupérer les infos du formulaire +// ------------------------------------------------------------ + +// tarifs sélectionnés $tarifsSelectionnes = f('tarifs') ?: []; +// comptes sélectionnés +$comptesSelectionnes = f('comptes') ?: []; + // taux de réduction associés $tauxSelectionnes = array(); -foreach ($tarifsSelectionnes as $idTarif) { +foreach ($tarifsSelectionnes as $idTarif) +{ $nomRadio = "taux_reduction_" . $idTarif; $valRadio = f("$nomRadio"); $tauxSelectionnes[$idTarif] = $valRadio; } +foreach ($comptesSelectionnes as $idCompte) +{ + $nomRadio = "taux_reduction_" . $idCompte; + $valRadio = f("$nomRadio"); + $tauxSelectionnes[$idCompte] = $valRadio; +} $_SESSION['tauxSelectionnes'] = $tauxSelectionnes; -// obtenir les instances de tarifs correspondant à la sélection -$lesTarifs = array(); -foreach (Utils::getTarifs($tarifsSelectionnes) as $ot) { - $lesTarifs[$ot->id] = $ot; -} -$_SESSION['lesTarifs'] = $lesTarifs; +// versements correspondants à la sélection, triés par tarif, nom, compte, date +$lesTarifs = array_map(fn($elem) : string => substr($elem, 0, strpos($elem, '_')), + $tarifsSelectionnes); +$lesComptes = array_map(fn($elem) : string => substr($elem, 1 + strpos($elem, '_')), + $tarifsSelectionnes); +$_SESSION['lesVersements'] = + Utils::getVersementsTarifsComptes( + $_SESSION['annee_recu'], + $lesTarifs, + $lesComptes, + $champsNom); -// activités correspondants aux tarifs sélectionnés -$lesActivites = array(); -foreach (Utils::getActivites($tarifsSelectionnes) as $activite) { - $lesActivites[$activite->id] = $activite; +// ajouter les versements sans tarif (tri par nom, compte, date) +$versementsSansTarif = Utils::getVersementsComptes($_SESSION['annee_recu'], + $comptesSelectionnes, + $champsNom); +foreach ($versementsSansTarif as $versement) +{ + $_SESSION['lesVersements'][] = $versement; } -$_SESSION['lesActivites'] = $lesActivites; - -// versements correspondants aux tarifs sélectionnés -$_SESSION['lesVersements'] = Utils::getVersementsTarifs($_SESSION['annee_recu'], - $tarifsSelectionnes, - $champsNom); // préparation de l'affichage -$tpl->assign('lesActivites', $lesActivites); -$tpl->assign('lesTarifs', $lesTarifs); $tpl->assign('lesVersements', $_SESSION['lesVersements']); $tpl->assign('plugin_css', ['style.css']); // envoyer au template $tpl->display(PLUGIN_ROOT . '/templates/versements_activites.tpl'); + diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 1a16cca..d0ee822 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -5,81 +5,23 @@ namespace Garradin; use Garradin\Plugin\RecusFiscaux\Personne; use Garradin\Plugin\RecusFiscaux\Utils; -$_SESSION['taux_reduction'] = $_POST['taux_reduction']; +// vérifier si le taux de réduction a été sélectionné au préalable +$_SESSION['taux_reduction'] = f('taux_reduction'); +if (! isset($_SESSION['taux_reduction']) || $_SESSION['taux_reduction'] == "") { + \Garradin\Utils::redirect(PLUGIN_URL . 'index.php'); +} // versements par personne -$_SESSION['lesVersements'] = Utils::getVersementsComptes($_SESSION['annee_recu'], - "like", - '7%', - $champsNom); - - // Utils::getVersementsPersonnes($_SESSION['annee_recu'], - // $champsNom); - -// ------------------------------------------------------------------------ -// tests -// ------------------------------------------------------------------------ -/* -$versementsComptes = Utils::getVersementsComptes("2021", - // "in", - // ['706', '7780', '756'], - "like", - '7%', - $champsNom); -// table triée par nom, date -// error_log("versementsComptes triée par nom, date = " . print_r($versementsComptes, true)); - -// comparer 2 lignes selon le nom -function comparerNoms($ligne1, $ligne2) -{ - return - $_SESSION['membresDonateurs'][$ligne1->idUser]->rang - - - $_SESSION['membresDonateurs'][$ligne2->idUser]->rang; -} - -// comparer 2 lignes selon la date -function comparerDate($ligne1, $ligne2) -{ - return - strtotime($ligne1->date) - strtotime($ligne2->date); -} - -// comparer 2 lignes selon un champ -function comparerChamp($ligne1, $ligne2, $champ) -{ - return $ligne1->$champ - $ligne2->$champ; -} - -// autres tris -// par tarif, nom, date -usort($versementsComptes, function($ligne1, $ligne2) -{ - $result = comparerChamp($ligne1, $ligne2, 'idTarif'); //$ligne1->idTarif - $ligne2->idTarif; - if ($result == 0) { $result = comparerNoms($ligne1, $ligne2); } - if ($result == 0) { $result = comparerDate($ligne1, $ligne2); } - return $result; -}); -// error_log("versementsComptes triée par tarif, nom, date = " . print_r($versementsComptes, true)); - -// par nom, compte, date... -usort($versementsComptes, function($ligne1, $ligne2) -{ - $result = comparerNoms($ligne1, $ligne2); - if ($result == 0) { $result = comparerChamp($ligne1, $ligne2, 'compte'); } - if ($result == 0) { $result = comparerDate($ligne1, $ligne2); } - return $result; -}); - -// error_log("versementsComptes triée par nom, compte, date = " . print_r($versementsComptes, true)); -*/ -// ------------------------------------------------------------------------ -// fin tests -// ------------------------------------------------------------------------ +$_SESSION['lesVersements'] = Utils::getVersementsPersonnes( + $_SESSION['annee_recu'], + 'like', + '7%', + $champsNom); // préparation de l'affichage $tpl->assign('lesVersements', $_SESSION['lesVersements']); $tpl->assign('plugin_css', ['style.css']); // envoyer au template +$tpl->assign('plugin_config', $plugin->getConfig()); $tpl->display(PLUGIN_ROOT . '/templates/versements_personnes.tpl'); From e4bcec41d190af441985cbacc1cea3f814434e30 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 18 May 2022 10:29:48 +0000 Subject: [PATCH 062/137] =?UTF-8?q?int=C3=A9gration=20comptes=20;=20correc?= =?UTF-8?q?tion=20r=C3=A9pertoire=20fichiers=20PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 73be628660ffd83648eef220291a2361d74f7910098cd89a9ba63b4c796878bb --- www/admin/generer_recus.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/www/admin/generer_recus.php b/www/admin/generer_recus.php index 18d2965..8f17c1b 100644 --- a/www/admin/generer_recus.php +++ b/www/admin/generer_recus.php @@ -6,7 +6,6 @@ use Garradin\Files\Files; use Garradin\Entities\Files\File; use Garradin\UserTemplate\UserTemplate; -//use Garradin\Plugin\RecusFiscaux\RecusHTML; use Garradin\Plugin\RecusFiscaux\Utils; use Garradin\Plugin\RecusFiscaux\Personne; @@ -50,6 +49,9 @@ elseif ($nbArticles > 1) } } +// libellés pour les taux de réduction +$libelles_taux = Utils::getLignesReduction($plugin->getConfig('reduction')); + // filtrer les versements sélectionnés $lesLignes = f('selected'); $versementsSelectionnes = array(); @@ -89,12 +91,12 @@ foreach ($totalPersonnes as $idPersonne => $personne) // les versements $tpl->registerSection('versements', - function () use($personne) + function () use($personne, $libelles_taux) { foreach ($personne->versements as $taux => $montant) { $ligne['montant'] = $montant; - $ligne['libelle'] = Utils::getLigneReduction($taux); + $ligne['libelle'] = $libelles_taux[$taux]; yield $ligne; } }); @@ -129,7 +131,10 @@ foreach ($totalPersonnes as $idPersonne => $personne) // changer le nom du fichier $nom = str_replace(' ', '_', $personne->nomPrenom); $nom = str_replace("'", "", $nom); - $nomFichier = "recu_" . $_SESSION['annee_recu'] . "_" . $nom . ".pdf"; + $nomFichier = sprintf('%s/recu_%s_%s.pdf', + dirname($nomPDF), + $_SESSION['annee_recu'], + $nom); rename($nomPDF, $nomFichier); // ajouter le nom du fichier à la liste pour mettre dans une archive $listeFichiersPDF[] = $nomFichier; @@ -142,6 +147,12 @@ $fichierZip = Utils::makeArchive( PLUGIN_ROOT . "/zip" ); +//supprimer les fichiers pdf (utile ?) +// foreach ($listeFichiersPDF as $f) +// { +// unlink($f); +// } + /** * Cumuler les versements de chaque personne * @param tableau des versements triés par idUser, date From 3543f50bd3b2446232c7db9ddefeee13bec72994 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 18 May 2022 10:30:10 +0000 Subject: [PATCH 063/137] =?UTF-8?q?int=C3=A9gration=20comptes=20;=20correc?= =?UTF-8?q?tion=20calcul=20total=20(centimes)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: e2258a9966d61dda05c821ceee19965331f6b0204c0ecb63a1d5c9be86ee15ce --- www/admin/script.js | 47 +++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/www/admin/script.js b/www/admin/script.js index b53db28..5e82a87 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -69,7 +69,7 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) function cocherDecocherPersonne(idCase, idTotal) { // chercher le fieldset des versements - let fieldset = idCase.closest("details").querySelector("fieldset"); + let fieldset = idCase.closest("details").querySelector("div.versements"); let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); for (let i = 0; i < listeCases.length; ++i) { @@ -87,7 +87,7 @@ function cocherDecocherPersonne(idCase, idTotal) */ function cocherDecocherVersement(idCase, idTotal) { - let fieldset = idCase.closest("fieldset"); + let fieldset = idCase.closest("div.versements"); let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); let listeMontants = fieldset.querySelectorAll("span.montant"); calculerTotal(listeCases, listeMontants, idTotal); @@ -105,7 +105,7 @@ function calculerTotal(listeCases, listeMontants, idTotal) for (let i = 0; i < listeCases.length; ++i) { if (listeCases[i].checked) { - total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "")); + total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "").replace(",", ".")); } } // afficher le total @@ -153,31 +153,28 @@ function verifierChoix(formulaire) } /** + * positionner l'action déclenchée par l'envoi du formulaire * afficher et masquer des portions de formulaire selon l'action * @param {HTMLFormElement} formulaire * @param {string} action après envoi du formulaire - * @param {any} nomClasse1 classe des éléments à afficher - * @param {any} nomClasse2 classe des éléments à masquer + * @param {any} idElem id de l'élément à afficher + * @param {any} nomClasse classe des éléments à masquer (sauf idElem) */ -function choixMethodeGeneration(formulaire, action, nomClasse1, nomClasse2) +function choixMethodeGeneration(formulaire, action, idElem, nomClasse) { + console.log("id = " + idElem + ", cl = " + nomClasse); formulaire.setAttribute('action', 'action.php?action=' + action); - afficherMasquer(formulaire, nomClasse1, nomClasse2); -} - -/** - * afficher et masquer des portions de formulaire - * @param {HTMLFormElement} formulaire - * @param {any} nomClasse1 classe des éléments à afficher - * @param {any} nomClasse2 classe des éléments à masquer - */ -function afficherMasquer(formulaire, nomClasse1, nomClasse2) -{ - for (let elem of formulaire.querySelectorAll(nomClasse1)) { - elem.classList.remove('hidden'); - } - for (let elem of formulaire.querySelectorAll(nomClasse2)) { - elem.classList.add('hidden'); + for (let elem of formulaire.querySelectorAll(nomClasse)) + { + console.log("elem.id = " + elem.id + ", elem.classList = " + elem.classList); + if (elem.id == idElem) + { + elem.classList.remove('hidden'); + } + else + { + elem.classList.add('hidden'); + } } } @@ -199,7 +196,7 @@ function verifierCases(idElem) // vérifier qu'un radio de la même ligne est sélectionné let ligneCorrecte = false; // trouver la ligne englobante - let ligne = idCase.closest("tr"); + let ligne = idCase.closest("li"); for (let idRadio of ligne.querySelectorAll('input[type=radio]')) { if (idRadio.checked) { ligneCorrecte = true; break; } @@ -211,7 +208,7 @@ function verifierCases(idElem) } } if (nbChoix == 0) { - alert("Erreur : il faut sélectionner au moins une activité/tarif"); + alert("Erreur : il faut sélectionner au moins une ligne"); } return nbChoix != 0; } @@ -228,7 +225,7 @@ function verifierRadio(idElem) if (idRadio.checked) { return true; } } alert("Erreur : il faut sélectionner un taux de réduction"); - return false; + return false; } /** From e4a1c118728ea970de9f938cba1acb30c6e4046d Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 18 May 2022 19:37:17 +0000 Subject: [PATCH 064/137] suppression fonction inutile FossilOrigin-Name: e012a353747dd79da683af96d0adddb4f7643482ffe99b9e0a8d18e27fe2357d --- lib/Utils.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/Utils.php b/lib/Utils.php index d3cf3cf..ad34fdc 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -387,11 +387,6 @@ class Utils return $lignes; } - public static function getLigneReduction($taux) - { - return $_SESSION['ligneReduction'][$taux]; - } - /** * récupérer dans la config du plugin les champs des membres * utilisés pour le nom et le prénom ; ajouter/supprimer les From 92a4b7b8a6797774747c9d08952809ce9b6087b2 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 18 May 2022 19:38:02 +0000 Subject: [PATCH 065/137] suppression messages inutiles FossilOrigin-Name: e9f360c137e3a41453b47d042cf8433b8ec50886e0756dfed5e67bf553a91189 --- www/admin/script.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/www/admin/script.js b/www/admin/script.js index 5e82a87..0c98978 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -162,11 +162,9 @@ function verifierChoix(formulaire) */ function choixMethodeGeneration(formulaire, action, idElem, nomClasse) { - console.log("id = " + idElem + ", cl = " + nomClasse); formulaire.setAttribute('action', 'action.php?action=' + action); for (let elem of formulaire.querySelectorAll(nomClasse)) { - console.log("elem.id = " + elem.id + ", elem.classList = " + elem.classList); if (elem.id == idElem) { elem.classList.remove('hidden'); From 358aad1ec79984200cfb08ba6b01de1662f279fe Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 18 May 2022 19:38:59 +0000 Subject: [PATCH 066/137] correction bug total compte FossilOrigin-Name: d24bebd61e6729bab7cb2caa65523d20146e187b621935e47be84169db710dc7 --- www/admin/generer_recus.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/www/admin/generer_recus.php b/www/admin/generer_recus.php index 8f17c1b..760fd0b 100644 --- a/www/admin/generer_recus.php +++ b/www/admin/generer_recus.php @@ -205,25 +205,31 @@ function cumulerVersementsTarif($versements) $totalPersonnes = array(); $idTarifCourant = -1; $idPersonneCourant = -1; + $idCompteCourant = -1; $totalVersements = 0; foreach ($versements as $ligne) { if ( - $ligne->idTarif != $idTarifCourant || - $ligne->idUser != $idPersonneCourant + $ligne->idTarif != $idTarifCourant || + $ligne->idUser != $idPersonneCourant || + $ligne->idCompte != $idCompteCourant ) { if ($idTarifCourant != -1) { // changement de tarif ou de personne + $tarifCompte = ($idTarifCourant == 0) ? + $idCompteCourant : + $idTarifCourant . "_" . $idCompteCourant; $totalPersonnes[$idPersonneCourant]->ajouterVersement( - $_SESSION['tauxSelectionnes'][$idTarifCourant], + $_SESSION['tauxSelectionnes'][$tarifCompte], $totalVersements ); } - $idTarifCourant = $ligne->idTarif; + $idTarifCourant = $ligne->idTarif; $idPersonneCourant = $ligne->idUser; - $totalVersements = $ligne->versement; + $idCompteCourant = $ligne->idCompte; + $totalVersements = $ligne->versement; // créer les infos de la personne, sauf si elle est déjà présente if (!array_key_exists($idPersonneCourant, $totalPersonnes)) { @@ -235,8 +241,11 @@ function cumulerVersementsTarif($versements) } } // et le dernier + $tarifCompte = ($idTarifCourant == 0) ? + $idCompteCourant : + $idTarifCourant . "_" . $idCompteCourant; $totalPersonnes[$idPersonneCourant]->ajouterVersement( - $_SESSION['tauxSelectionnes'][$idTarifCourant], + $_SESSION['tauxSelectionnes'][$tarifCompte], $totalVersements ); return $totalPersonnes; From 9c64e19f4c611503c25136aeefb9e9b418408a2f Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 20 May 2022 19:41:50 +0000 Subject: [PATCH 067/137] =?UTF-8?q?simplification=20pr=C3=A9sentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 92a26d123e288053bef4008013ecc4531bd1a94f91dfb36877f0ecfc1731b31e --- templates/index.tpl | 83 +----------------------------- templates/versements_personnes.tpl | 36 ------------- 2 files changed, 2 insertions(+), 117 deletions(-) diff --git a/templates/index.tpl b/templates/index.tpl index abd3ba6..382aa02 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -27,20 +27,7 @@ - {* -
    - - -
    -*} +
    @@ -95,73 +82,7 @@

    - {* Comptes *} -{* -
  • Cocher Activité et TarifCocher Taux de réduction Caractéristiques activité N° et Compte
    + {$activite.titreActivite} - {$activite.titreTarif} + {if $nbTarifs == 1} {input @@ -127,9 +131,6 @@ } {/if} - {$activite.titreActivite} - {$activite.titreTarif} - {foreach from=$plugin_config->reduction item="reduc"} {if $reduc->valeur == 1} From 0023c2722f2b8424c8ac5d8d265890c1d52089bc Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 28 Apr 2022 08:18:16 +0000 Subject: [PATCH 052/137] =?UTF-8?q?encore=20une=20am=C3=A9lioration=20cosm?= =?UTF-8?q?=C3=A9tique=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: dce70845784819f3a6e2f7610285cf5e4f7771f60a8e3dd2cce68b0b332cdcaa --- www/admin/action.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/www/admin/action.php b/www/admin/action.php index b6bd49b..40d4918 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -80,12 +80,12 @@ $tpl->register_function('afficher_debut_personne', function ($params) $idVersement, $idVersement); $out .= sprintf(' - ', + '; $out .= sprintf('
    ', $idVersement); @@ -114,17 +114,18 @@ $tpl->register_function('afficher_versement', function ($params) $idVersement, $rang, $idVersement ); $out .= sprintf(' - ', - $idVersement, $rang - ); - $out .= sprintf(' - %.2f', + + ' + ); return $out; }); From f25216448a17a9ab9e08d3254bde399f9d684879 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 28 Apr 2022 09:01:53 +0000 Subject: [PATCH 053/137] corrections mineures FossilOrigin-Name: 1ee79b4944c44721026d86fd258c1fa922993c234443bb195d761e3050e92937 --- templates/config.tpl | 6 +++--- templates/versements_activites.tpl | 4 ++-- templates/versements_personnes.tpl | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/config.tpl b/templates/config.tpl index f7433f1..ae30798 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -30,7 +30,7 @@ *}
    + {if $article.valeur == 1}checked{/if} />
    {/foreach} @@ -44,7 +44,7 @@ {foreach from=$plugin_config->reduction key="key" item="taux"}
    + {if $taux.valeur == 1}checked{/if} /> {/if}
    @@ -93,7 +93,7 @@
    {foreach from=$champsNom key="nom" item="champ"}
    - +
    diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index c91b289..afaf7eb 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -8,7 +8,7 @@ - +
    @@ -61,7 +61,7 @@ {* fin versements d'une personne *} {* fin tarif *} - + {* scripts divers *} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index da70472..76e5e11 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -11,7 +11,7 @@ onclick="montrerMasquerDetails(this.id, 'details.personne', 'toutes les personnes')">Replier toutes les personnes + onclick="return verifierChoix(this.form)" />
    @@ -45,7 +45,7 @@ - +
    {* scripts divers *} From 59acc11ee009b4400dad7d94e09d0e58c1a7d681 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 28 Apr 2022 11:12:07 +0000 Subject: [PATCH 054/137] correction bug FossilOrigin-Name: 3c37e9878208cd8df3eb5991d8d8d231ac7c724799b77bcb72a71da81ad21ad6 --- templates/versements_activites.tpl | 10 +++++----- templates/versements_personnes.tpl | 8 ++++---- www/admin/action.php | 5 ++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index c91b289..7d63ccb 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -15,7 +15,7 @@ {* Itération sur les versements *} - {foreach from=$lesVersements item="versement"} + {foreach from=$lesVersements key="num" item="versement"} {if $rang == 0} {* premier versement *} {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {else} {* autre versement *} {if $versement.idTarif != $tarifCourant} @@ -39,7 +39,7 @@ ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} @@ -49,10 +49,10 @@ $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {/if} {/if} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index 519b471..5ae952c 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -18,14 +18,14 @@ {* Itération sur les personnes *} - {foreach from=$lesVersements key="i" item="versement"} + {foreach from=$lesVersements key="num" item="versement"} {if $rang == 0} {* 1ère personne *} idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} @@ -35,10 +35,10 @@ $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} {/if} {/foreach} {* Itération sur les personnes *} diff --git a/www/admin/action.php b/www/admin/action.php index d96bf12..131d426 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -89,8 +89,6 @@ $tpl->register_function('afficher_debut_personne', function ($params) $out .= sprintf('
    ', $idVersement); - // $out .= '
    - //
    '; return $out; }); @@ -99,6 +97,7 @@ $tpl->register_function('afficher_versement', function ($params) { $versement = $params['versement']; $idVersement = $params['idVersement']; + $num = $params['num']; $rang = $params['rang']; $out = '
    ', $idVersement, $idVersement, $rang, - $rang, + $num, $idVersement, $rang, $idVersement ); $out .= sprintf(' From 7d2707eddd196c8c0b97ee56ae9e483d0256ae64 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 28 Apr 2022 11:28:41 +0000 Subject: [PATCH 055/137] fusion branche bug FossilOrigin-Name: 31a7a9e50c6f99940fc5a05e557c08b08366fd06c2180c2c0a1b0321a0cda07d --- templates/versements_activites.tpl | 14 +++++++------- templates/versements_personnes.tpl | 12 ++++++------ www/admin/action.php | 22 ++++++++++++---------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index c91b289..7b04e84 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -8,14 +8,14 @@ - +
    {* Itération sur les versements *} - {foreach from=$lesVersements item="versement"} + {foreach from=$lesVersements key="num" item="versement"} {if $rang == 0} {* premier versement *} {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {else} {* autre versement *} {if $versement.idTarif != $tarifCourant} @@ -39,7 +39,7 @@ ?> {afficher_debut_tarif versement=$versement} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} @@ -49,10 +49,10 @@ $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} {/if} {/if} @@ -61,7 +61,7 @@ {* fin versements d'une personne *} {* fin tarif *} - +
    {* scripts divers *} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index da70472..46364d0 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -11,21 +11,21 @@ onclick="montrerMasquerDetails(this.id, 'details.personne', 'toutes les personnes')">Replier toutes les personnes + onclick="return verifierChoix(this.form)" />
    {* Itération sur les personnes *} - {foreach from=$lesVersements item="versement"} + {foreach from=$lesVersements key="num" item="versement"} {if $rang == 0} {* 1ère personne *} idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} @@ -35,17 +35,17 @@ $personneCourante = $versement->idUser; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} {else} {* même personne *} - {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang} + {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} {/if} {/foreach} {* Itération sur les personnes *} - +
    {* scripts divers *} diff --git a/www/admin/action.php b/www/admin/action.php index 3036d84..75b5426 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -80,12 +80,12 @@ $tpl->register_function('afficher_debut_personne', function ($params) $idVersement, $idVersement); $out .= sprintf(' - ', + '; $out .= sprintf('
    ', $idVersement); @@ -97,6 +97,7 @@ $tpl->register_function('afficher_versement', function ($params) { $versement = $params['versement']; $idVersement = $params['idVersement']; + $num = $params['num']; $rang = $params['rang']; $out = '
    ', $idVersement, $idVersement, $rang, - $rang, + $num, $idVersement, $rang, $idVersement ); $out .= sprintf(' - ', - $idVersement, $rang - ); - $out .= sprintf(' - %.2f', +
    ', + %s', date_format(date_create($versement->date),"d/m/Y")); + $out .= sprintf(' + + ' + ); return $out; }); From 7ca41ea6b74b459b509637b1aef05687683b128a Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 29 Apr 2022 09:01:15 +0000 Subject: [PATCH 056/137] =?UTF-8?q?Changement=20gestion=20choix=20ann?= =?UTF-8?q?=C3=A9e=20fiscale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: d6a1c29317cfa870514efff87598a508738ef9d089e52c9b75b0e3e5477a73c9 --- templates/choix_annee.tpl | 20 ++++++++++++++++++++ templates/index.tpl | 17 +++++++---------- www/admin/action.php | 40 +++++++++++++++++++++++++++++++++------ www/admin/choix_annee.php | 24 +++++++++++++++++++++++ www/admin/index.php | 12 +++++------- 5 files changed, 90 insertions(+), 23 deletions(-) create mode 100644 templates/choix_annee.tpl create mode 100644 www/admin/choix_annee.php diff --git a/templates/choix_annee.tpl b/templates/choix_annee.tpl new file mode 100644 index 0000000..9536b5c --- /dev/null +++ b/templates/choix_annee.tpl @@ -0,0 +1,20 @@ +{include file="admin/_head.tpl" title="Changer d'année fiscale"} + +
    +
    + Changer l'année fiscale des reçus + +
    +

    + {csrf_field key="acc_select_year"} + + {button type="submit" name="change" label="Changer" shape="right" class="main"} +

    +
    + +{include file="admin/_foot.tpl"} \ No newline at end of file diff --git a/templates/index.tpl b/templates/index.tpl index d6c7cba..84db4cd 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -1,17 +1,14 @@ {include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="index"} -

    Choisir l'année fiscale

    + + +
    -
    - {* Choisir l'année fiscale *} - -

    Choisir une méthode de génération des reçus

    diff --git a/www/admin/action.php b/www/admin/action.php index 75b5426..fe53a67 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -8,12 +8,6 @@ use Garradin\Plugin\RecusFiscaux\Utils; // opérations communes // ------------------------------------------------------------------------ -// vérifier si l'année a bien été sélectionnée au préalable -$_SESSION['annee_recu'] = f('annee_recu'); -if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { - \Garradin\Utils::redirect(PLUGIN_URL . 'index.php'); -} - // champs pour le nom et prénom $confNoms = Utils::getChampsNom($config, $plugin); uasort($confNoms, function ($a, $b) @@ -30,6 +24,37 @@ foreach ($confNoms as $nom => $champ) $_SESSION['membresDonateurs'] = Utils::getDonateurs($_SESSION['annee_recu'], $champsNom); +// comparaison de lignes de versements +// comparer 2 lignes selon le nom +function comparerNoms($ligne1, $ligne2) +{ + return + $_SESSION['membresDonateurs'][$ligne1->idUser]->rang + - + $_SESSION['membresDonateurs'][$ligne2->idUser]->rang; +} + +// comparer 2 activités par leur libellé +function comparerActivites($ligne1, $ligne2) +{ + return strcoll( + $_SESSION['lesActivites'][$_SESSION['lesTarifs'][$ligne1->idTarif]->idActivite]->label, + $_SESSION['lesActivites'][$_SESSION['lesTarifs'][$ligne2->idTarif]->idActivite]->label); +} + +// comparer 2 lignes selon la date +function comparerDate($ligne1, $ligne2) +{ + return + strtotime($ligne1->date) - strtotime($ligne2->date); +} + +// comparer 2 lignes selon un champ numérique entier +function comparerChamp($ligne1, $ligne2, $champ) +{ + return $ligne1->$champ - $ligne2->$champ; +} + // ------------------------------------------------------------------------ // fonctions pour l'affichage // ------------------------------------------------------------------------ @@ -123,6 +148,9 @@ $tpl->register_function('afficher_versement', function ($params) $out .= sprintf(' %s', date_format(date_create($versement->date),"d/m/Y")); + $out .= sprintf(' + %s', + $versement->compte); $out .= sprintf('
    ' diff --git a/www/admin/choix_annee.php b/www/admin/choix_annee.php new file mode 100644 index 0000000..a10167a --- /dev/null +++ b/www/admin/choix_annee.php @@ -0,0 +1,24 @@ +assign('anneesFiscales', $anneesFiscales); +$tpl->assign('annee_recu', $_SESSION['annee_recu']); +$tpl->assign('from', qg('from')); + +$tpl->display(PLUGIN_ROOT . '/templates/choix_annee.tpl'); diff --git a/www/admin/index.php b/www/admin/index.php index 3791e44..c489221 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -4,11 +4,10 @@ namespace Garradin; use Garradin\Plugin\RecusFiscaux\Utils; -// première année d'exercice -$anneeCourante = date("Y"); -$anneesFiscales = Utils::getAnneesFiscales(); -if ($anneesFiscales[0] < $anneeCourante) { - array_unshift($anneesFiscales, $anneeCourante); +// Année fiscale par défaut +if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") +{ + $_SESSION['annee_recu'] = date("Y") - 1; } // libellés pour les taux de réduction @@ -37,8 +36,7 @@ if (null !== $champsNom) $activitesTarifsComptes = Utils::getActivitesTarifsEtComptes(); // préparation de l'affichage -$tpl->assign('anneesFiscales', $anneesFiscales); -$tpl->assign('anneeCourante', $anneeCourante); +$tpl->assign('annee_recu', $_SESSION['annee_recu']); $tpl->assign('activitesTarifsComptes', $activitesTarifsComptes); $tpl->assign('nbTarifs', count($activitesTarifsComptes)); $tpl->assign('plugin_config', $plugin->getConfig()); From 6165ff531e04b6aab38a4c36bd5d8a7a8eaf1c38 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 4 May 2022 11:53:12 +0000 Subject: [PATCH 057/137] =?UTF-8?q?ajout=20case=20tarif=20;=20r=C3=A9organ?= =?UTF-8?q?isation=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 80c6f13938d5f02786155717bf1ab8b89c6ade3c58bba572bf8c471b54886666 --- templates/index.tpl | 21 ++++- templates/versements_activites.tpl | 85 ++++++++++---------- templates/versements_personnes.tpl | 30 +++---- www/admin/action.php | 121 ++++++++++++++++------------- www/admin/script.js | 31 +++++--- www/admin/style.css | 15 +++- 6 files changed, 177 insertions(+), 126 deletions(-) diff --git a/templates/index.tpl b/templates/index.tpl index 84db4cd..4292f15 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -22,8 +22,7 @@
    {* fin versements d'une personne *} - {* fin versements d'une personne *} - {* fin tarif *} - idTarif; $personneCourante = $versement->idUser; - ?> - {afficher_debut_tarif versement=$versement} - {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} - {elseif $versement.idUser != $personneCourante} - {* changement de personne *} - - - - compte; + ?> + {afficher_debut_tarif versement=$versement} + {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} + {elseif $versement.idUser != $personneCourante} + {* changement de personne *} + {fin_personne} + idUser; - ?> - {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} - {else} - {* même personne *} - {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante num=$num rang=$rang} - {/if} + $compteCourant = $versement->compte; + ?> + {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} + {elseif $versement.compte != $compteCourant} + {* même personne mais changement de compte *} + compte; ?> +
    + {else} + {* même personne, même compte *} {/if} - - {/foreach} {* Itération sur les versements *} - {* fin versements d'une personne *} - {* fin versements d'une personne *} - {* fin tarif *} + {afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang pair=$pair} + + {/foreach} {* Itération sur les versements *} + {fin_personne} + {fin_tarif} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index 46364d0..5d3d731 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -17,33 +17,35 @@
    {* Itération sur les personnes *} - - {foreach from=$lesVersements key="num" item="versement"} + {foreach from=$lesVersements key="rang" item="versement"} {if $rang == 0} {* 1ère personne *} idUser; + $pair = true; + $personneCourante = $versement->idUser; + $compteCourant = $versement->compte; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} {elseif $versement.idUser != $personneCourante} {* changement de personne *} - - - + {fin_personne} idUser; + $pair = true; + $personneCourante = $versement->idUser; + $compteCourant = $versement->compte; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} - {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} + {elseif $versement.compte != $compteCourant} + {* même personne mais changement de compte *} + compte; ?> +
    {else} - {* même personne *} - {afficher_versement versement=$versement idVersement=$personneCourante num=$num rang=$rang} + {* même personne, même compte *} {/if} - + {afficher_versement versement=$versement idVersement=$personneCourante rang=$rang pair=$pair} + {/foreach} {* Itération sur les personnes *} - - + {fin_personne}
    diff --git a/www/admin/action.php b/www/admin/action.php index fe53a67..05cc7af 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -68,23 +68,32 @@ $tpl->register_function('afficher_debut_tarif', function ($params) $idActivite = $tarif->idActivite; $activite = $_SESSION['lesActivites'][$idActivite]; - $out = '
    - '; - $out .= sprintf(' -

    Activité « %s »

    ', $activite->label); + $out = sprintf(' +
    + +
    + +
    '; + $out .= ' + + +
    '; return $out; }); @@ -95,25 +104,22 @@ $tpl->register_function('afficher_debut_personne', function ($params) $idVersement = $params['idVersement']; $personne = $_SESSION['membresDonateurs'][$idUser]; - $out = '
    - -

    '; - $out .= sprintf(' - ', - $idVersement, - $idVersement); - $out .= sprintf(' -

    '; - $out .= sprintf(' -
    ', - $idVersement); + $out = sprintf(' +
    + +
    + + +
    +
    + +
    ', + $idVersement, + $personne->nomPrenom + ); return $out; }); @@ -122,42 +128,47 @@ $tpl->register_function('afficher_versement', function ($params) { $versement = $params['versement']; $idVersement = $params['idVersement']; - $num = $params['num']; $rang = $params['rang']; + $pair = $params['pair']; $out = '
    ' : 'impair">'; + $out .= $pair ? 'pair">' : 'impair">'; $out .= sprintf(' - ', - $idVersement, - $idVersement, $rang, - $num, - $idVersement, $rang, $idVersement - ); - $out .= sprintf(' -
    ', $idVersement, $rang, - $versement->versement/100 - ); - $out .= sprintf(' - %s', - date_format(date_create($versement->date),"d/m/Y")); - $out .= sprintf(' - %s', - $versement->compte); - $out .= sprintf(' - - ' + $versement->versement/100, + date_format(date_create($versement->date),"d/m/Y"), + $versement->compte ); return $out; }); +$tpl->register_function('fin_personne', function ($params) +{ + $out = ' +
    +
    '; + return $out; +}); + +$tpl->register_function('fin_tarif', function ($params) +{ + $out = ' +
    '; + return $out; +}); + // ------------------------------------------------------------------------ // aiguillage // ------------------------------------------------------------------------ diff --git a/www/admin/script.js b/www/admin/script.js index 0829d99..b53db28 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -1,8 +1,8 @@ "use strict"; /** - * Fonction appelée quand on (dé)coche la case de sélection globale - * (dé)sélectionner toutes les cases à cocher de toutes les activités + * Fonction appelée quand on (dé)coche la case globale + * (dé)sélectionner toutes les cases de toutes les activités * @param {HTMLInputElement} idCaseGlobale id de la case globale */ function cocherDecocherTout(idCaseGlobale) @@ -11,21 +11,32 @@ function cocherDecocherTout(idCaseGlobale) let lesDetails = document.querySelectorAll("details.activite"); for (let i = 0; i < lesDetails.length; ++i) { - // itérer sur les personnes - let lesPersonnes = lesDetails[i].querySelectorAll("h4.personne"); - cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); + let idCase = lesDetails[i].querySelector("input[type=checkbox]"); + idCase.checked = idCaseGlobale.checked; + cocherDecocherTarif(idCase); } // changer le message changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); } +/** + * Fonction appelée quand on (dé)coche la case d'activité + * (dé)sélectionner toutes les cases à cocher de cette activité + * @param {HTMLInputElement} idCaseGlobale id de la case d'activité + */ +function cocherDecocherTarif(idCaseGlobale) +{ + let lesPersonnes = idCaseGlobale.closest("details").querySelectorAll("div.personne"); + cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); +} + /** * idem dans le cas des versements des personnes - * @param {HTMLInputElement} idCaseGlobale id de la case globale + * @param {HTMLInputElement} idCaseGlobale id case à cocher d'une personne */ function cocherDecocherToutesLesPersonnes(idCaseGlobale) { - let lesPersonnes = document.querySelectorAll("h4.personne"); + let lesPersonnes = document.querySelectorAll("div.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); } @@ -49,7 +60,7 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) } /** - * Fonction appelée quand on (dé)coche la case globale d'une personne + * Fonction appelée quand on (dé)coche la case d'une personne * - (dé)sélectionner toutes les cases à cocher * - faire le total des cases cochées et l'afficher * @param {HTMLInputElement} idCase id de la case qui a été cochée @@ -63,10 +74,8 @@ function cocherDecocherPersonne(idCase, idTotal) for (let i = 0; i < listeCases.length; ++i) { listeCases[i].checked = idCase.checked; + cocherDecocherVersement(listeCases[i], idTotal); } - // calculer et afficher le total - let listeMontants = fieldset.querySelectorAll("span.montant"); - calculerTotal(listeCases, listeMontants, idTotal); } /** diff --git a/www/admin/style.css b/www/admin/style.css index 7253822..fe146a1 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -2,7 +2,9 @@ div.impair { background: rgba(var(--gSecondColor), 0.15); } -fieldset { +fieldset.versements +{ + margin-left : 4em; -webkit-border-radius:8px; border-radius:8px; } @@ -23,7 +25,6 @@ span.total } summary.activite { - background: rgba(var(--gSecondColor), 0.5); margin-bottom : 0.5em; } summary.personne @@ -32,11 +33,19 @@ summary.personne padding-top : 0; padding-bottom : 0; } -h3.personne, h4.personne +div.personne, div.activite { font-weight : normal; background: rgba(var(--gSecondColor), 0.25); } +h3.activite +{ + display : inline; +} +p.activite +{ + margin-left : 2.5em; +} #signature { padding : 1em 0.5em 0 0.5em; From 556a75d1f8e25b05431608756fcd9dcaab2e340b Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 5 May 2022 07:58:55 +0000 Subject: [PATCH 058/137] =?UTF-8?q?modifications=20cosm=C3=A9tiques=20ongl?= =?UTF-8?q?et=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: a793835de1eacfb9d0e12ab06772a669ebc5fc22545375444bd4ab81f2b645a4 --- templates/config.tpl | 9 ++++---- www/admin/style.css | 49 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/templates/config.tpl b/templates/config.tpl index f7433f1..7c0fd68 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -92,10 +92,11 @@
    {foreach from=$champsNom key="nom" item="champ"} -
    - - -
    +
    +
    +
    + +
    {/foreach} diff --git a/www/admin/style.css b/www/admin/style.css index fe146a1..26db1bb 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -1,10 +1,11 @@ /* liste des versements */ -div.impair { - background: rgba(var(--gSecondColor), 0.15); +div.pair { + background-color: rgba(var(--gSecondColor), 0.15); } fieldset.versements { - margin-left : 4em; + margin-bottom : 0; + margin-right : 0.5em; -webkit-border-radius:8px; border-radius:8px; } @@ -33,10 +34,15 @@ summary.personne padding-top : 0; padding-bottom : 0; } -div.personne, div.activite +div.activite { font-weight : normal; - background: rgba(var(--gSecondColor), 0.25); + background-color: rgba(var(--gSecondColor), 0.4); +} +div.personne +{ + font-weight : normal; + background-color: rgba(var(--gSecondColor), 0.25); } h3.activite { @@ -52,10 +58,6 @@ p.activite max-width: 300px; max-height: 150px; } -dl.config -{ - padding : 1ex 0; -} div.explications ul { @@ -70,3 +72,32 @@ input.check_global { margin : 0.2em 0.5em; } +dl#menu +{ + min-width : 40em; + width : 50%; +} +div.versements +{ + margin-left : 4em; + display: flex; + flex-wrap: wrap; +} +/* config */ +dl.config +{ + padding : 1ex 0; +} +div.champnom +{ + display : flex; + margin-top : 0.25rem; +} +div.infos +{ + border : 1px solid rgba(var(--gMainColor)); + border-radius : 0.25rem; + padding : 0.4rem; + margin-left : 1em; + width : 20em; +} From 4958b885389c69fe4d23964bd173065650006c46 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 5 May 2022 11:57:45 +0000 Subject: [PATCH 059/137] =?UTF-8?q?modifications=20cosm=C3=A9tiques=20ongl?= =?UTF-8?q?et=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 21f83c5e9592879d6bf6da68422ef32c7a12ca5f55444b296bb1e8d37634f43d --- templates/config.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/config.tpl b/templates/config.tpl index 7c0fd68..e4aa2ca 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -29,9 +29,9 @@ {input type="checkbox" name="articlesCGI[]" value=$key label=$article.titre} *}
    - - +
    {/foreach} @@ -43,9 +43,9 @@ {foreach from=$plugin_config->reduction key="key" item="taux"}
    - -
    {/foreach} From 97e2aff0fe3609fca29799e1e1f4d0031c50a22a Mon Sep 17 00:00:00 2001 From: engel <> Date: Tue, 17 May 2022 08:41:55 +0000 Subject: [PATCH 060/137] modif nom ficher PDF ; correction calcul total (centimes) FossilOrigin-Name: 8d2da83c6e981bf1baf617e90a4c40fd266312356dca0da280becb7b9e3f26b7 --- www/admin/action.php | 2 +- www/admin/generer_recus.php | 12 ++++++++++-- www/admin/script.js | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/www/admin/action.php b/www/admin/action.php index 10fd14e..75b5426 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -74,7 +74,7 @@ $tpl->register_function('afficher_debut_personne', function ($params)

    '; $out .= sprintf(' - ', $idVersement, diff --git a/www/admin/generer_recus.php b/www/admin/generer_recus.php index 18d2965..ef64c07 100644 --- a/www/admin/generer_recus.php +++ b/www/admin/generer_recus.php @@ -6,7 +6,6 @@ use Garradin\Files\Files; use Garradin\Entities\Files\File; use Garradin\UserTemplate\UserTemplate; -//use Garradin\Plugin\RecusFiscaux\RecusHTML; use Garradin\Plugin\RecusFiscaux\Utils; use Garradin\Plugin\RecusFiscaux\Personne; @@ -129,7 +128,10 @@ foreach ($totalPersonnes as $idPersonne => $personne) // changer le nom du fichier $nom = str_replace(' ', '_', $personne->nomPrenom); $nom = str_replace("'", "", $nom); - $nomFichier = "recu_" . $_SESSION['annee_recu'] . "_" . $nom . ".pdf"; + $nomFichier = sprintf('%s/recu_%s_%s.pdf', + dirname($nomPDF), + $_SESSION['annee_recu'], + $nom); rename($nomPDF, $nomFichier); // ajouter le nom du fichier à la liste pour mettre dans une archive $listeFichiersPDF[] = $nomFichier; @@ -142,6 +144,12 @@ $fichierZip = Utils::makeArchive( PLUGIN_ROOT . "/zip" ); +//supprimer les fichiers pdf (utile ?) +// foreach ($listeFichiersPDF as $f) +// { +// unlink($f); +// } + /** * Cumuler les versements de chaque personne * @param tableau des versements triés par idUser, date diff --git a/www/admin/script.js b/www/admin/script.js index 8be4be6..71395f7 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -96,7 +96,7 @@ function calculerTotal(listeCases, listeMontants, idTotal) for (let i = 0; i < listeCases.length; ++i) { if (listeCases[i].checked) { - total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "")); + total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "").replace(",", ".")); } } // afficher le total From 68e6afed118b8320281dc4223bccff65234f3945 Mon Sep 17 00:00:00 2001 From: engel <> Date: Wed, 18 May 2022 10:29:19 +0000 Subject: [PATCH 061/137] =?UTF-8?q?int=C3=A9gration=20comptes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: d81e13438cbc9ed585e76b36e2950615b8da359697f2c577673c77460b59064d --- lib/Utils.php | 413 +++++++++++++++-------------- templates/index.tpl | 271 ++++++++++++------- templates/versements_activites.tpl | 24 +- templates/versements_personnes.tpl | 58 +++- www/admin/action.php | 89 +++++-- www/admin/index.php | 31 ++- www/admin/style.css | 11 +- www/admin/versements_activites.php | 53 ++-- www/admin/versements_personnes.php | 80 +----- 9 files changed, 609 insertions(+), 421 deletions(-) diff --git a/lib/Utils.php b/lib/Utils.php index 7d7dc29..d3cf3cf 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -8,35 +8,139 @@ use KD2\ZipWriter; class Utils { /** - * @return tarifs demandés - * @param array $tarifs + * @return informations sur les tarifs */ - public static function getTarifs($tarifs) + public static function getTarifs() { $db = DB::getInstance(); $sql = sprintf( - 'SELECT id, id_service as idActivite, label, description, amount as montant - FROM services_fees - WHERE services_fees.%s', - $db->where('id', $tarifs)); + 'SELECT + id, + id_service as idActivite, + label, + description, + amount as montant + FROM services_fees'); + return Utils::toAssoc($db->get($sql), 'id'); + } + + /** + * @return informations sur les activités + */ + public static function getActivites() + { + $db = DB::getInstance(); + $sql = sprintf( + 'SELECT + services.id, + services.label, + services.description + FROM services'); + return Utils::toAssoc($db->get($sql), 'id'); + } + + /** + * @return comptes sur lesquels des versements de membres ont été faits + * @param string $annee + * @param $op : opérateur de combinaison des comptes + * @param array $comptes + */ + public static function getComptes($annee, $op, $comptes) + { + $db = DB::getInstance(); + $sql = sprintf( + 'SELECT + acc_accounts.id, + acc_accounts.code as codeCompte, + acc_accounts.label as nomCompte + FROM acc_transactions_users + INNER JOIN membres + ON acc_transactions_users.id_user = membres.id + INNER JOIN acc_transactions + ON acc_transactions_users.id_transaction = acc_transactions.id + INNER JOIN acc_transactions_lines + ON acc_transactions_lines.id_transaction = acc_transactions.id + INNER JOIN acc_accounts + ON acc_transactions_lines.id_account = acc_accounts.id + WHERE + (strftime(%s, acc_transactions.date) = "%d" + AND + acc_accounts.%s + ) + GROUP by acc_accounts.id + ORDER by acc_accounts.id', + '"%Y"', + $annee, + $db->where('code', $op, $comptes) + ); + return Utils::toAssoc($db->get($sql), 'id'); + } + + /** + * @return tarifs des activités et comptes ayant des versements de + * membres dans l'année + * @param string $annee + * @param $op : opérateur de combinaison des comptes + * @param array $comptes + */ + public static function getTarifsComptes($annee, $op, $comptes) + { + $db = DB::getInstance(); + $sql = sprintf( + ' + SELECT + services_users.id_fee as idTarif, + acc_accounts.id as idCompte, + acc_accounts.code as codeCompte + FROM acc_transactions_users + INNER JOIN acc_transactions + ON acc_transactions_users.id_transaction = acc_transactions.id + INNER JOIN services_users + ON acc_transactions_users.id_service_user = services_users.id + INNER JOIN services_fees + ON services_users.id_fee = services_fees.id + INNER JOIN acc_transactions_lines + ON acc_transactions_lines.id_transaction = acc_transactions.id + INNER JOIN acc_accounts + ON acc_transactions_lines.id_account = acc_accounts.id + WHERE + (strftime(%s, acc_transactions.date) = "%d" + AND + acc_accounts.%s + ) + GROUP BY services_fees.id,acc_accounts.id + ', + '"%Y"', + $annee, + $db->where('code', $op, $comptes) + ); return $db->get($sql); } /** - * @return activités correspondant aux tarifs demandés - * @param array $tarifs + * faire un tableau associatif avec le résultat d'une requête */ - public static function getActivites($tarifs) + static function toAssoc($array, $nomCle) { - $db = DB::getInstance(); - $sql = sprintf( - 'SELECT services.id, services.label, services.description - FROM services - LEFT JOIN services_fees ON services_fees.id_service = services.id - WHERE services_fees.%s - GROUP BY services.id', - $db->where('id', $tarifs)); - return $db->get($sql); + $assoc = array(); + foreach ($array as $elem) + { + $ro = new \ReflectionObject($elem); + $proprietes = $ro->getProperties(); + $obj = new \stdClass(); + foreach ($proprietes as $p) + { + $pname = $p->getName(); + if ($pname == $nomCle) { + $key = $p->getValue($elem); + } + else { + $obj->$pname = $p->getValue($elem); + } + } + $assoc[$key] = $obj; + } + return $assoc; } /** @@ -44,88 +148,60 @@ class Utils * @param $annee * @param array $champsNom : liste non vide des champs de nom/prénom */ - public static function getVersementsPersonnes($annee, $champsNom) + public static function getVersementsPersonnes($annee, $op, $comptes, $champsNom) { $db = DB::getInstance(); $tri = Utils::combinerTri($champsNom); $sql = sprintf( 'SELECT membres.id as idUser, + acc_accounts.id as idCompte, + acc_accounts.code as codeCompte, acc_transactions_lines.credit as versement, acc_transactions.date FROM acc_transactions_users - INNER JOIN membres on acc_transactions_users.id_user = membres.id - INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id - INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id - INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id + INNER JOIN membres + ON acc_transactions_users.id_user = membres.id + INNER JOIN acc_transactions + ON acc_transactions_users.id_transaction = acc_transactions.id + INNER JOIN acc_transactions_lines + ON acc_transactions_lines.id_transaction = acc_transactions.id + INNER JOIN acc_accounts + ON acc_transactions_lines.id_account = acc_accounts.id WHERE (strftime(%s, acc_transactions.date) = "%d" AND - acc_transactions_lines.credit > 0) - ORDER by %s, acc_transactions.date', + acc_accounts.%s + ) + ORDER by %s, acc_accounts.id, acc_transactions.date', '"%Y"', $annee, + $db->where('code', $op, $comptes), $tri ); return $db->get($sql); } /** - * @return versements correspondants à l'année et aux tarifs donnés - * triés par tarif, nom, date - * @param $annee - * @param array $tarifs + * @return versements correspondants à : + * @param $annee : année fiscale + * @param $tarifs : tarifs sélectionnés + * @param array $comptes : comptes associés aux tarifs * @param array $champsNom : liste non vide des champs de nom/prénom + * @remarks tri par tarif, nom, compte, date */ - public static function getVersementsTarifs($annee, $tarifs, $champsNom) - { - $db = DB::getInstance(); - $tri = Utils::combinerTri($champsNom); - $sql = sprintf( - 'SELECT - services_fees.id as idTarif, - membres.id as idUser, - acc_transactions_lines.credit as versement, - acc_transactions.date - FROM acc_transactions_users - INNER JOIN membres on acc_transactions_users.id_user = membres.id - INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id - INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id - INNER JOIN services_fees on services_users.id_fee = services_fees.id - INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id - WHERE - (strftime(%s, acc_transactions.date) = "%d" - AND - services_fees.%s - AND - acc_transactions_lines.credit > 0) - ORDER by services_fees.id, %s, acc_transactions.date', - '"%Y"', - $annee, - $db->where('id', $tarifs), - $tri - ); - return $db->get($sql); - } - - /** - * @return versements correspondants à l'année et aux comptes donnés - * @param $annee - * @param $op : opérateur de combinaison des comptes - * @param array $comptes - * @param array $champsNom : liste non vide des champs de nom/prénom - * exemples : - * op = 'in', comptes = ['706', '7780', '756'] - * op = 'like', comptes = '7%' - */ - public static function getVersementsComptes($annee, $op, $comptes, $champsNom) + public static function getVersementsTarifsComptes($annee, + $tarifs, + $comptes, + $champsNom) { $db = DB::getInstance(); $tri = Utils::combinerTri($champsNom); $sql = sprintf( 'SELECT services_fees.id as idTarif, - acc_accounts.code as compte, + acc_accounts.id as idCompte, + acc_accounts.code as codeCompte, membres.id as idUser, acc_transactions_lines.credit as versement, acc_transactions.date @@ -145,13 +221,62 @@ class Utils WHERE (strftime(%s, acc_transactions.date) = "%d" AND - acc_accounts.%s + services_fees.%s AND - acc_transactions_lines.credit > 0) - ORDER by %s, acc_transactions.date', + acc_accounts.%s + ) + ORDER by services_fees.id, %s, acc_accounts.id, acc_transactions.date', '"%Y"', $annee, - $db->where('code', $op, $comptes), + $db->where('id', 'in', $tarifs), + $db->where('id', 'in', $comptes), + $tri + ); + return $db->get($sql); + } + + /** + * @return versements correspondants à : + * @param $annee année fiscale + * @param $comptesIsoles comptes NON associés à un tarif + * @param array $champsNom : liste non vide des champs de nom/prénom + * @remarks tri par nom, compte, date + */ + public static function getVersementsComptes($annee, + $comptesIsoles, + $champsNom) + { + $db = DB::getInstance(); + $tri = Utils::combinerTri($champsNom); + $sql = sprintf( + ' + SELECT + 0 as idTarif, + acc_accounts.id as idCompte, + acc_accounts.code as codeCompte, + membres.id as idUser, + acc_transactions_lines.credit as versement, + acc_transactions.date + FROM acc_transactions_users + INNER JOIN membres + ON acc_transactions_users.id_user = membres.id + INNER JOIN acc_transactions + ON acc_transactions_users.id_transaction = acc_transactions.id + INNER JOIN acc_transactions_lines + ON acc_transactions_lines.id_transaction = acc_transactions.id + INNER JOIN acc_accounts + ON acc_transactions_lines.id_account = acc_accounts.id + WHERE + (strftime(%s, acc_transactions.date) = "%d" + AND + acc_accounts.%s + ) + + ORDER by %s, acc_accounts.id, acc_transactions.date + ', + '"%Y"', + $annee, + $db->where('id', 'in', $comptesIsoles), $tri ); return $db->get($sql); @@ -184,8 +309,6 @@ class Utils ON acc_transactions_lines.id_transaction = acc_transactions.id WHERE ( strftime(%s, acc_transactions.date) = "%d" - AND - acc_transactions_lines.credit > 0 AND acc_transactions_users.id_transaction = acc_transactions.id AND @@ -199,7 +322,6 @@ class Utils '"%Y"', $annee ); - // error_log("getDonateurs = " . print_r($sql, true)); $donateurs = array(); foreach (DB::getInstance()->iterate($sql) as $personne) { @@ -239,121 +361,6 @@ class Utils return $tri; } - /** OBSOLETE - * Versements totaux par personne pour une année donnée - * @param année - * @param array $champsNom : liste non vide des champs de nom/prénom - */ - public static function getVersementsTotaux($annee, $champsNom) - { - $tri = Utils::combinerTri($champsNom); - $sql = sprintf( - 'SELECT - membres.id as idUser, - sum(acc_transactions_lines.credit) AS versement - FROM - acc_transactions_users, - membres, - acc_transactions - INNER JOIN acc_transactions_lines - ON acc_transactions_lines.id_transaction = acc_transactions.id - WHERE ( - strftime(%s, acc_transactions.date) = "%d" - AND - acc_transactions_lines.credit > 0 - AND - acc_transactions_users.id_transaction = acc_transactions.id - AND - acc_transactions_users.id_user = membres.id - ) - GROUP by acc_transactions_users.id_user - ORDER by %s COLLATE U_NOCASE', - '"%Y"', - $annee, - $tri); - return DB::getInstance()->get($sql); - } - - public static function getDonateurs_old($annee, $champsNom) : array - { - // concaténer les champs nom/prénoms pour la sélection - $nom = 'trim(' . Utils::combinerChamps($champsNom) . ') as nom,'; - // et pour le tri - $tri = Utils::combinerTri($champsNom); - $sql = - "SELECT - membres.id as idUser, - " . - $nom . " - membres.adresse as adresse, - membres.code_postal as codePostal, - membres.ville as ville - FROM - acc_transactions_users, - membres, - acc_transactions - INNER JOIN acc_transactions_lines - ON acc_transactions_lines.id_transaction = acc_transactions.id - WHERE ( - strftime('%Y', acc_transactions.date) = ? - AND - acc_transactions_lines.credit > 0 - AND - acc_transactions_users.id_transaction = acc_transactions.id - AND - acc_transactions_users.id_user = membres.id - ) - GROUP by membres.id - ORDER by " . $tri . " COLLATE U_NOCASE - "; - $donateurs = array(); - foreach (DB::getInstance()->iterate($sql, $annee) as $personne) - { - $donateurs[$personne->idUser] = new Personne($personne->idUser, - $personne->nom, - $personne->adresse, - $personne->codePostal, - $personne->ville); - } - return $donateurs; - } - - public static function getLignesReduction($lesTaux) - { - foreach ($lesTaux as $elem) - { - $lignes[$elem->taux] = $elem->remarque; - } - return $lignes; - } - - public static function getLigneReduction($taux) - { - return $_SESSION['ligneReduction'][$taux]; - } - - /** - * @return liste de toutes les activités, tarifs et comptes associés - */ - public static function getActivitesTarifsEtComptes() - { - return DB::getInstance()->get( - "SELECT - 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 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 - ORDER BY services.label" - ); - } - /** * @return liste des années fiscales */ @@ -371,11 +378,25 @@ class Utils return $anneesFiscales; } + public static function getLignesReduction($lesTaux) + { + foreach ($lesTaux as $elem) + { + $lignes[$elem->taux] = $elem->remarque; + } + return $lignes; + } + + public static function getLigneReduction($taux) + { + return $_SESSION['ligneReduction'][$taux]; + } + /** * récupérer dans la config du plugin les champs des membres * utilisés pour le nom et le prénom ; ajouter/supprimer les * modifications par rapport à la config garradin - * @return tableau des champs : clé = nom, valeur = { titre, position } + * @return array tableau des champs : clé = nom, valeur = { titre, position } */ public static function getChampsNom($config, $plugin) : array { diff --git a/templates/index.tpl b/templates/index.tpl index 4292f15..abd3ba6 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -1,67 +1,55 @@ {include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="index"} -
    -

    Choisir une méthode de génération des reçus

    +

    Sélectionner les versements pour les reçus

    {* Choisir une des méthodes *} -
    +
    - {* Toutes les personnes *} -

    - - - - - - - - {foreach from=$lesComptes key="idcpt" item="compte"} - - - - {/foreach} - -
    N° et CompteTaux de réduction
    - {if $nbTarifs == 1} - {input - type="checkbox" - name="comptes[]" - value=$idcpt - label="%s : %s"|args:$compte.codeCompte,$compte.nomCompte - checked="checked" - } - {else} - {input - type="checkbox" - name="comptes[]" - value=$idcpt - label="%s : %s"|args:$compte.codeCompte,$compte.nomCompte - } - {/if} - - {foreach from=$plugin_config->reduction item="reduc"} - {if $reduc->valeur == 1} - - 1}disabled{/if} {if $nbTaux == 1}checked{/if} /> - - - {/if} - {/foreach} -
    - {/if} -
    - -

    - {csrf_field key="generer_recus_comptes"} - {button type="submit" name="generer_comptes" label="Poursuivre" shape="right" class="main" onclick="return verifierCases('menu_comptes');" } -

    - -*} - {* Activités et tarifs *} + {* Activités, tarifs et comptes *}
    @@ -174,7 +176,7 @@

    {csrf_field key="recusfiscaux_config"} - {button type="submit" name="save" label="Enregistrer" shape="right" class="main" onclick="return verifierConfig(this.form, articles_cgi, taux_reduction)"} + {button type="submit" name="save" label="Enregistrer" shape="right" class="main" onclick="return verifierConfig(articles_cgi, taux_reduction)"}

    @@ -200,4 +202,4 @@ {/literal} {* scripts divers *} - + \ No newline at end of file diff --git a/templates/index.tpl b/templates/index.tpl index b8621d4..583e1ff 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -78,7 +78,7 @@

    {csrf_field key="generer_tous_recus"} - {button type="submit" name="generer_tous" label="Poursuivre" shape="right" class="main" onclick="return verifierRadio('menu_versements');" } + {button type="submit" name="generer_tous" label="Poursuivre" shape="right" class="main" onclick="return verifierTaux(menu_versements);" }

    @@ -183,7 +183,7 @@

    {csrf_field key="generer_recus_activites"} - {button type="submit" name="generer_activites" label="Poursuivre" shape="right" class="main" onclick="return verifierCases('menu_activites_tarifs');" } + {button type="submit" name="generer_activites" label="Poursuivre" shape="right" class="main" onclick="return verifierActivitésTaux(menu_activites_tarifs);" }

    diff --git a/www/admin/index.php b/www/admin/index.php index a2a240b..4c5e0f3 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -10,11 +10,6 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") $_SESSION['annee_recu'] = date("Y") - 1; } -// error_log("config=" . print_r($plugin->getConfig(), true)); -// error_log("articlesCGI=" . print_r($plugin->getConfig('articlesCGI'), true)); -// error_log("reduction=" . print_r($plugin->getConfig('reduction'), true)); -// error_log("numerotation=" . print_r($plugin->getConfig('numerotation'), true)); - // nombre de taux de réduction activés $nbTaux = 0; foreach ($plugin->getConfig('reduction') as $taux) diff --git a/www/admin/script.js b/www/admin/script.js index fcc700f..e1b03b0 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -1,5 +1,9 @@ "use strict"; +// ------------------------------------------------------------------------ +// actions sur la liste des versements +// ------------------------------------------------------------------------ + /** * Fonction appelée quand on (dé)coche la case globale * (dé)sélectionner toutes les cases de toutes les activités @@ -128,104 +132,6 @@ function changerMessage(message, idCase) } } -/** - * fonction appelée lors de la validation du formulaire - * @return vrai si au moins un choix a été fait - * @param {HTMLFormElement} formulaire - */ -function verifierChoix(formulaire) -{ - let listeCheck = formulaire.getElementsByTagName("input"); - let ok = false; - for (let i = 1; i < listeCheck.length; ++i) - { - if (listeCheck[i].checked) - { - ok = true; - break; - } - } - if (! ok) - { - alert("Erreur : il faut sélectionner au moins un versement"); - } - return ok; -} - -/** - * positionner l'action déclenchée par l'envoi du formulaire - * afficher et masquer des portions de formulaire selon l'action - * @param {HTMLFormElement} formulaire - * @param {string} action après envoi du formulaire - * @param {any} idElem id de l'élément à afficher - * @param {any} nomClasse classe des éléments à masquer (sauf idElem) - */ -function choixMethodeGeneration(formulaire, action, idElem, nomClasse) -{ - formulaire.setAttribute('action', 'action.php?action=' + action); - for (let elem of formulaire.querySelectorAll(nomClasse)) - { - if (elem.id == idElem) - { - elem.classList.remove('hidden'); - } - else - { - elem.classList.add('hidden'); - } - } -} - -/** - * vérifier - * - qu'au moins une activité/tarif est sélectionnée - * - qu'un radio de chaque activité/tarif sélectionné a été sélectionné :) - * @param {string} idElem id du conteneur des cases à vérifier - */ -function verifierCases(idElem) -{ - let div = document.getElementById(idElem); - let nbChoix = 0; - // parcourir les cases à cocher - for (let idCase of div.querySelectorAll("input[type=checkbox]")) - { - if (idCase.checked) { - ++nbChoix; - // vérifier qu'un radio de la même ligne est sélectionné - let ligneCorrecte = false; - // trouver la ligne englobante - let ligne = idCase.closest("li"); - for (let idRadio of ligne.querySelectorAll('input[type=radio]')) - { - if (idRadio.checked) { ligneCorrecte = true; break; } - } - if (! ligneCorrecte) { - alert("Erreur : il faut sélectionner un taux de réduction dans chaque ligne cochée"); - return false; - } - } - } - if (nbChoix == 0) { - alert("Erreur : il faut sélectionner au moins une ligne"); - } - return nbChoix != 0; -} - -/** - * vérifier qu'un radio a été sélectionné dans la div paramètre - * @param {string} idElem id du conteneur des radios à vérifier - */ -function verifierRadio(idElem) -{ - let div = document.getElementById(idElem); - for (let idRadio of div.querySelectorAll('input[type=radio]')) - { - if (idRadio.checked) { return true; } - } - alert("Erreur : il faut sélectionner un taux de réduction"); - return false; -} - /** * afficher/masquer les détails * @param {string} idElem bouton de masquage/affichage @@ -260,32 +166,100 @@ function montrerMasquerDetails(idElem, classe, texte) } /** - * + * fonction appelée lors de la demande de génération des reçus + * vérifier qu'au moins un versement a été sélectionné + * @return vrai si au moins un choix a été fait + * @param {HTMLFormElement} formulaire */ -function aumoinsun(conteneur, message) +function verifierChoix(formulaire) { - let listeCheck = conteneur.querySelectorAll('input[type=checkbox]'); - for (let elem of listeCheck) - { - if (elem.checked) { return true; } - } - alert("Erreur : il faut sélectionner au moins " + message); - return false; + return verifierCases(formulaire, 'checkbox', "au moins un versement"); } + +// ------------------------------------------------------------------------ +// actions sur la page d'accueil +// ------------------------------------------------------------------------ + +/** + * positionner l'action déclenchée par l'envoi du formulaire + * afficher et masquer des portions de formulaire selon l'action + * @param {HTMLFormElement} formulaire + * @param {string} action après envoi du formulaire + * @param {any} idElem id de l'élément à afficher + * @param {any} nomClasse classe des éléments à masquer (sauf idElem) + */ +function choixMethodeGeneration(formulaire, action, idElem, nomClasse) +{ + formulaire.setAttribute('action', 'action.php?action=' + action); + for (let elem of formulaire.querySelectorAll(nomClasse)) + { + if (elem.id == idElem) + { + elem.classList.remove('hidden'); + } + else + { + elem.classList.add('hidden'); + } + } +} + +/** + * vérifier + * - qu'au moins une activité/tarif est sélectionnée + * - qu'un radio de chaque activité/tarif sélectionné a été sélectionné :) + * @param conteneur des cases à vérifier + */ +function verifierActivitésTaux(conteneur) +{ + let nbChoix = 0; + // parcourir les cases à cocher + for (let idCase of conteneur.querySelectorAll("input[type=checkbox]")) + { + if (idCase.checked) { + ++nbChoix; + // vérifier qu'un radio de la même ligne est sélectionné + let ligneCorrecte = false; + // trouver la ligne englobante + let ligne = idCase.closest("li"); + for (let idRadio of ligne.querySelectorAll('input[type=radio]')) + { + if (idRadio.checked) { ligneCorrecte = true; break; } + } + if (! ligneCorrecte) { + alert("Erreur : il faut sélectionner un taux de réduction dans chaque ligne cochée"); + return false; + } + } + } + if (nbChoix == 0) { + alert("Erreur : il faut sélectionner au moins une ligne"); + } + return nbChoix != 0; +} + +/** + * vérifier qu'un taux a été sélectionné dans le conteneur paramètre + */ +function verifierTaux(conteneur) +{ + return verifierCases(conteneur, 'radio', "un taux de réduction"); +} + +// ------------------------------------------------------------------------ +// actions sur la config +// ------------------------------------------------------------------------ + /** * vérifier les données saisies dans le formulaire de configuration -*/ -function verifierConfig( - formulaire, - divArticles, - divTauxReduc -) + */ +function verifierConfig(divArticles, divTauxReduc) { // articles - if (! aumoinsun(divArticles, "un article")) { return false; } + if (! verifierCases(divArticles, "checkbox", "au moins un article")) { return false; } // taux de réduction - if (! aumoinsun(divTauxReduc, "un taux de réduction")) { return false; } + if (! verifierCases(divTauxReduc, "checkbox", "au moins un taux de réduction")) { return false; } // Nom, fonction, signature @@ -293,3 +267,21 @@ function verifierConfig( // alert("Erreur : il faut sélectionner au moins un versement"); return true; } + +/** + * Vérifier qu'au moins une case est cochée dans le conteneur + * @param conteneur + * @param type de case à vérifier (radio, checkbox) + * @param message à afficher si erreur + */ +function verifierCases(conteneur, type, message) +{ + let selecteur = "input[type=" + type + "]"; + let listeCheck = conteneur.querySelectorAll(selecteur); + for (let elem of listeCheck) + { + if (elem.checked) { return true; } + } + alert("Erreur : il faut sélectionner " + message); + return false; +} diff --git a/www/admin/style.css b/www/admin/style.css index 9aad3a5..eb52c78 100644 --- a/www/admin/style.css +++ b/www/admin/style.css @@ -1,7 +1,11 @@ -/* liste des versements */ +/* + * liste des versements + */ + div.pair { background-color: rgba(var(--gSecondColor), 0.15); } + fieldset.versements { margin-bottom : 0; @@ -9,102 +13,128 @@ fieldset.versements -webkit-border-radius:8px; border-radius:8px; } + div span { padding-left : 0.5em; padding-right : 0.5em; } + td.montant { text-align : right; } + span.montant { width : 5em; text-align : right; } + span.total { font-weight : bold; } + summary.activite { margin-bottom : 0.5em; } + summary.personne { margin-bottom : 0.5em; padding-top : 0; padding-bottom : 0; } + div.activite { background-color: rgba(var(--gSecondColor), 0.3); } + div.personne { font-weight : normal; background-color: rgba(var(--gSecondColor), 0.25); } + h3.activite { display : inline; } + p.activite { margin-left : 2.5em; } -#signature -{ - padding : 1em 0.5em 0 0.5em; - max-width: 300px; - max-height: 150px; -} -div.explications ul -{ - list-style : initial; -} - -div.actions -{ - display : inline; -} input.check_global { margin : 0.2em 0.5em; } -dl#menu -{ - min-width : 40em; - width : 50%; -} + div.versements { margin-left : 4em; display: flex; flex-wrap: wrap; } -/* config */ + +/* + * page d'accueil +*/ + +div.explications ul +{ + list-style : initial; +} + +dl#menu +{ + min-width : 40em; + width : 50%; +} + +/* + * configuration + */ + +#signature +{ + padding : 1em 0.5em 0 0.5em; + max-width: 300px; + max-height: 120px; +} + +div.actions +{ + display : inline; +} + dl.config { padding-bottom : 1ex; padding-right : 1em; } -div#articles_cgi + +div#articles_cgi, div#config_nom_fonction, div#numero_recus { display: flex; } + div.article { margin-right : 3em; } +/* div#config_nom_fonction { display: flex; } + div#numero_recus { display:flex; -/* align-items: last baseline;*/ } +*/ div.champnom { display : flex; @@ -130,7 +160,8 @@ ul.reduction span.radio-btn } input#f_prefixe { - max-width : 8em; + width : 8em; + min-width : 8em; } input#f_valeur_init { From 24f489db3fe950150eeadac42192b180feb2262c Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 28 Jan 2023 13:01:51 +0000 Subject: [PATCH 082/137] =?UTF-8?q?Ajustement=20feuille=20de=20style=20re?= =?UTF-8?q?=C3=A7us=20pour=20impression?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 458e766460451c3e96aa43e61551c73fc81bd59a2306490ea3200f467d99b305 --- templates/recu.skel | 57 ++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/templates/recu.skel b/templates/recu.skel index 941ce6a..18a5d65 100644 --- a/templates/recu.skel +++ b/templates/recu.skel @@ -17,53 +17,52 @@ } #entete { - position : relative; } #logo { - position : fixed; - max-width : 4cm; max-height : 4cm; } #titre { - position : fixed; - margin : 0 4.5cm 0 4.5cm; - top : 1cm; + margin : 0 2.5cm 0 2.5cm; text-align : center; font-size : 14pt; font-weight: bold; } #articles { - position : fixed; - margin : 0 4.5cm 0 4.5cm; /* idem titre */ - top : 6em; + margin : 0 2.5cm 0.5cm 2.5cm; text-align : center; } #numRecu { - position : relative; text-align : right; - top : 8em; - right: 1em; + margin-right: 1em; } + #beneficiaire, #donateur + { + } + #beneficiaire, #donateur, #versements, #final { - position : relative; - top : 9em; } + + #beneficiaire > h3 + { + } + #donateur > h3 + { + } + #versements { - position : relative; - top : 9em; border-top: 1px solid rgb(0, 0, 128); border-bottom: 1px solid rgb(0, 0, 128); } .rubrique { background-color : rgb(200, 200, 250); - padding : 2mm; + padding : 0 0 0 1mm; } .titre, .important { @@ -73,6 +72,10 @@ { font-weight: normal; } + #ville + { + margin-bottom: 0; + } #signature { display: block; @@ -81,6 +84,18 @@ margin: 0 auto; padding-bottom : 2mm; } + #final + { + page-break-after: auto; + } + /* + @media print + { + div#imprimer { + display:none; + } + } + */ @@ -97,8 +112,9 @@

    Bénéficiaire des versements

    Association « {{$config.nom_asso}} »
    - {{$config.adresse_asso}}
    - Objet : {{$objet_asso}}

    + {{$config.adresse_asso}}
    + Objet : {{$objet_asso}} +

    @@ -134,7 +150,6 @@ du {{$dateMin}} au {{$dateMax}} {{/if}} -
    {{/versements}} @@ -146,7 +161,7 @@
    -

    {{$ville_asso}} le {{$date}}
    +

    {{$ville_asso}} le {{$date}}

    From dc77dc985b0c6ef8c0c336a911e1db9bdd5bdfa0 Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 28 Jan 2023 13:13:39 +0000 Subject: [PATCH 083/137] Ajout bouton Imprimer FossilOrigin-Name: 662be0694cdcfb01d26daaeb5d6820f9818646b0896f4527ee2c980ae3376537 --- templates/versements_activites.tpl | 18 ++++++++++-------- templates/versements_personnes.tpl | 22 ++++++++++++---------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index c0668f9..e6dbdad 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -7,16 +7,20 @@ + onclick="montrerMasquerDetails(this.id, 'details.activite', 'toutes les activités')"> + Replier toutes les activités - + Replier toutes les personnes + +
    -
    + {* Itération sur les versements *} {foreach from=$lesVersements key="rang" item="versement"} @@ -73,8 +77,6 @@ {fin_compte} {fin_personne} {fin_tarif} - -
    {* scripts divers *} diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index 27dd96d..ffa3e38 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -8,13 +8,17 @@ onclick="cocherDecocherToutesLesPersonnes(check_global)" /> - + onclick="montrerMasquerDetails(this.id, 'details.personne', 'toutes les personnes')"> + Replier toutes les personnes + + -
    + {* Itération sur les personnes *} {foreach from=$lesVersements key="rang" item="versement"} @@ -32,9 +36,9 @@ {fin_compte} {fin_personne} idUser; - $compteCourant = $versement->idCompte; + $pair = true; + $personneCourante = $versement->idUser; + $compteCourant = $versement->idCompte; ?> {afficher_debut_personne user=$personneCourante idVersement=$personneCourante} {afficher_debut_compte idCompte=$compteCourant} @@ -54,8 +58,6 @@ {/foreach} {* Itération sur les personnes *} {fin_compte} {fin_personne} - -
    {* scripts divers *} From f5130172f022d18c767a9522e0eda585a09ecfa4 Mon Sep 17 00:00:00 2001 From: engel <> Date: Tue, 31 Jan 2023 08:46:51 +0000 Subject: [PATCH 084/137] correction petite inexactitude FossilOrigin-Name: 748e03b75b685ff8bb0140b088b598e45c75a6b0875c7d882b0a9b84fc3cb488 --- www/admin/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/admin/script.js b/www/admin/script.js index e1b03b0..c517d65 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -144,7 +144,7 @@ function montrerMasquerDetails(idElem, classe, texte) if (lesDetails.length > 0) { let leBouton = document.getElementById(idElem); - if (leBouton.textContent.startsWith('Replier')) + if (leBouton.textContent.includes('Replier')) { // masquer lesDetails.forEach((e) => { From 0e3c356d1a2ba270eb04ebf177484e7df8833fc9 Mon Sep 17 00:00:00 2001 From: engel <> Date: Tue, 31 Jan 2023 18:35:27 +0000 Subject: [PATCH 085/137] =?UTF-8?q?impl=C3=A9mentation=20impression=20re?= =?UTF-8?q?=C3=A7us?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 81f54c69ca30c343f75b4190728e55d7679b6580724471ec69a6cca70f8f94ea --- templates/recu.skel | 38 +-- templates/recu_html.tpl | 128 ++++++++++ www/admin/config.php | 3 - www/admin/generer_recus.php | 459 +++++++++++++++++++++++------------- www/admin/imprimer_recu.css | 38 +++ www/admin/previs_recu.css | 97 ++++++++ www/admin/script.js | 113 ++++----- 7 files changed, 609 insertions(+), 267 deletions(-) create mode 100644 templates/recu_html.tpl create mode 100644 www/admin/imprimer_recu.css create mode 100644 www/admin/previs_recu.css diff --git a/templates/recu.skel b/templates/recu.skel index 18a5d65..d60fa68 100644 --- a/templates/recu.skel +++ b/templates/recu.skel @@ -8,15 +8,12 @@ size: A4 portrait; margin: 1cm; } - body + body.print { + width : 19cm; font-family: Serif; font-size: 11pt; background-color: white; - width : 19cm; - } - #entete - { } #logo { @@ -24,14 +21,13 @@ } #titre { - margin : 0 2.5cm 0 2.5cm; + margin : 0 2cm 0 2cm; text-align : center; font-size : 14pt; font-weight: bold; } #articles { - margin : 0 2.5cm 0.5cm 2.5cm; text-align : center; } #numRecu @@ -39,20 +35,6 @@ text-align : right; margin-right: 1em; } - #beneficiaire, #donateur - { - } - - #beneficiaire, #donateur, #versements, #final - { - } - - #beneficiaire > h3 - { - } - #donateur > h3 - { - } #versements { @@ -84,22 +66,10 @@ margin: 0 auto; padding-bottom : 2mm; } - #final - { - page-break-after: auto; - } - /* - @media print - { - div#imprimer { - display:none; - } - } - */ - +

    Reçu au titre des dons à certains organismes d'intérêt général

    diff --git a/templates/recu_html.tpl b/templates/recu_html.tpl new file mode 100644 index 0000000..170a47c --- /dev/null +++ b/templates/recu_html.tpl @@ -0,0 +1,128 @@ + +{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="activite"} + + + +
    + +{* Itération sur les personnes *} +{foreach from=$totalPersonnes key="idPersonne" item="personne"} +
    + +
    + +

    Reçu au titre des dons à certains organismes d'intérêt général

    +

    Articles 200, 238 bis et 978 du code général des impôts

    +
    + {if $numero_sequentiel} + {afficher_numero_recu prefixe=$prefixeNum membre=$membre numero_personne=$personne->numero numero_sequentiel=$numero_courant} + + {else} + {afficher_numero_recu prefixe=$prefixeNum membre=$membre numero_personne=$personne->numero numero_sequentiel=$numero_sequentiel} + {/if} +
    +
    + +
    +

    Bénéficiaire des versements

    +

    Association « {$nom_asso} »
    + {$adresse_asso}
    + Objet : {$objet_asso} +

    +
    + +
    +

    Donateur

    +

    + {$personne.nomPrenom}
    + {$personne.adresse}
    + {$personne.code} {$personne.ville} + {if $courriel && $personne.courriel != ""} +
    courriel : {$personne.courriel} + {/if} +

    +
    + +
    +

    Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt :

    +
      + {foreach from=$personne.versements key="taux" item="versement"} +
    • + la somme de ***{$versement.montant|raw|money}*** euros + format((int)($versement->montant / 100)); + if ($versement->montant % 100 != 0) { + $cents = $fmt->format($versement->montant % 100); + } else { + $cents = ""; + } + ?> + {if $cents != ""} + ({$euros} euros et {$cents} cents) + {else} + ({$euros} euros) + {/if} + + {if $libelle != ""} + ({$libelle}) + {/if} +
      date des versements : + {if $versement.dateMin == $versement.dateMax} + le {$versement.dateMin|date_format:"%d/%m/%Y"} + {else} + du {$versement.dateMin|date_format:"%d/%m/%Y"} au {$versement.dateMax|date_format:"%d/%m/%Y"} + {/if} + +
    • + {/foreach} +
    + + {foreach from=$complements item="elem"} +

    {$elem.titre} {$elem.libelle}

    + {/foreach} + +

    Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d'impôt prévue {$texteArticles} du code général des impôts.

    +
    + +
    +

    {$ville_asso} le {$date} + +

    +
    + {$nom_responsable}
    + {$fonction_responsable} +
    +
    +
    + +{/foreach} {* Itération sur les personnes *} +
    + +{* scripts divers *} + + +{* + * remplacer la feuille de style d'impression de paheko par la mienne + * puis déclencher l'impression +*} +{literal} + +{/literal} + + +{include file="admin/_foot.tpl"} \ No newline at end of file diff --git a/www/admin/config.php b/www/admin/config.php index f40b688..842ecb3 100644 --- a/www/admin/config.php +++ b/www/admin/config.php @@ -57,8 +57,6 @@ if (f('save') && $form->check('recusfiscaux_config')) { $plugin->setConfig('ville_asso', trim(f('ville_asso'))); } // signature - // error_log("SESSION['sig_file'] = " . print_r($_SESSION['sig_file'], true)); - // error_log("plugin->getConfig('signature') = " . $plugin->getConfig('signature')); if (isset($_SESSION['sig_file']) && count($_SESSION['sig_file']) > 0) { // supprimer la signature précédente, si besoin @@ -78,7 +76,6 @@ if (f('save') && $form->check('recusfiscaux_config')) { // autres informations // numérotation des reçus $configNum = $plugin->getConfig('numerotation'); - error_log("configNum=" . print_r($configNum, true)); $formNum = clone $configNum; if ($configNum->prefixe != trim(f('prefixe'))) { $formNum->prefixe = trim(f('prefixe')); diff --git a/www/admin/generer_recus.php b/www/admin/generer_recus.php index 25b5d30..a17eb44 100644 --- a/www/admin/generer_recus.php +++ b/www/admin/generer_recus.php @@ -11,39 +11,34 @@ use Garradin\Plugin\RecusFiscaux\Personne; // signature $signature = - (null !== $plugin->getConfig('signature')) ? - Files::get($plugin->getConfig('signature'))->fullpath() : - ""; + (null !== $plugin->getConfig('signature')) ? + \KD2\HTTP::getScheme() . '://' . \KD2\HTTP::getHost() . WWW_URI . "/" . $plugin->getConfig('signature') : + ""; // logo -$logo_file = Files::get(File::CONTEXT_CONFIG . '/logo.png'); +$config = Config::getInstance(); $logo_asso = - (null !== $logo_file) ? - Files::get($logo_file->path)->fullpath() : - ""; + (null !== $config->fileURL('logo')) ? + $config->fileURL('logo') : + ""; // articles du CGI $articlesCGI = array(); -foreach ($plugin->getConfig('articlesCGI') as $article) -{ +foreach ($plugin->getConfig('articlesCGI') as $article) { if ($article->valeur == 1) { $articlesCGI[] = $article->titre; } } $nbArticles = count($articlesCGI); -if ($nbArticles == 1) -{ +if ($nbArticles == 1) { $texteArticles = 'à l’article ' . $articlesCGI[0]; -} -elseif ($nbArticles > 1) -{ +} elseif ($nbArticles > 1) { $texteArticles = 'aux articles '; for ($i = 0; $i < $nbArticles; ++$i) { $texteArticles .= $articlesCGI[$i]; if ($i < $nbArticles - 2) { $texteArticles .= ", "; - } - else if ($i == $nbArticles - 2) { + } else if ($i == $nbArticles - 2) { $texteArticles .= " et "; } } @@ -52,23 +47,8 @@ elseif ($nbArticles > 1) // libellés pour les taux de réduction $libelles_taux = Utils::getLignesReduction($plugin->getConfig('reduction')); +// numérotation des reçus $configNum = $plugin->getConfig('numerotation'); -error_log("config num = " . print_r($configNum, true)); -$prefixeNum = ""; -if (isset($configNum->prefixe) && $configNum->prefixe != "") { - $prefixeNum = $configNum->prefixe; -} -if (isset($configNum->annee) && $configNum->annee) { - if ($prefixeNum != "") { $prefixeNum .= "-"; } - $prefixeNum .= $_SESSION['annee_recu']; -} -if (isset($configNum->sequentiel) && $configNum->sequentiel) { - if (isset($configNum->valeur_init) && $configNum->valeur_init !="") { - $numero_sequentiel = $configNum->valeur_init; - } else { - $numero_sequentiel = 1; - } -} // filtrer les versements sélectionnés $lesLignes = f('selected'); @@ -78,125 +58,178 @@ foreach ($lesLignes as $ligne) { } // cumuler les versements -if ($_GET['type'] == 'personne') -{ +if ($_GET['type'] == 'personne') { $totalPersonnes = cumulerVersementsPersonne($versementsSelectionnes); -} -elseif ($_GET['type'] == 'activite') -{ +} elseif ($_GET['type'] == 'activite') { $totalPersonnes = cumulerVersementsTarif($versementsSelectionnes); } // générer les reçus -$listeFichiersPDF = array(); -$fmt = new \NumberFormatter('fr_FR', \NumberFormatter::SPELLOUT); -foreach ($totalPersonnes as $idPersonne => $personne) -{ - $tpl = new UserTemplate(); - $tpl->setSource(PLUGIN_ROOT . '/templates/recu.skel'); +if ($_GET['format'] == 'pdf') { + genererRecusPDF($totalPersonnes, + $signature, + $logo_asso, + $texteArticles, + $plugin, + $configNum, + $libelles_taux + ); +} else if ($_GET['format'] == 'print') { + generererRecusHTML($tpl, + $totalPersonnes, + $signature, + $logo_asso, + $texteArticles, + $plugin, + $configNum, + $libelles_taux + ); +} else { + // Erreur : format inconnu ; ne devrait pas se produire +} - $tpl->assignArray(compact('signature', 'logo_asso', 'texteArticles')); +function genererRecusPDF($totalPersonnes, + $signature, + $logo_asso, + $texteArticles, + $plugin, + $configNum, + $libelles_taux +) +{ + $listeFichiersPDF = array(); + $fmt = new \NumberFormatter('fr_FR', \NumberFormatter::SPELLOUT); + $prefixeNum = getNumPrefixe($configNum); + $numero_sequentiel = getNumSequentiel($configNum); + foreach ($totalPersonnes as $idPersonne => $personne) { + $tpl = new UserTemplate(); + $tpl->setSource(PLUGIN_ROOT . '/templates/recu.skel'); + + $tpl->assignArray(compact('signature', 'logo_asso', 'texteArticles')); + $tpl->assign('objet_asso', $plugin->getConfig('objet_asso')); + $tpl->assign('nom_responsable', $plugin->getConfig('nom_responsable')); + $tpl->assign('fonction_responsable', $plugin->getConfig('fonction_responsable')); + $tpl->assign('ville_asso', $plugin->getConfig('ville_asso')); + $tpl->assign('nom', $personne->nomPrenom); + $tpl->assign('adresse', $personne->adresse); + $tpl->assign('code_postal', $personne->codePostal); + $tpl->assign('ville', $personne->ville); + $tpl->assign('date', date("j/m/Y")); + + // numéro de reçu + $tpl->assign('numero', + faireNumeroRecu($prefixeNum, + $configNum->membre, + $personne->numero, + $numero_sequentiel)); + + // adresse de courriel + if ($plugin->getConfig('imprimerCourriel')) { + $courriel = $personne->courriel; + } else { + $courriel = ""; + } + $tpl->assign('courriel', $courriel); + + // les versements + $tpl->registerSection( + 'versements', + function () use ($personne, $libelles_taux, $fmt) { + foreach ($personne->versements as $taux => $versement) { + $ligne['montant'] = $versement->montant; + $ligne['euros'] = $fmt->format((int)($versement->montant / 100)); + if ($versement->montant % 100 != 0) { + $ligne['cents'] = $fmt->format($versement->montant % 100); + } else { + $ligne['cents'] = ""; + } + $ligne['libelle'] = $libelles_taux[$taux]; + $ligne['dateMin'] = date("d/m/Y", $versement->dateMin); + $ligne['dateMax'] = date("d/m/Y", $versement->dateMax); + yield $ligne; + } + } + ); + + // mentions complémentaires + $complements = mentionsComplémentaires(); + + $tpl->registerSection( + 'informations', + function () use ($complements) { + foreach ($complements as $elem) { + yield (array) $elem; + } + } + ); + + // fabriquer le fichier PDF + genererPDF($tpl->fetch(), $personne->nomPrenom, $listeFichiersPDF); + } + + // faire une archive zip + $fichierZip = Utils::makeArchive( + $listeFichiersPDF, + $_SESSION['annee_recu'], + PLUGIN_ROOT . "/zip" + ); + + //supprimer les fichiers pdf (utile ?) + foreach ($listeFichiersPDF as $f) { + // Utils::safe_unlink($f); + } +} // genererRecusPDF + +function generererRecusHTML($tpl, + $totalPersonnes, + $signature, + $logo_asso, + $texteArticles, + $plugin, + $configNum, + $libelles_taux +) +{ + $tpl->register_function('afficher_numero_recu', function($params) + { + $prefixeNum = $params['prefixe']; + $membre = $params['membre']; + $numero_personne = $params['numero_personne']; + $numero_sequentiel = $params['numero_sequentiel']; + $numero = faireNumeroRecu($prefixeNum, + $membre, + $numero_personne, + $numero_sequentiel); + $out = sprintf(' +

    Reçu %s

    ', + $numero + ); + return $out; + }); + + $tpl->assign(compact( + 'totalPersonnes', + 'logo_asso', + 'signature', + 'libelles_taux', + 'texteArticles' + )); + $tpl->assign('prefixeNum', getNumPrefixe($configNum)); + $tpl->assign('membre', $configNum->membre); + $tpl->assign('numero_sequentiel', getNumSequentiel($configNum)); + $tpl->assign('nom_asso', Config::getInstance()->get('nom_asso')); + $tpl->assign('adresse_asso', Config::getInstance()->get('adresse_asso')); $tpl->assign('objet_asso', $plugin->getConfig('objet_asso')); + $tpl->assign('courriel', $plugin->getConfig('imprimerCourriel')); + $tpl->assign('complements', mentionsComplémentaires()); + $tpl->assign('ville_asso', $plugin->getConfig('ville_asso')); + $tpl->assign('date', date("j/m/Y")); $tpl->assign('nom_responsable', $plugin->getConfig('nom_responsable')); $tpl->assign('fonction_responsable', $plugin->getConfig('fonction_responsable')); - $tpl->assign('ville_asso', $plugin->getConfig('ville_asso')); - $tpl->assign('nom', $personne->nomPrenom); - $tpl->assign('adresse', $personne->adresse); - $tpl->assign('code_postal', $personne->codePostal); - $tpl->assign('ville', $personne->ville); - $tpl->assign('date', date("j/m/Y")); - // numéro de reçu - $chaineNum = $prefixeNum; - if (isset($configNum->membre) && $configNum->membre) { - if ($chaineNum != "") { $chaineNum .= "-"; } - $chaineNum .= $personne->numero; - } - if (isset($configNum->sequentiel) && $configNum->sequentiel) { - if ($chaineNum != "") { $chaineNum .= "-"; } - $chaineNum .= $numero_sequentiel; - ++$numero_sequentiel; - } - $tpl->assign('numero', $chaineNum); - // adresse de courriel - if ($plugin->getConfig('imprimerCourriel')) { - $courriel = $personne->courriel; - } - else { - $courriel = ""; - } - $tpl->assign('courriel', $courriel); - - // les versements - $tpl->registerSection('versements', - function () use($personne, $libelles_taux, $fmt) - { - foreach ($personne->versements as $taux => $versement) - { - $ligne['montant'] = $versement->montant; - $ligne['euros'] = $fmt->format((int)($versement->montant/100)); - if ($versement->montant % 100 != 0) { - $ligne['cents'] = $fmt->format($versement->montant % 100); - } else { - $ligne['cents'] = ""; - } - $ligne['libelle'] = $libelles_taux[$taux]; - $ligne['dateMin'] = date("d/m/Y", $versement->dateMin); - $ligne['dateMax'] = date("d/m/Y", $versement->dateMax); - yield $ligne; - } - }); - - // mentions complémentaires - $donnees = array( - 'Nature du don : ' => "Numéraire", - 'Mode de versement : ' => "chèque et/ou virement" - ); - $infos = array(); - foreach ($donnees as $titre => $libelle) - { - $elem = new \stdClass(); - $elem->titre = $titre; - $elem->libelle = $libelle; - $infos[] = $elem; - } - - $tpl->registerSection('informations', - function () use ($infos) - { - foreach ($infos as $elem) - { - yield (array) $elem; - } - }); - - // fabriquer le fichier PDF - $result = $tpl->fetch(); - $nomPDF = \Garradin\Utils::filePDF($result); - // changer le nom du fichier - $nom = str_replace(' ', '_', $personne->nomPrenom); - $nom = str_replace("'", "", $nom); - $nomFichier = sprintf('%s/recu_%s_%s.pdf', - dirname($nomPDF), - $_SESSION['annee_recu'], - $nom); - rename($nomPDF, $nomFichier); - // ajouter le nom du fichier à la liste pour mettre dans une archive - $listeFichiersPDF[] = $nomFichier; -} - -// faire une archive zip -$fichierZip = Utils::makeArchive( - $listeFichiersPDF, - $_SESSION['annee_recu'], - PLUGIN_ROOT . "/zip" -); - -//supprimer les fichiers pdf (utile ?) -foreach ($listeFichiersPDF as $f) -{ - unlink($f); -} + $tpl->assign('plugin_css', ['previs_recu.css', 'imprimer_recu.css']); + $tpl->display(PLUGIN_ROOT . '/templates/recu_html.tpl'); +} // generererRecusHTML /** * Cumuler les versements de chaque personne @@ -210,13 +243,10 @@ function cumulerVersementsPersonne($versements) $dateMin = PHP_INT_MAX; $dateMax = -1; $totalVersements = 0; - foreach ($versements as $ligne) - { - if ($ligne->idUser != $idPersonneCourant) - { + foreach ($versements as $ligne) { + if ($ligne->idUser != $idPersonneCourant) { // changement de personne - if ($idPersonneCourant != -1) - { + if ($idPersonneCourant != -1) { $totalPersonnes[$idPersonneCourant]->ajouterVersement( $_SESSION['taux_reduction'], $totalVersements, @@ -229,15 +259,18 @@ function cumulerVersementsPersonne($versements) $idPersonneCourant = $ligne->idUser; $totalVersements = $ligne->versement; // créer les infos de la personne, sauf si elle est déjà présente - if (!array_key_exists($idPersonneCourant, $totalPersonnes)) - { - $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); + if (!array_key_exists($idPersonneCourant, $totalPersonnes)) { + $totalPersonnes[$idPersonneCourant] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); } } else { // même personne : cumuler versements et mettre à jour les dates $totalVersements += $ligne->versement; - if (strtotime($ligne->date) < $dateMin) { $dateMin = strtotime($ligne->date); } - if (strtotime($ligne->date) > $dateMax) { $dateMax = strtotime($ligne->date); } + if (strtotime($ligne->date) < $dateMin) { + $dateMin = strtotime($ligne->date); + } + if (strtotime($ligne->date) > $dateMax) { + $dateMax = strtotime($ligne->date); + } } } // et le dernier @@ -248,7 +281,7 @@ function cumulerVersementsPersonne($versements) $dateMax ); return $totalPersonnes; -} +} // cumulerVersementsPersonne /** * Cumuler les versements de chaque personne par tarif @@ -264,20 +297,17 @@ function cumulerVersementsTarif($versements) $dateMin = PHP_INT_MAX; $dateMax = -1; $totalVersements = 0; - foreach ($versements as $ligne) - { + foreach ($versements as $ligne) { if ( $ligne->idTarif != $idTarifCourant || $ligne->idUser != $idPersonneCourant || $ligne->idCompte != $idCompteCourant - ) - { - if ($idTarifCourant != -1) - { + ) { + if ($idTarifCourant != -1) { // changement de tarif, de personne ou de compte $tarifCompte = ($idTarifCourant == 0) ? - $idCompteCourant : - $idTarifCourant . "_" . $idCompteCourant; + $idCompteCourant : + $idTarifCourant . "_" . $idCompteCourant; $totalPersonnes[$idPersonneCourant]->ajouterVersement( $_SESSION['tauxSelectionnes'][$tarifCompte], $totalVersements, @@ -292,21 +322,24 @@ function cumulerVersementsTarif($versements) $idCompteCourant = $ligne->idCompte; $totalVersements = $ligne->versement; // créer les infos de la personne, sauf si elle est déjà présente - if (!array_key_exists($idPersonneCourant, $totalPersonnes)) - { - $totalPersonnes["$idPersonneCourant"] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); + if (!array_key_exists($idPersonneCourant, $totalPersonnes)) { + $totalPersonnes[$idPersonneCourant] = $_SESSION['membresDonateurs'][$ligne->idUser]->clone(); } } else { // même personne : cumuler versements et mettre à jour les dates $totalVersements += $ligne->versement; - if (strtotime($ligne->date) < $dateMin) { $dateMin = strtotime($ligne->date); } - if (strtotime($ligne->date) > $dateMax) { $dateMax = strtotime($ligne->date); } + if (strtotime($ligne->date) < $dateMin) { + $dateMin = strtotime($ligne->date); + } + if (strtotime($ligne->date) > $dateMax) { + $dateMax = strtotime($ligne->date); + } } } // et le dernier $tarifCompte = ($idTarifCourant == 0) ? - $idCompteCourant : - $idTarifCourant . "_" . $idCompteCourant; + $idCompteCourant : + $idTarifCourant . "_" . $idCompteCourant; $totalPersonnes[$idPersonneCourant]->ajouterVersement( $_SESSION['tauxSelectionnes'][$tarifCompte], $totalVersements, @@ -314,4 +347,94 @@ function cumulerVersementsTarif($versements) $dateMax ); return $totalPersonnes; +} // cumulerVersementsTarif + +/** + * génère un fichier PDF à partir d'un document html + * ajoute son nom à la liste de fichiers + */ +function genererPDF($docHTML, $nomPersonne, &$listeFichiersPDF) +{ + // fabriquer le fichier PDF + $nomPDF = \Garradin\Utils::filePDF($docHTML); + // changer le nom du fichier + $nom = str_replace(' ', '_', $nomPersonne); + $nom = str_replace("'", "", $nom); + $nomFichier = sprintf( + '%s/recu_%s_%s.pdf', + dirname($nomPDF), + $_SESSION['annee_recu'], + $nom + ); + rename($nomPDF, $nomFichier); + // ajouter le nom du fichier à la liste pour mettre dans une archive + $listeFichiersPDF[] = $nomFichier; +} // genererPDF + +function faireNumeroRecu($prefixeNum, $membre, $numero, &$numero_sequentiel) +{ + if (isset($membre) && $membre) { + if ($prefixeNum != "") { + $prefixeNum .= "-"; + } + $prefixeNum .= $numero; + } + if ($numero_sequentiel) { + if ($prefixeNum != "") { + $prefixeNum .= "-"; + } + $prefixeNum .= $numero_sequentiel; + ++$numero_sequentiel; + } + return $prefixeNum; +} + +/** + * renvoyer le préfixe du numéro de reçu + */ +function getNumPrefixe($configNum) +{ + $prefixeNum = ""; + if (isset($configNum->prefixe) && $configNum->prefixe != "") { + $prefixeNum = $configNum->prefixe; + } + if (isset($configNum->annee) && $configNum->annee) { + if ($prefixeNum != "") { + $prefixeNum .= "-"; + } + $prefixeNum .= $_SESSION['annee_recu']; + } + return $prefixeNum; +} + +/** + * renvoyer le premier numéro de la numérotation séquentielle + * renvoie false si pas de numérotation séquentielle + */ +function getNumSequentiel($configNum) +{ + if (isset($configNum->sequentiel) && $configNum->sequentiel) { + if (isset($configNum->valeur_init) && $configNum->valeur_init != "") { + $numero_sequentiel = $configNum->valeur_init; + } else { + $numero_sequentiel = 1; + } + } + return isset($numero_sequentiel) ? $numero_sequentiel : false; +} + +function mentionsComplémentaires() +{ + $donnees = array( + 'Nature du don : ' => "Numéraire", + 'Mode de versement : ' => "chèque et/ou virement" + ); + $complements = array(); + foreach ($donnees as $titre => $libelle) { + $elem = new \stdClass(); + $elem->titre = $titre; + $elem->libelle = $libelle; + $complements[] = $elem; + } + return $complements; } diff --git a/www/admin/imprimer_recu.css b/www/admin/imprimer_recu.css new file mode 100644 index 0000000..8a51941 --- /dev/null +++ b/www/admin/imprimer_recu.css @@ -0,0 +1,38 @@ +/* + * impression + */ +@page +{ + size: A4 portrait; +} + +header.header { + display: none; +} + +body { + background: #fff; + padding: 0; + margin: 0; +} + +.noprint { + display: none; +} + +nav.tabs +{ + display: none; +} + +main { + margin: 0; +} + +div.previs_recu +{ + font-family: Serif; + font-size: 11pt; + background-color: white; + page-break-after: always; +} diff --git a/www/admin/previs_recu.css b/www/admin/previs_recu.css new file mode 100644 index 0000000..0bf2103 --- /dev/null +++ b/www/admin/previs_recu.css @@ -0,0 +1,97 @@ +/* + * prévisualisation reçu au format HTML + */ + +div.previs_recu +{ + width : 18.5cm; +} + +#logo +{ + max-height : 4cm; +} + +#titre +{ + margin : 0 2cm 0 2cm; + text-align : center; + font-size : 14pt; + font-weight: bold; +} + +#articles +{ + margin-bottom: 0.5cm; + text-align : center; +} + +#numRecu +{ + text-align : right; + margin-right: 1em; +} + +#versements +{ + border-top: 1px solid rgb(0, 0, 128); + border-bottom: 1px solid rgb(0, 0, 128); + padding-top: 1em; + margin-bottom: 1em; +} + +.cartouche +{ + padding-bottom: 1em; +} + +.rubrique +{ + background-color : rgb(200, 200, 250); + padding : 0 0 0 1mm; + margin-bottom: 1em; +} + +.titre, .important +{ + font-weight:bold; +} +.libelle +{ + font-weight: normal; +} + +#ville +{ + margin-bottom: 0; +} + +#signature +{ + display: block; + max-width : 7cm; + max-height : 4cm; + margin: 0 auto; + padding-bottom : 2mm; +} + +#versements > ul +{ + list-style: inside; + margin-left: 2em; +} + +#date_versements +{ + margin-left: 1.5em; +} + +p.complements +{ + margin-top : 1em; +} + +span.titre, span.libelle +{ + display : inline; +} diff --git a/www/admin/script.js b/www/admin/script.js index c517d65..a46ce9a 100644 --- a/www/admin/script.js +++ b/www/admin/script.js @@ -9,12 +9,10 @@ * (dé)sélectionner toutes les cases de toutes les activités * @param {HTMLInputElement} idCaseGlobale id de la case globale */ -function cocherDecocherTout(idCaseGlobale) -{ +function cocherDecocherTout(idCaseGlobale) { // itérer sur la liste des éléments détails : 1 par couple let lesDetails = document.querySelectorAll("details.activite"); - for (let i = 0; i < lesDetails.length; ++i) - { + for (let i = 0; i < lesDetails.length; ++i) { let idCase = lesDetails[i].querySelector("input[type=checkbox]"); idCase.checked = idCaseGlobale.checked; cocherDecocherTarif(idCase); @@ -28,8 +26,7 @@ function cocherDecocherTout(idCaseGlobale) * (dé)sélectionner toutes les cases de cette activité * @param {HTMLInputElement} idCaseGlobale id de la case d'activité */ -function cocherDecocherTarif(idCaseGlobale) -{ +function cocherDecocherTarif(idCaseGlobale) { let lesPersonnes = idCaseGlobale.closest("details").querySelectorAll("div.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); } @@ -38,8 +35,7 @@ function cocherDecocherTarif(idCaseGlobale) * idem dans le cas des versements des personnes * @param {HTMLInputElement} idCaseGlobale id case à cocher d'une personne */ -function cocherDecocherToutesLesPersonnes(idCaseGlobale) -{ +function cocherDecocherToutesLesPersonnes(idCaseGlobale) { let lesPersonnes = document.querySelectorAll("div.personne"); cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes); changerMessage(idCaseGlobale.nextElementSibling, idCaseGlobale); @@ -49,10 +45,8 @@ function cocherDecocherToutesLesPersonnes(idCaseGlobale) * @param {HTMLInputElement} idCaseGlobale * @param {NodeListOf} lesPersonnes */ -function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) -{ - for (let j = 0; j < lesPersonnes.length; ++j) - { +function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) { + for (let j = 0; j < lesPersonnes.length; ++j) { // trouver l'élément total de la personne let idTotal = lesPersonnes[j].querySelector("span"); // puis la case à cocher @@ -70,13 +64,11 @@ function cocherDecocherLesPersonnes(idCaseGlobale, lesPersonnes) * @param {HTMLInputElement} idCase id de la case qui a été cochée * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ -function cocherDecocherPersonne(idCase, idTotal) -{ +function cocherDecocherPersonne(idCase, idTotal) { // chercher le fieldset des versements let fieldset = idCase.closest("details").querySelector("div.versements"); let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); - for (let i = 0; i < listeCases.length; ++i) - { + for (let i = 0; i < listeCases.length; ++i) { listeCases[i].checked = idCase.checked; cocherDecocherVersement(listeCases[i], idTotal); } @@ -89,8 +81,7 @@ function cocherDecocherPersonne(idCase, idTotal) * @param {HTMLInputElement} idCase id de la case qui a été cochée * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ -function cocherDecocherVersement(idCase, idTotal) -{ +function cocherDecocherVersement(idCase, idTotal) { let fieldset = idCase.closest("div.versements"); let listeCases = fieldset.querySelectorAll("input[type=checkbox]"); let listeMontants = fieldset.querySelectorAll("span.montant"); @@ -103,19 +94,19 @@ function cocherDecocherVersement(idCase, idTotal) * @param {NodeListOf} listeMontants liste des montants associés * @param {HTMLSpanElement} idTotal id de l'élément où afficher le total */ -function calculerTotal(listeCases, listeMontants, idTotal) -{ +function calculerTotal(listeCases, listeMontants, idTotal) { let total = 0; - for (let i = 0; i < listeCases.length; ++i) - { + for (let i = 0; i < listeCases.length; ++i) { if (listeCases[i].checked) { total += parseFloat(listeMontants[i].textContent.replace(/\s/g, "").replace(",", ".")); } } // afficher le total idTotal.innerHTML = - total.toLocaleString('fr-FR', {style: 'currency', currency: 'EUR', - minimumFractionDigits: 2}); + total.toLocaleString('fr-FR', { + style: 'currency', currency: 'EUR', + minimumFractionDigits: 2 + }); } /** @@ -123,8 +114,7 @@ function calculerTotal(listeCases, listeMontants, idTotal) * @param {Element} message * @param {HTMLInputElement} idCase */ -function changerMessage(message, idCase) -{ +function changerMessage(message, idCase) { if (idCase.checked) { message.innerHTML = "Cliquer pour dé-cocher toutes les lignes"; } else { @@ -138,14 +128,11 @@ function changerMessage(message, idCase) * @param {string} classe des détails à afficher/masquer * @param {string} texte du bouton */ -function montrerMasquerDetails(idElem, classe, texte) -{ +function montrerMasquerDetails(idElem, classe, texte) { let lesDetails = document.querySelectorAll(classe); - if (lesDetails.length > 0) - { + if (lesDetails.length > 0) { let leBouton = document.getElementById(idElem); - if (leBouton.textContent.includes('Replier')) - { + if (leBouton.textContent.includes('Replier')) { // masquer lesDetails.forEach((e) => { e.removeAttribute('open'); @@ -153,8 +140,7 @@ function montrerMasquerDetails(idElem, classe, texte) leBouton.textContent = "Déplier " + texte; leBouton.setAttribute('data-icon', '↓'); } - else - { + else { // montrer lesDetails.forEach((e) => { e.setAttribute('open', 'open'); @@ -171,8 +157,7 @@ function montrerMasquerDetails(idElem, classe, texte) * @return vrai si au moins un choix a été fait * @param {HTMLFormElement} formulaire */ -function verifierChoix(formulaire) -{ +function verifierChoix(formulaire) { return verifierCases(formulaire, 'checkbox', "au moins un versement"); } @@ -188,17 +173,13 @@ function verifierChoix(formulaire) * @param {any} idElem id de l'élément à afficher * @param {any} nomClasse classe des éléments à masquer (sauf idElem) */ -function choixMethodeGeneration(formulaire, action, idElem, nomClasse) -{ +function choixMethodeGeneration(formulaire, action, idElem, nomClasse) { formulaire.setAttribute('action', 'action.php?action=' + action); - for (let elem of formulaire.querySelectorAll(nomClasse)) - { - if (elem.id == idElem) - { + for (let elem of formulaire.querySelectorAll(nomClasse)) { + if (elem.id == idElem) { elem.classList.remove('hidden'); } - else - { + else { elem.classList.add('hidden'); } } @@ -210,23 +191,20 @@ function choixMethodeGeneration(formulaire, action, idElem, nomClasse) * - qu'un radio de chaque activité/tarif sélectionné a été sélectionné :) * @param conteneur des cases à vérifier */ -function verifierActivitésTaux(conteneur) -{ +function verifierActivitésTaux(conteneur) { let nbChoix = 0; // parcourir les cases à cocher - for (let idCase of conteneur.querySelectorAll("input[type=checkbox]")) - { + for (let idCase of conteneur.querySelectorAll("input[type=checkbox]")) { if (idCase.checked) { ++nbChoix; // vérifier qu'un radio de la même ligne est sélectionné let ligneCorrecte = false; // trouver la ligne englobante let ligne = idCase.closest("li"); - for (let idRadio of ligne.querySelectorAll('input[type=radio]')) - { + for (let idRadio of ligne.querySelectorAll('input[type=radio]')) { if (idRadio.checked) { ligneCorrecte = true; break; } } - if (! ligneCorrecte) { + if (!ligneCorrecte) { alert("Erreur : il faut sélectionner un taux de réduction dans chaque ligne cochée"); return false; } @@ -241,8 +219,7 @@ function verifierActivitésTaux(conteneur) /** * vérifier qu'un taux a été sélectionné dans le conteneur paramètre */ -function verifierTaux(conteneur) -{ +function verifierTaux(conteneur) { return verifierCases(conteneur, 'radio', "un taux de réduction"); } @@ -253,17 +230,16 @@ function verifierTaux(conteneur) /** * vérifier les données saisies dans le formulaire de configuration */ -function verifierConfig(divArticles, divTauxReduc) -{ +function verifierConfig(divArticles, divTauxReduc) { // articles - if (! verifierCases(divArticles, "checkbox", "au moins un article")) { return false; } + if (!verifierCases(divArticles, "checkbox", "au moins un article")) { return false; } // taux de réduction - if (! verifierCases(divTauxReduc, "checkbox", "au moins un taux de réduction")) { return false; } + if (!verifierCases(divTauxReduc, "checkbox", "au moins un taux de réduction")) { return false; } // Nom, fonction, signature - + // alert("Erreur : il faut sélectionner au moins un versement"); return true; } @@ -274,14 +250,27 @@ function verifierConfig(divArticles, divTauxReduc) * @param type de case à vérifier (radio, checkbox) * @param message à afficher si erreur */ -function verifierCases(conteneur, type, message) -{ +function verifierCases(conteneur, type, message) { let selecteur = "input[type=" + type + "]"; let listeCheck = conteneur.querySelectorAll(selecteur); - for (let elem of listeCheck) - { + for (let elem of listeCheck) { if (elem.checked) { return true; } } alert("Erreur : il faut sélectionner " + message); return false; } + +/** + * petite bidouille pour utiliser ma feuille de style pour imprimer les reçus + * à la place de la feuille de style de paheko + * @param {*} document + */ +function changerStyle(document) { + let styles = document.querySelectorAll('link[rel="stylesheet"]'); + // console.log(styles); + for (let sheet of styles) { + if (sheet.href.includes('print.css')) { sheet.media = "tv"; sheet.remove; } + if (sheet.href.includes('imprimer_recu.css')) { sheet.media = 'print'; } + } + // console.log(styles); +} \ No newline at end of file From 44d37ae3bdcfea84a60d61f4b9fe042fb4afea7c Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 4 Feb 2023 15:31:31 +0000 Subject: [PATCH 086/137] =?UTF-8?q?Am=C3=A9lioration=20pr=C3=A9sentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: a4763220c440d0e20d7f2091c791740ffee413514dd2587ddbd0acc180e789ef --- templates/versements_activites.tpl | 17 ++++++++++------- templates/versements_personnes.tpl | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index e6dbdad..4b50d24 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -1,7 +1,7 @@ {include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="activite"} -

    Versements par activité et tarif

    +

    Année {$annee_recu} : versements par activité et tarif

    @@ -12,12 +12,15 @@ - - +
    + {button type="submit" label="Télécharger les reçus au format PDF" shape="download" + form="versements_activites" + formaction="generer_recus.php?type=activite&format=pdf" + onclick="return verifierChoix(this.form)"} + {button type="submit" target="_dialog" label="Imprimer les reçus" shape="print" + form="versements_activites" + formaction="generer_recus.php?type=activite&format=print" + onclick="return verifierChoix(this.form)"}
    diff --git a/templates/versements_personnes.tpl b/templates/versements_personnes.tpl index ffa3e38..f6dcf59 100644 --- a/templates/versements_personnes.tpl +++ b/templates/versements_personnes.tpl @@ -1,7 +1,7 @@ {include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="personne"} -

    Versements par personne

    +

    Année {$annee_recu} : versements par personne

    Replier toutes les personnes - - +
    + {button type="submit" label="Télécharger les reçus au format PDF" shape="download" + form="versements_personnes" + formaction="generer_recus.php?type=personne&format=pdf" + onclick="return verifierChoix(this.form)"} + {button type="submit" target="_dialog" label="Imprimer les reçus" shape="print" + form="versements_personnes" + formaction="generer_recus.php?type=personne&format=print" + onclick="return verifierChoix(this.form)"}
    From 6b000bc5bdd4afa778daf7339b0c443a9b8fdfa1 Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 4 Feb 2023 15:32:03 +0000 Subject: [PATCH 087/137] =?UTF-8?q?Am=C3=A9lioration=20navigation=20;=20co?= =?UTF-8?q?rrection=20erreur=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 21a10381cd0e6acfae85483ee95ca78652bf5671d731f7fb289e225626c26fdb --- templates/recu_html.tpl | 17 +++++++- www/admin/versements_activites.php | 63 +++++++++++++++++++----------- www/admin/versements_personnes.php | 10 ++++- 3 files changed, 64 insertions(+), 26 deletions(-) diff --git a/templates/recu_html.tpl b/templates/recu_html.tpl index 170a47c..e7de081 100644 --- a/templates/recu_html.tpl +++ b/templates/recu_html.tpl @@ -1,5 +1,8 @@ + -{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="activite"} +{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="%s"|args:$nav} date des versements : + dateMin); + $dmax = date("d/m/Y", $versement->dateMax); + ?> + {if $versement.dateMin == $versement.dateMax} + le {$dmin} + {else} + du {$dmin} au {$dmax} + {/if} +{* + Erreur : dates décalées d'un jour (en arrière) {if $versement.dateMin == $versement.dateMax} le {$versement.dateMin|date_format:"%d/%m/%Y"} {else} du {$versement.dateMin|date_format:"%d/%m/%Y"} au {$versement.dateMax|date_format:"%d/%m/%Y"} {/if} +*} {/foreach} diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php index d2fa478..6545123 100644 --- a/www/admin/versements_activites.php +++ b/www/admin/versements_activites.php @@ -9,39 +9,56 @@ use Garradin\Plugin\RecusFiscaux\Utils; // récupérer les infos du formulaire // ------------------------------------------------------------ -// vérifier qu'on a bien sélectionné une activité ou un compe -if (null === f('tarifs') && null === f('comptes')) +// vérifier qu'on a bien sélectionné une activité ou un compte +if (! isset($_SESSION['tauxSelectionnes']) + && + null === f('tarifs') + && + null === f('comptes')) { \Garradin\Utils::redirect(PLUGIN_URL . 'index.php'); } // tarifs sélectionnés -$tarifsSelectionnes = f('tarifs') ?: []; +if (null !== f('tarifs')) { + $tarifsSelectionnes = f('tarifs'); +} else if (! isset($_SESSION['tauxSelectionnes'])) { + $tarifsSelectionnes = []; +} // comptes sélectionnés -$comptesSelectionnes = f('comptes') ?: []; +if (null !== f('comptes')) { + $_SESSION['comptesSelectionnes'] = f('comptes'); +} /* +else if (! isset($_SESSION['tauxSelectionnes'])) { + $_SESSION['comptesSelectionnes'] = []; +} + */ // taux de réduction associés -$tauxSelectionnes = array(); -foreach ($tarifsSelectionnes as $idTarif) +if (isset($tarifsSelectionnes) && isset($_SESSION['comptesSelectionnes'])) { - $nomRadio = "taux_reduction_" . $idTarif; - $valRadio = f("$nomRadio"); - $tauxSelectionnes[$idTarif] = $valRadio; + $tauxSelectionnes = array(); + foreach ($tarifsSelectionnes as $idTarif) + { + $nomRadio = "taux_reduction_" . $idTarif; + $tauxSelectionnes[$idTarif] = f("$nomRadio"); + } + foreach ($_SESSION['comptesSelectionnes'] as $idCompte) + { + $nomRadio = "taux_reduction_" . $idCompte; + $tauxSelectionnes[$idCompte] = f("$nomRadio"); + } + $_SESSION['tauxSelectionnes'] = $tauxSelectionnes; } -foreach ($comptesSelectionnes as $idCompte) -{ - $nomRadio = "taux_reduction_" . $idCompte; - $valRadio = f("$nomRadio"); - $tauxSelectionnes[$idCompte] = $valRadio; -} -$_SESSION['tauxSelectionnes'] = $tauxSelectionnes; -// versements correspondants à la sélection, triés par tarif, nom, compte, date -$lesTarifs = array_map(fn($elem) : string => substr($elem, 0, strpos($elem, '_')), - $tarifsSelectionnes); -$lesComptes = array_map(fn($elem) : string => substr($elem, 1 + strpos($elem, '_')), - $tarifsSelectionnes); +$lesTarifs = array_map(fn($elem) : string => + strpos($elem, '_') !== false ? substr($elem, 0, strpos($elem, '_')) : "", + array_keys($_SESSION['tauxSelectionnes'])); +$lesComptes = array_map(fn($elem) : string => + strpos($elem, '_') !== false ? substr($elem, 1 + strpos($elem, '_')) : "", + array_keys($_SESSION['tauxSelectionnes'])); + $_SESSION['lesVersements'] = Utils::getVersementsTarifsComptes( $_SESSION['annee_recu'], @@ -51,15 +68,15 @@ $_SESSION['lesVersements'] = // ajouter les versements sans tarif (tri par nom, compte, date) $versementsSansTarif = Utils::getVersementsComptes($_SESSION['annee_recu'], - $comptesSelectionnes, + $_SESSION['comptesSelectionnes'], $champsNom); foreach ($versementsSansTarif as $versement) { $_SESSION['lesVersements'][] = $versement; } - // préparation de l'affichage $tpl->assign('lesVersements', $_SESSION['lesVersements']); +$tpl->assign('annee_recu', $_SESSION['annee_recu']); $tpl->assign('plugin_css', ['style.css']); // envoyer au template diff --git a/www/admin/versements_personnes.php b/www/admin/versements_personnes.php index 5a626bd..74e7d95 100644 --- a/www/admin/versements_personnes.php +++ b/www/admin/versements_personnes.php @@ -6,11 +6,16 @@ use Garradin\Plugin\RecusFiscaux\Personne; use Garradin\Plugin\RecusFiscaux\Utils; // vérifier si le taux de réduction a été sélectionné au préalable -$_SESSION['taux_reduction'] = f('taux_reduction'); -if (! isset($_SESSION['taux_reduction']) || $_SESSION['taux_reduction'] == "") +$taux = f('taux_reduction'); +if (! isset($_SESSION['taux_reduction']) + && + null === $taux) { \Garradin\Utils::redirect(PLUGIN_URL . 'index.php'); } +if (null !== $taux) { + $_SESSION['taux_reduction'] = $taux; +} // versements par personne $_SESSION['lesVersements'] = Utils::getVersementsPersonnes( @@ -21,6 +26,7 @@ $_SESSION['lesVersements'] = Utils::getVersementsPersonnes( // préparation de l'affichage $tpl->assign('lesVersements', $_SESSION['lesVersements']); +$tpl->assign('annee_recu', $_SESSION['annee_recu']); $tpl->assign('plugin_css', ['style.css']); // envoyer au template From 086dbaec18901a42721d4eca16274cf0bb137024 Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 4 Feb 2023 15:47:52 +0000 Subject: [PATCH 088/137] =?UTF-8?q?Mise=20=C3=A0=20jour=20README=20et=20ga?= =?UTF-8?q?rradin=5Fplugin.ini?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 199aaaac9e24b125a98bb4848c81d6a292a9dbffdd59b31901a8d66341b63fce --- README.md | 1 + garradin_plugin.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 83801e5..7d460bb 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Vous pouvez télécharger [l'archive .tar.gz](https://ncloud6.zaclys.com/index.p - reçu par activité et tarif : 1, plusieurs ou tous - reçu par personne : 1, plusieurs ou tous - distinguer les différents taux de réduction + - génération des reçus au format PDF ou impression depuis le navigateur ## Configuration - association diff --git a/garradin_plugin.ini b/garradin_plugin.ini index 27e3292..a52e6b8 100644 --- a/garradin_plugin.ini +++ b/garradin_plugin.ini @@ -2,7 +2,7 @@ nom="Reçus fiscaux" description="Génération de reçus fiscaux pour les dons des membres" auteur="jce" url="https://ncloud6.zaclys.com/index.php/s/RZQK2So8HemkH3w" -version="0.8" +version="0.9" menu=1 config=1 min_version="1.1.23" From d7f78743c84f1e146153cf661667dbd81f5a7e07 Mon Sep 17 00:00:00 2001 From: engel <> Date: Mon, 6 Feb 2023 13:10:00 +0000 Subject: [PATCH 089/137] =?UTF-8?q?ajout=20mise=20=C3=A0=20jour=20configur?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 56439aa7656d7e3deaf5c8136317085459aa7c712b608b107c21ae2c868e3462 --- upgrade.php | 17 +++++++++++++++++ www/admin/index.php | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 upgrade.php diff --git a/upgrade.php b/upgrade.php new file mode 100644 index 0000000..754668f --- /dev/null +++ b/upgrade.php @@ -0,0 +1,17 @@ +prefixe = ""; + $configNum->annee = false; + $configNum->membre = false; + $configNum->sequentiel = false; + $configNum->valeur_init = 1; + $plugin->setConfig('numerotation', $configNum); + $plugin->setConfig('imprimerCourriel', false); +} diff --git a/www/admin/index.php b/www/admin/index.php index 4c5e0f3..9125c0c 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -4,6 +4,11 @@ namespace Garradin; use Garradin\Plugin\RecusFiscaux\Utils; +// mettre à jour le plugin si besoin +if ($plugin->needUpgrade()) { + $plugin->upgrade(); +} + // Année fiscale par défaut if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "") { From 6d5fb6e8e2f6c6b8e66668d1a70fd567fc50a7df Mon Sep 17 00:00:00 2001 From: engel <> Date: Mon, 6 Feb 2023 16:58:43 +0000 Subject: [PATCH 090/137] correction typos README FossilOrigin-Name: e47558a0b22785a1425a974a791641fe1f0bacdcfb5c3910bef59c92d46b3c2c --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7d460bb..3594e16 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Plugin de reçus fiscaux pour le logiciel de gestion d'association Garradin/Pahe ## Installation ### Attention -Les archives disponibles sur ce gitlab n'ont pas un format compatible avec Garragin/Paheko et ne peuvent donc être utilisées telles quelles ; il faut soit les transformer pour les rendre compatibles, soit (plus simple) télécharger l'archive indiquée ci-dessous. +Les archives disponibles sur ce gitlab n'ont pas un format compatible avec Garradin/Paheko et ne peuvent donc être utilisées telles quelles ; il faut soit les transformer pour les rendre compatibles, soit (plus simple) télécharger l'archive indiquée ci-dessous. ### Archive Vous pouvez télécharger [l'archive .tar.gz](https://ncloud6.zaclys.com/index.php/s/RZQK2So8HemkH3w), et la copier dans le dossier plugins de Garradin/Paheko. @@ -28,6 +28,6 @@ Vous pouvez télécharger [l'archive .tar.gz](https://ncloud6.zaclys.com/index.p - signature (image) - autres - ville (précède la date sur le formulaire) - - paramétrage numéro de reçu (préfixe quelconque, année fiscale, numéro de memmbre ou séquentiel) + - paramétrage numéro de reçu (préfixe quelconque, année fiscale, numéro de membre ou séquentiel) - possibilité imprimer adresse de courriel - choix et ordre des champs pour le nom et prénom (le libellé doit contenir le terme 'nom', casse indifférente) From 6ba58c621cc2cd31baafdce4ddf59e882e1deae7 Mon Sep 17 00:00:00 2001 From: engel <> Date: Mon, 6 Feb 2023 17:37:12 +0000 Subject: [PATCH 091/137] correction petit oubli upgrade.php FossilOrigin-Name: efb9c630582804a571607b2a441206c4551aae6a4f4d80fb65ac2a88a739aa9d --- upgrade.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/upgrade.php b/upgrade.php index 754668f..de36e6c 100644 --- a/upgrade.php +++ b/upgrade.php @@ -4,6 +4,8 @@ namespace Garradin; use Garradin\Entities\Files\File; +$old_version = $plugin->getInfos('version'); + if (version_compare($old_version, '0.9', '<')) { $configNum = new \stdClass(); From bae96fce76505bb018e67324074790f70baaafb0 Mon Sep 17 00:00:00 2001 From: engel <> Date: Tue, 7 Mar 2023 09:55:51 +0000 Subject: [PATCH 092/137] correction erreur raz structures ; simplification aiguillage FossilOrigin-Name: 2f8d2df149885b80cb8b98d6ccc2e21e7ab671fed7de8154453dd13344b2d0be --- www/admin/action.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/admin/action.php b/www/admin/action.php index 67602ac..e9785c2 100644 --- a/www/admin/action.php +++ b/www/admin/action.php @@ -205,11 +205,12 @@ $tpl->register_function('fin_tarif', function ($params) // ------------------------------------------------------------------------ // aiguillage // ------------------------------------------------------------------------ +unset($_SESSION['comptesSelectionnes']); +unset($_SESSION['tauxSelectionnes']); +unset($_SESSION['lesVersements']); if ($_GET['action'] == 'personne') { require('versements_personnes.php'); -} else if ($_GET['action'] == 'compte') { - require('versements_personnes.php'); } else if ($_GET['action'] == 'activite') { require('versements_activites.php'); } From 44bf4e55d6c795fd3d3727957f193174629ea0f3 Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 10 Mar 2023 19:41:46 +0000 Subject: [PATCH 093/137] correction oubli code postal FossilOrigin-Name: 13a21b236ca87edeff84aca12cbd876492d023ebd344c4df2b46a38f0a8f63da --- templates/recu_html.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/recu_html.tpl b/templates/recu_html.tpl index e7de081..6cfa2ff 100644 --- a/templates/recu_html.tpl +++ b/templates/recu_html.tpl @@ -44,7 +44,7 @@

    {$personne.nomPrenom}
    {$personne.adresse}
    - {$personne.code} {$personne.ville} + {$personne.codePostal} {$personne.ville} {if $courriel && $personne.courriel != ""}
    courriel : {$personne.courriel} {/if} From bf585cbe26aa0fb28c2ec9bfb82582725a634eea Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 11 Mar 2023 14:49:31 +0000 Subject: [PATCH 094/137] =?UTF-8?q?petite=20simplification=20feuille=20de?= =?UTF-8?q?=20style=20re=C3=A7u=20pdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 3289bdb1b1a9e69c5d059c27cae5487baa703b117731a1ae6c82c2fb85d7c736 --- templates/recu.skel | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/templates/recu.skel b/templates/recu.skel index d60fa68..e3dcf3b 100644 --- a/templates/recu.skel +++ b/templates/recu.skel @@ -2,18 +2,16 @@ -