From 60c946181e6e14192afeb81429c26453596a3d47 Mon Sep 17 00:00:00 2001
From: engel <>
Date: Fri, 25 Feb 2022 17:24:24 +0000
Subject: [PATCH 001/137] =?UTF-8?q?d=C3=A9placement=20des=20fichiers=20du?=
=?UTF-8?q?=20plugin=20dans=20un=20sous-r=C3=A9pertoire=20src?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
FossilOrigin-Name: 8fde9575104fbd8db6ada4f6120cccd9dfb06459ea79349b677cb387795d2b7e
---
lib/RecusPDF.php | 196 ------------------
COPYING => src/COPYING | 0
config.json => src/config.json | 0
{data => src/data}/default_signature.png | Bin
.../garradin_plugin.ini | 0
install.php => src/install.php | 0
{lib => src/lib}/Activite.php | 0
{lib => src/lib}/Personne.php | 0
{lib => src/lib}/RecusHTML.php | 0
{lib => src/lib}/Tarif.php | 0
{lib => src/lib}/Utils.php | 0
{lib => src/lib}/Versement.php | 0
{lib => src/lib}/pdf.css | 0
{templates => src/templates}/_nav.tpl | 0
{templates => src/templates}/config.tpl | 0
{templates => src/templates}/index.tpl | 0
{templates => src/templates}/upload.tpl | 0
.../templates}/versements_activites.tpl | 0
.../templates}/versements_personnes.tpl | 0
{www => src/www}/admin/action.php | 0
{www => src/www}/admin/config.php | 0
{www => src/www}/admin/generer_activites.php | 0
{www => src/www}/admin/generer_personnes.php | 0
{www => src/www}/admin/index.php | 0
{www => src/www}/admin/script.js | 0
{www => src/www}/admin/style.css | 0
{www => src/www}/admin/upload.php | 0
.../www}/admin/versements_activites.php | 0
.../www}/admin/versements_personnes.php | 0
29 files changed, 196 deletions(-)
delete mode 100644 lib/RecusPDF.php
rename COPYING => src/COPYING (100%)
rename config.json => src/config.json (100%)
rename {data => src/data}/default_signature.png (100%)
rename garradin_plugin.ini => src/garradin_plugin.ini (100%)
rename install.php => src/install.php (100%)
rename {lib => src/lib}/Activite.php (100%)
rename {lib => src/lib}/Personne.php (100%)
rename {lib => src/lib}/RecusHTML.php (100%)
rename {lib => src/lib}/Tarif.php (100%)
rename {lib => src/lib}/Utils.php (100%)
rename {lib => src/lib}/Versement.php (100%)
rename {lib => src/lib}/pdf.css (100%)
rename {templates => src/templates}/_nav.tpl (100%)
rename {templates => src/templates}/config.tpl (100%)
rename {templates => src/templates}/index.tpl (100%)
rename {templates => src/templates}/upload.tpl (100%)
rename {templates => src/templates}/versements_activites.tpl (100%)
rename {templates => src/templates}/versements_personnes.tpl (100%)
rename {www => src/www}/admin/action.php (100%)
rename {www => src/www}/admin/config.php (100%)
rename {www => src/www}/admin/generer_activites.php (100%)
rename {www => src/www}/admin/generer_personnes.php (100%)
rename {www => src/www}/admin/index.php (100%)
rename {www => src/www}/admin/script.js (100%)
rename {www => src/www}/admin/style.css (100%)
rename {www => src/www}/admin/upload.php (100%)
rename {www => src/www}/admin/versements_activites.php (100%)
rename {www => src/www}/admin/versements_personnes.php (100%)
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
diff --git a/COPYING b/src/COPYING
similarity index 100%
rename from COPYING
rename to src/COPYING
diff --git a/config.json b/src/config.json
similarity index 100%
rename from config.json
rename to src/config.json
diff --git a/data/default_signature.png b/src/data/default_signature.png
similarity index 100%
rename from data/default_signature.png
rename to src/data/default_signature.png
diff --git a/garradin_plugin.ini b/src/garradin_plugin.ini
similarity index 100%
rename from garradin_plugin.ini
rename to src/garradin_plugin.ini
diff --git a/install.php b/src/install.php
similarity index 100%
rename from install.php
rename to src/install.php
diff --git a/lib/Activite.php b/src/lib/Activite.php
similarity index 100%
rename from lib/Activite.php
rename to src/lib/Activite.php
diff --git a/lib/Personne.php b/src/lib/Personne.php
similarity index 100%
rename from lib/Personne.php
rename to src/lib/Personne.php
diff --git a/lib/RecusHTML.php b/src/lib/RecusHTML.php
similarity index 100%
rename from lib/RecusHTML.php
rename to src/lib/RecusHTML.php
diff --git a/lib/Tarif.php b/src/lib/Tarif.php
similarity index 100%
rename from lib/Tarif.php
rename to src/lib/Tarif.php
diff --git a/lib/Utils.php b/src/lib/Utils.php
similarity index 100%
rename from lib/Utils.php
rename to src/lib/Utils.php
diff --git a/lib/Versement.php b/src/lib/Versement.php
similarity index 100%
rename from lib/Versement.php
rename to src/lib/Versement.php
diff --git a/lib/pdf.css b/src/lib/pdf.css
similarity index 100%
rename from lib/pdf.css
rename to src/lib/pdf.css
diff --git a/templates/_nav.tpl b/src/templates/_nav.tpl
similarity index 100%
rename from templates/_nav.tpl
rename to src/templates/_nav.tpl
diff --git a/templates/config.tpl b/src/templates/config.tpl
similarity index 100%
rename from templates/config.tpl
rename to src/templates/config.tpl
diff --git a/templates/index.tpl b/src/templates/index.tpl
similarity index 100%
rename from templates/index.tpl
rename to src/templates/index.tpl
diff --git a/templates/upload.tpl b/src/templates/upload.tpl
similarity index 100%
rename from templates/upload.tpl
rename to src/templates/upload.tpl
diff --git a/templates/versements_activites.tpl b/src/templates/versements_activites.tpl
similarity index 100%
rename from templates/versements_activites.tpl
rename to src/templates/versements_activites.tpl
diff --git a/templates/versements_personnes.tpl b/src/templates/versements_personnes.tpl
similarity index 100%
rename from templates/versements_personnes.tpl
rename to src/templates/versements_personnes.tpl
diff --git a/www/admin/action.php b/src/www/admin/action.php
similarity index 100%
rename from www/admin/action.php
rename to src/www/admin/action.php
diff --git a/www/admin/config.php b/src/www/admin/config.php
similarity index 100%
rename from www/admin/config.php
rename to src/www/admin/config.php
diff --git a/www/admin/generer_activites.php b/src/www/admin/generer_activites.php
similarity index 100%
rename from www/admin/generer_activites.php
rename to src/www/admin/generer_activites.php
diff --git a/www/admin/generer_personnes.php b/src/www/admin/generer_personnes.php
similarity index 100%
rename from www/admin/generer_personnes.php
rename to src/www/admin/generer_personnes.php
diff --git a/www/admin/index.php b/src/www/admin/index.php
similarity index 100%
rename from www/admin/index.php
rename to src/www/admin/index.php
diff --git a/www/admin/script.js b/src/www/admin/script.js
similarity index 100%
rename from www/admin/script.js
rename to src/www/admin/script.js
diff --git a/www/admin/style.css b/src/www/admin/style.css
similarity index 100%
rename from www/admin/style.css
rename to src/www/admin/style.css
diff --git a/www/admin/upload.php b/src/www/admin/upload.php
similarity index 100%
rename from www/admin/upload.php
rename to src/www/admin/upload.php
diff --git a/www/admin/versements_activites.php b/src/www/admin/versements_activites.php
similarity index 100%
rename from www/admin/versements_activites.php
rename to src/www/admin/versements_activites.php
diff --git a/www/admin/versements_personnes.php b/src/www/admin/versements_personnes.php
similarity index 100%
rename from www/admin/versements_personnes.php
rename to src/www/admin/versements_personnes.php
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
zcmdtJ^;=Zm7dA|H*MM}1z%Y~ol8T^|pny1Zmo!KZ3=NVZ0)rANEj56|(B0BqLnAqa
zFu(xw;OG0k|HE@VKg_w#bbw^tB{S*)L?pc;X{NARZWoh#XT+)xNM+PWO&kYj|Us?O_4AL!B-pgy4cQkA$
zzQ`>{K$3L
z+gf4emc6XR}D
zC;@c8*!IUT5Znctb=&?vw(aH#5O@Zzw6?$60A@Z(ueY_>5iqa~TwJ#`c@MbU0isX3
zWJrz_py@9ZfcG={rW_Ey1$x)q-dg)OeE>4lRq6&fI0QzDl)dip?w-!x{yo#`?+2C*
za
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 @@ *}