From 8e19aaf526ee34e67803536052bb8378f0409b46 Mon Sep 17 00:00:00 2001
From: engel <>
Date: Fri, 7 Apr 2023 09:38:25 +0000
Subject: [PATCH 01/40] restructuration et correction inexactitude
FossilOrigin-Name: 43b3c9482d218f8e655a0fd54931824b1f51c9c40a767c637a6e7f5202f4944d
---
lib/Utils.php | 23 +++++++++++++----------
www/admin/versements_activites.php | 10 +++++++++-
2 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/lib/Utils.php b/lib/Utils.php
index 103c144..fac6190 100644
--- a/lib/Utils.php
+++ b/lib/Utils.php
@@ -185,18 +185,20 @@ class Utils
/**
* @return versements correspondants à :
- * @param $annee : année fiscale
- * @param array $tarifsComptes : tarifs sélectionnés et comptes associés
- * @param array $champsNom : liste non vide des champs de nom/prénom
+ * @param $annee : année fiscale
+ * @param array $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 getVersementsTarifsComptes($annee,
- $tarifsComptes,
+ $tarifs,
+ $comptes,
$champsNom)
{
$db = DB::getInstance();
$tri = Utils::combinerTri($champsNom);
- $condition = Utils::combinerTarifsComptes($tarifsComptes);
+ $condition = Utils::combinerTarifsComptes($tarifs, $comptes);
$sql = sprintf(
'SELECT
services_fees.id as idTarif,
@@ -369,16 +371,17 @@ class Utils
/**
* combiner chaque tarif avec le numéro de compte associé
*/
- private static function combinerTarifsComptes($tarifsComptes)
+ private static function combinerTarifsComptes($tarifs, $comptes)
{
$condition = '(';
+ $lesCond = array_map(fn($e1, $e2) : string =>
+ "(services_fees.id = '$e1' AND acc_accounts.id = '$e2')",
+ $tarifs, $comptes);
$nb = 0;
- foreach ($tarifsComptes as $elem)
+ foreach ($lesCond as $cond)
{
- $tarif = substr($elem, 0, strpos($elem, '_'));
- $compte = substr($elem, 1 + strpos($elem, '_'));
if ($nb > 0) { $condition .= ' OR '; }
- $condition .= "(services_fees.id = '$tarif' AND acc_accounts.id = '$compte')";
+ $condition .= $cond;
++$nb;
}
$condition .= ')';
diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php
index 9e8b5f2..20aae12 100644
--- a/www/admin/versements_activites.php
+++ b/www/admin/versements_activites.php
@@ -55,11 +55,19 @@ if (isset($_SESSION['comptesSelectionnes']))
}
$_SESSION['tauxSelectionnes'] = $tauxSelectionnes;
+$lesTarifs = array_map(fn($elem) : string =>
+ strpos($elem, '_') !== false ? substr($elem, 0, strpos($elem, '_')) : "",
+ $tarifsSelectionnes);
+$lesComptes = array_map(fn($elem) : string =>
+ strpos($elem, '_') !== false ? substr($elem, 1 + strpos($elem, '_')) : "",
+ $tarifsSelectionnes);
+
# versements des tarifs sélectionnées et de leur compte associé
$_SESSION['lesVersements'] =
Utils::getVersementsTarifsComptes(
$_SESSION['annee_recu'],
- array_keys($_SESSION['tauxSelectionnes']),
+ $lesTarifs,
+ $lesComptes,
$champsNom);
// ajouter les versements sans tarif (tri par nom, compte, date)
From e75c56b7366f50e4f0f07569c897e6a299ab87a8 Mon Sep 17 00:00:00 2001
From: engel <>
Date: Sat, 8 Apr 2023 08:44:31 +0000
Subject: [PATCH 02/40] =?UTF-8?q?Correction=20erreur=20=C3=A9criture=20en?=
=?UTF-8?q?=20double=20(http://localhost:8080/tktview/ae62f4cde5)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
FossilOrigin-Name: ada31d7d5a3cc60b40e4bada4afd0eab57ca48eb4bac4b4d5f34fda5f8feca6e
---
lib/Utils.php | 21 +++++++++------------
www/admin/index.php | 2 +-
www/admin/versements_activites.php | 5 ++++-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/Utils.php b/lib/Utils.php
index fac6190..d9416f7 100644
--- a/lib/Utils.php
+++ b/lib/Utils.php
@@ -63,13 +63,12 @@ class Utils
INNER JOIN acc_accounts
ON acc_transactions_lines.id_account = acc_accounts.id
WHERE
- (strftime(%s, acc_transactions.date) = "%d"
+ (strftime("%%Y", acc_transactions.date) = "%d"
AND
acc_accounts.%s
)
GROUP by acc_accounts.code
ORDER by acc_accounts.code',
- '"%Y"',
$annee,
$db->where('code', $op, $comptes)
);
@@ -104,14 +103,13 @@ class Utils
INNER JOIN acc_accounts
ON acc_transactions_lines.id_account = acc_accounts.id
WHERE
- (strftime(%s, acc_transactions.date) = "%d"
+ (strftime("%%Y", acc_transactions.date) = "%d"
AND
acc_accounts.%s
)
GROUP BY services_fees.id, acc_accounts.code
ORDER BY acc_accounts.code
',
- '"%Y"',
$annee,
$db->where('code', $op, $comptes)
);
@@ -170,12 +168,12 @@ class Utils
INNER JOIN acc_accounts
ON acc_transactions_lines.id_account = acc_accounts.id
WHERE
- (strftime(%s, acc_transactions.date) = "%d"
+ (strftime("%%Y", acc_transactions.date) = "%d"
AND
acc_accounts.%s
)
+ GROUP BY acc_transactions.id, acc_accounts.id
ORDER by %s, acc_accounts.code, acc_transactions.date',
- '"%Y"',
$annee,
$db->where('code', $op, $comptes),
$tri
@@ -225,7 +223,8 @@ class Utils
AND
%s
)
- ORDER by services_fees.id, %s, acc_accounts.code, acc_transactions.date',
+ GROUP BY acc_transactions.id, acc_accounts.id
+ ORDER by %s, acc_accounts.code, acc_transactions.date',
$annee,
$condition,
$tri
@@ -265,14 +264,13 @@ class Utils
INNER JOIN acc_accounts
ON acc_transactions_lines.id_account = acc_accounts.id
WHERE
- (strftime(%s, acc_transactions.date) = "%d"
+ (strftime("%%Y", acc_transactions.date) = "%d"
AND
acc_accounts.%s
)
-
+ GROUP BY acc_transactions.id, acc_accounts.id
ORDER by %s, acc_accounts.code, acc_transactions.date
',
- '"%Y"',
$annee,
$db->where('id', 'in', $comptesIsoles),
$tri
@@ -308,7 +306,7 @@ class Utils
INNER JOIN acc_transactions_lines
ON acc_transactions_lines.id_transaction = acc_transactions.id
WHERE (
- strftime(%s, acc_transactions.date) = "%d"
+ strftime("%%Y", acc_transactions.date) = "%d"
AND
acc_transactions_users.id_transaction = acc_transactions.id
AND
@@ -319,7 +317,6 @@ class Utils
',
$tri,
$nom,
- '"%Y"',
$annee
);
$donateurs = array();
diff --git a/www/admin/index.php b/www/admin/index.php
index 9125c0c..2b4fb14 100644
--- a/www/admin/index.php
+++ b/www/admin/index.php
@@ -37,7 +37,7 @@ if (null !== $champsNom)
// pendant l'année fiscale choisie
$_SESSION['comptes'] = Utils::getComptes($_SESSION['annee_recu'], 'like', '7%');
-// liste des activités, cotisations et comptes associés
+// liste des activités, tarifs et comptes associés
$activitesTarifsComptes = Utils::getTarifsComptes($_SESSION['annee_recu'], 'like', '7%');
$_SESSION['lesTarifs'] = Utils::getTarifs();
$_SESSION['lesActivites'] = Utils::getActivites();
diff --git a/www/admin/versements_activites.php b/www/admin/versements_activites.php
index 20aae12..7ffc9ec 100644
--- a/www/admin/versements_activites.php
+++ b/www/admin/versements_activites.php
@@ -63,12 +63,15 @@ $lesComptes = array_map(fn($elem) : string =>
$tarifsSelectionnes);
# versements des tarifs sélectionnées et de leur compte associé
-$_SESSION['lesVersements'] =
+if (count($lesTarifs) != 0)
+{
+ $_SESSION['lesVersements'] =
Utils::getVersementsTarifsComptes(
$_SESSION['annee_recu'],
$lesTarifs,
$lesComptes,
$champsNom);
+}
// ajouter les versements sans tarif (tri par nom, compte, date)
if (isset($_SESSION['comptesSelectionnes']))
From bc4739877c544c5039ba1227f4222548a7cf43fa Mon Sep 17 00:00:00 2001
From: engel <>
Date: Thu, 28 Sep 2023 09:08:46 +0000
Subject: [PATCH 03/40] =?UTF-8?q?D=C3=A9but=20restructuration=20pour=20com?=
=?UTF-8?q?patibilit=C3=A9=20version=201.3=20de=20paheko?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
FossilOrigin-Name: 467790c5738a867592117ea6b3a7ac6c61738dab3b8e29a48fed8f19b9df2b38
---
README.md | 6 +--
{www/admin => admin}/action.php | 0
{www/admin => admin}/choix_annee.php | 0
{www/admin => admin}/config.php | 0
{www/admin => admin}/generer_recus.php | 48 ++++++++++++++-----
{www/admin => admin}/imprimer_recu.css | 0
{www/admin => admin}/index.php | 0
{www/admin => admin}/previs_recu.css | 0
{www/admin => admin}/script.js | 0
{www/admin => admin}/style.css | 0
{www/admin => admin}/upload.php | 0
{www/admin => admin}/versements_activites.php | 6 ++-
{www/admin => admin}/versements_personnes.php | 0
install.php | 4 +-
lib/Personne.php | 2 +-
lib/Utils.php | 17 +++----
lib/Versement.php | 2 +-
garradin_plugin.ini => plugin.ini | 8 ++--
templates/_nav.tpl | 2 +-
templates/choix_annee.tpl | 4 +-
templates/index.tpl | 2 +-
templates/recu_html.tpl | 2 +-
templates/upload.tpl | 4 +-
templates/versements_activites.tpl | 2 +-
templates/versements_personnes.tpl | 2 +-
uninstall.php | 8 ++--
upgrade.php | 4 +-
27 files changed, 77 insertions(+), 46 deletions(-)
rename {www/admin => admin}/action.php (100%)
rename {www/admin => admin}/choix_annee.php (100%)
rename {www/admin => admin}/config.php (100%)
rename {www/admin => admin}/generer_recus.php (91%)
rename {www/admin => admin}/imprimer_recu.css (100%)
rename {www/admin => admin}/index.php (100%)
rename {www/admin => admin}/previs_recu.css (100%)
rename {www/admin => admin}/script.js (100%)
rename {www/admin => admin}/style.css (100%)
rename {www/admin => admin}/upload.php (100%)
rename {www/admin => admin}/versements_activites.php (90%)
rename {www/admin => admin}/versements_personnes.php (100%)
rename garradin_plugin.ini => plugin.ini (63%)
diff --git a/README.md b/README.md
index d6a1513..a564a1e 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-# Plugin reçus fiscaux pour Garradin/Paheko
+# Plugin reçus fiscaux pour Paheko
-Plugin de reçus fiscaux pour le logiciel de gestion d'association [Garradin/Paheko](https://paheko.cloud).
+Plugin de reçus fiscaux pour le logiciel de gestion d'association [Paheko](https://paheko.cloud).
## Installation
-**Attention :** 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 télécharger [cette archive](https://ncloud6.zaclys.com/index.php/s/RZQK2So8HemkH3w), et la copier dans le dossier plugins de Garradin/Paheko.
+**Attention :** les archives disponibles sur ce gitlab n'ont pas un format compatible avec Paheko et ne peuvent donc être utilisées telles quelles ; il faut soit les transformer pour les rendre compatibles, soit télécharger [cette archive](https://ncloud6.zaclys.com/index.php/s/RZQK2So8HemkH3w), et la copier dans le dossier plugins de Paheko.
## Fonctionnalités
- Créer des reçus fiscaux pour les dons des membres
diff --git a/www/admin/action.php b/admin/action.php
similarity index 100%
rename from www/admin/action.php
rename to admin/action.php
diff --git a/www/admin/choix_annee.php b/admin/choix_annee.php
similarity index 100%
rename from www/admin/choix_annee.php
rename to admin/choix_annee.php
diff --git a/www/admin/config.php b/admin/config.php
similarity index 100%
rename from www/admin/config.php
rename to admin/config.php
diff --git a/www/admin/generer_recus.php b/admin/generer_recus.php
similarity index 91%
rename from www/admin/generer_recus.php
rename to admin/generer_recus.php
index a17eb44..a930188 100644
--- a/www/admin/generer_recus.php
+++ b/admin/generer_recus.php
@@ -97,6 +97,9 @@ function genererRecusPDF($totalPersonnes,
$libelles_taux
)
{
+ //
Association « {{$config.nom_asso}} »
- {{$config.adresse_asso}}
+
Association « {{$config.org_name}} »
+ {{$config.org_address}}
Objet : {{$objet_asso}}
Association « {$nom_asso} »
- {$adresse_asso}
+
Association « {$org_name} »
+ {$org_address}
Objet : {$objet_asso}
La configuration a bien été enregistrée.
{/if} -{form_errors} - @@ -186,7 +191,7 @@ var lesDivs = document.querySelectorAll('.actions'); for (i = 0; i < lesDivs.length; ++i) { var up = document.createElement('a'); - up.className = 'icn up'; + up.className = 'up icn-btn'; up.innerHTML = '↑'; up.title = 'Déplacer vers le haut'; up.onclick = function(e) { From b53f089c87940cda19d50e0bfc51d7126e30db27 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 12 Oct 2023 08:47:40 +0000 Subject: [PATCH 07/40] la table membres devient users FossilOrigin-Name: b3f100b821b0fca9ad9416d202ba4c3fa6b010ea8fbb3e6ec1a7358a18ef2ec2 --- lib/Utils.php | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/Utils.php b/lib/Utils.php index d7c5fcf..ced8bca 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -55,8 +55,8 @@ class Utils 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 users + ON acc_transactions_users.id_user = users.id INNER JOIN acc_transactions ON acc_transactions_users.id_transaction = acc_transactions.id INNER JOIN acc_transactions_lines @@ -154,14 +154,14 @@ class Utils $tri = Utils::combinerTri($champsNom); $sql = sprintf( 'SELECT - membres.id as idUser, + users.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 users + ON acc_transactions_users.id_user = users.id INNER JOIN acc_transactions ON acc_transactions_users.id_transaction = acc_transactions.id INNER JOIN acc_transactions_lines @@ -203,12 +203,12 @@ class Utils services_fees.id as idTarif, acc_accounts.id as idCompte, acc_accounts.code as codeCompte, - membres.id as idUser, + users.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 users + ON acc_transactions_users.id_user = users.id INNER JOIN acc_transactions ON acc_transactions_users.id_transaction = acc_transactions.id INNER JOIN services_users @@ -253,12 +253,12 @@ class Utils 0 as idTarif, acc_accounts.id as idCompte, acc_accounts.code as codeCompte, - membres.id as idUser, + users.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 users + ON acc_transactions_users.id_user = users.id INNER JOIN acc_transactions ON acc_transactions_users.id_transaction = acc_transactions.id INNER JOIN acc_transactions_lines @@ -293,17 +293,17 @@ class Utils $tri = Utils::combinerTri($champsNom); $sql = sprintf( 'SELECT - membres.id as idUser, - membres.numero, - membres.email, + users.id as idUser, + users.numero, + users.email, row_number() over(order by %s) as rang, %s as nom, - membres.adresse as adresse, - membres.code_postal as codePostal, - membres.ville as ville + users.adresse as adresse, + users.code_postal as codePostal, + users.ville as ville FROM acc_transactions_users, - membres, + users, acc_transactions INNER JOIN acc_transactions_lines ON acc_transactions_lines.id_transaction = acc_transactions.id @@ -312,9 +312,9 @@ class Utils AND acc_transactions_users.id_transaction = acc_transactions.id AND - acc_transactions_users.id_user = membres.id + acc_transactions_users.id_user = users.id ) - GROUP by membres.id + GROUP by users.id ORDER by %1$s COLLATE U_NOCASE ', $tri, @@ -344,10 +344,10 @@ class Utils private static function combinerChamps($champs) { $op = ' || " " || '; - $result = 'ifnull(membres.' . $champs[0] . ', "")'; + $result = 'ifnull(users.' . $champs[0] . ', "")'; for ($i = 1; $i < count($champs); ++$i) { - $result .= $op . 'ifnull(membres.' . $champs[$i] . ', "")'; + $result .= $op . 'ifnull(users.' . $champs[$i] . ', "")'; } return 'trim(' . $result . ')'; } @@ -359,10 +359,10 @@ class Utils */ private static function combinerTri(array $champs) : string { - $tri = 'membres.' . $champs[0]; + $tri = 'users.' . $champs[0]; for ($i = 1; $i < count($champs); ++$i) { - $tri .= ', membres.' . $champs[$i]; + $tri .= ', users.' . $champs[$i]; } return $tri; } From 8091c8b87d57e83b40848694299ddbc1ceeb407d Mon Sep 17 00:00:00 2001 From: engel <> Date: Fri, 10 Nov 2023 11:31:18 +0000 Subject: [PATCH 08/40] Remplacement PLUGIN_URL ; ajout session_start() FossilOrigin-Name: 7fad3fa0b91ae127517c4e9d9a62a316280e17c561855a6abde8711e3cac72f2 --- admin/action.php | 1 + admin/choix_annee.php | 3 ++- admin/config.php | 1 + admin/index.php | 2 ++ admin/style.css | 5 +++++ admin/versements_activites.php | 10 +++++----- admin/versements_personnes.php | 2 +- lib/Utils.php | 2 +- templates/index.tpl | 2 +- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/admin/action.php b/admin/action.php index 86a998b..7776094 100644 --- a/admin/action.php +++ b/admin/action.php @@ -1,6 +1,7 @@ assign('anneesFiscales', $anneesFiscales); diff --git a/admin/config.php b/admin/config.php index 60c4981..a5d7c51 100644 --- a/admin/config.php +++ b/admin/config.php @@ -1,6 +1,7 @@ assign('plugin_config', $plugin->getConfig()); $tpl->assign('nbTaux', $nbTaux); $tpl->assign('nbChamps', $nbChamps); $tpl->assign('plugin_css', ['style.css']); +$tpl->assign('plugin_url', \Paheko\Utils::plugin_url()); // envoyer au template $tpl->display(PLUGIN_ROOT . '/templates/index.tpl'); diff --git a/admin/style.css b/admin/style.css index eb52c78..e096fff 100644 --- a/admin/style.css +++ b/admin/style.css @@ -109,6 +109,11 @@ div.actions display : inline; } +a.icn-btn { + font-family: "paheko", sans-serif; + font-size : 1.2em; +} + dl.config { padding-bottom : 1ex; diff --git a/admin/versements_activites.php b/admin/versements_activites.php index 85a7f01..56114bf 100644 --- a/admin/versements_activites.php +++ b/admin/versements_activites.php @@ -16,7 +16,7 @@ if (! isset($_SESSION['tauxSelectionnes']) && null === f('comptes')) { - \Paheko\Utils::redirect(PLUGIN_URL . 'index.php'); + \Paheko\Utils::redirect(\Paheko\Utils::plugin_url() . 'index.php'); } // tarifs sélectionnés @@ -25,11 +25,11 @@ if (null !== f('tarifs')) { } else if (! isset($_SESSION['tauxSelectionnes'])) { $tarifsSelectionnes = []; } -error_log("\ntarifsSelectionnes=" . print_r($tarifsSelectionnes, true)); +// error_log("\ntarifsSelectionnes=" . print_r($tarifsSelectionnes, true)); // comptes sélectionnés if (null !== f('comptes')) { $_SESSION['comptesSelectionnes'] = f('comptes'); - error_log("\ncomptesSelectionnes=" . print_r($_SESSION['comptesSelectionnes'], true)); + // error_log("\ncomptesSelectionnes=" . print_r($_SESSION['comptesSelectionnes'], true)); } /* else if (! isset($_SESSION['tauxSelectionnes'])) { $_SESSION['comptesSelectionnes'] = []; @@ -72,7 +72,7 @@ if (count($lesTarifs) != 0) $lesTarifs, $lesComptes, $champsNom); - error_log("lesVersements=" . print_r($_SESSION['lesVersements'], true)); + // error_log("lesVersements=" . print_r($_SESSION['lesVersements'], true)); } // ajouter les versements sans tarif (tri par nom, compte, date) @@ -86,7 +86,7 @@ if (isset($_SESSION['comptesSelectionnes'])) $_SESSION['lesVersements'][] = $versement; } } -error_log("lesVersements=" . print_r($_SESSION['lesVersements'], true)); +//error_log("lesVersements=" . print_r($_SESSION['lesVersements'], true)); // préparation de l'affichage $tpl->assign('lesVersements', $_SESSION['lesVersements']); diff --git a/admin/versements_personnes.php b/admin/versements_personnes.php index c23d423..8db95e8 100644 --- a/admin/versements_personnes.php +++ b/admin/versements_personnes.php @@ -11,7 +11,7 @@ if (! isset($_SESSION['taux_reduction']) && null === $taux) { - \Paheko\Utils::redirect(PLUGIN_URL . 'index.php'); + \Paheko\Utils::redirect(\Paheko\Utils::plugin_url() . 'index.php'); } if (null !== $taux) { $_SESSION['taux_reduction'] = $taux; diff --git a/lib/Utils.php b/lib/Utils.php index ced8bca..2bbb2f9 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -230,7 +230,7 @@ class Utils $condition, $tri ); - error_log("\ngetVersementsTarifsComptes : sql=" . $sql); + // error_log("\ngetVersementsTarifsComptes : sql=" . $sql); return $db->get($sql); } diff --git a/templates/index.tpl b/templates/index.tpl index 9a6dc51..1f6ca84 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -4,7 +4,7 @@