Compare commits

..

No commits in common. "master" and "0.11" have entirely different histories.
master ... 0.11

11 changed files with 805 additions and 816 deletions

View file

@ -4,7 +4,7 @@ Plugin de reçus fiscaux pour le logiciel de gestion d'association [Paheko](http
## Installation ## Installation
Télécharger la [version la plus récente](https://git.roflcopter.fr/lesanges/recusfiscaux/releases) au format tar.gz, supprimer le numéro de version du nom de l'archive et la copier dans le répertoire data/plugins de Paheko **Attention :** les archives disponibles sur ce dépôt 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://acloud8.zaclys.com/index.php/s/n9daWAND24T2W3e), et la copier dans le dossier plugins de Paheko.
## Fonctionnalités ## Fonctionnalités
- Créer des reçus fiscaux pour les dons des membres - Créer des reçus fiscaux pour les dons des membres

View file

@ -16,14 +16,10 @@ $_GET['_dialog'] = true;
// signature // signature
$signature = $signature =
(null !== $config->fileURL('signature')) ? (null !== $plugin->getConfig('signature')) ?
$config->fileURL('signature') : \KD2\HTTP::getScheme() . '://' . \KD2\HTTP::getHost() . WWW_URI . "/" . $plugin->getConfig('signature') :
((null !== $plugin->getConfig('signature')) ? "";
\KD2\HTTP::getScheme() . '://' . \KD2\HTTP::getHost() . WWW_URI . $plugin->getConfig('signature') :
"");
// http://test.paheko.bzh/config/cavalier.png
error_log('signature = ' . $signature);
// logo // logo
$config = Config::getInstance(); $config = Config::getInstance();
$logo_asso = $logo_asso =
@ -115,8 +111,7 @@ function genererRecusPDF($totalPersonnes,
$numero_sequentiel = getNumSequentiel($configNum); $numero_sequentiel = getNumSequentiel($configNum);
foreach ($totalPersonnes as $idPersonne => $personne) { foreach ($totalPersonnes as $idPersonne => $personne) {
$tpl = new UserTemplate(null); $tpl = new UserTemplate(null);
/* $tpl->setSource(PLUGIN_ROOT . '/templates/recu.skel'); */ $tpl->setSource(PLUGIN_ROOT . '/templates/recu.skel');
$tpl->setSourcePath(PLUGIN_ROOT . '/templates/recu.skel');
$tpl->assignArray(compact('signature', 'logo_asso', 'texteArticles')); $tpl->assignArray(compact('signature', 'logo_asso', 'texteArticles'));
$tpl->assign('objet_asso', $plugin->getConfig('objet_asso')); $tpl->assign('objet_asso', $plugin->getConfig('objet_asso'));

View file

@ -34,18 +34,5 @@ div.previs_recu
font-family: Serif; font-family: Serif;
font-size: 11pt; font-size: 11pt;
background-color: white; background-color: white;
break-after: always; page-break-after: always;
}
/* supprimer saut de page après dernier */
div.previs_recu:last-of-type
{
font-family: Serif;
font-size: 11pt;
background-color: white;
break-after: avoid;
}
#__profiler {
display: none;
} }

View file

@ -95,9 +95,3 @@ span.titre, span.libelle
{ {
display : inline; display : inline;
} }
/* Ne pas imprimer le bandeau des boutons du profiler */
#__profiler
{
display: none;
}

View file

@ -22,7 +22,7 @@ class Utils
description, description,
amount as montant amount as montant
FROM services_fees'); FROM services_fees');
return $db->getGrouped($sql); return Utils::toAssoc($db->get($sql), 'id');
} }
/** /**
@ -37,7 +37,7 @@ class Utils
services.label, services.label,
services.description services.description
FROM services'); FROM services');
return $db->getGrouped($sql); return Utils::toAssoc($db->get($sql), 'id');
} }
/** /**
@ -52,7 +52,6 @@ class Utils
$sql = sprintf( $sql = sprintf(
'SELECT 'SELECT
acc_accounts.id, acc_accounts.id,
acc_years.label,
acc_accounts.code as codeCompte, acc_accounts.code as codeCompte,
acc_accounts.label as nomCompte acc_accounts.label as nomCompte
FROM acc_transactions_users FROM acc_transactions_users
@ -64,19 +63,17 @@ class Utils
ON acc_transactions_lines.id_transaction = acc_transactions.id ON acc_transactions_lines.id_transaction = acc_transactions.id
INNER JOIN acc_accounts INNER JOIN acc_accounts
ON acc_transactions_lines.id_account = acc_accounts.id ON acc_transactions_lines.id_account = acc_accounts.id
INNER JOIN acc_years
ON acc_transactions.id_year = acc_years.id
WHERE WHERE
(strftime("%%Y", acc_transactions.date) = "%d" (strftime("%%Y", acc_transactions.date) = "%d"
AND AND
acc_accounts.%s acc_accounts.%s
) )
GROUP by acc_accounts.id GROUP by acc_accounts.code
ORDER by acc_accounts.code', ORDER by acc_accounts.code',
$annee, $annee,
$db->where('code', $op, $comptes) $db->where('code', $op, $comptes)
); );
return $db->getGrouped($sql); return Utils::toAssoc($db->get($sql), 'id');
} }
/** /**
@ -120,6 +117,32 @@ class Utils
return $db->get($sql); return $db->get($sql);
} }
/**
* faire un tableau associatif avec le résultat d'une requête
*/
static function toAssoc($array, $nomCle)
{
$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;
}
/** /**
* @return versements correspondants à l'année donnée * @return versements correspondants à l'année donnée
* @param $annee * @param $annee

View file

@ -5,8 +5,8 @@
<nav class="tabs"> <nav class="tabs">
<ul> <ul>
<li{if $current_nav == 'index'} class="current"{/if}><a href="{plugin_url}">Accueil</a></li> <li{if $current_nav == 'index'} class="current"{/if}><a href="{plugin_url}">Accueil</a></li>
{if $current_nav == 'personne'} <li class="current"><a>Versements par personne</a></li>{/if} <li{if $current_nav == 'personne'} class="current"{/if}><a href="{plugin_url file="action.php?action=personne"}">Versements par personne</a></li>
{if $current_nav == 'activite'} <li class="current"><a>Versements par activité et tarif</a></li>{/if} <li{if $current_nav == 'activite'} class="current"{/if}><a href="{plugin_url file="action.php?action=activite"}">Versements par activité et tarif</a></li>
{if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)} {if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)}
<li{if $current_nav == 'config'} class="current"{/if}><a href="{plugin_url file="config.php"}">Configuration</a></li> <li{if $current_nav == 'config'} class="current"{/if}><a href="{plugin_url file="config.php"}">Configuration</a></li>
{/if} {/if}

View file

@ -14,7 +14,7 @@
<fieldset> <fieldset>
{* <legend>Choisir une des méthodes</legend> *} {* <legend>Choisir une des méthodes</legend> *}
<dl> <dl id="menu">
<dd class="radio-btn"> <dd class="radio-btn">
<input type="radio" id="radio_versements_personne" name="choix_versements" value="personne" <input type="radio" id="radio_versements_personne" name="choix_versements" value="personne"
onclick="choixMethodeGeneration(this.form, 'personne', 'menu_versements', '.menu');" /> onclick="choixMethodeGeneration(this.form, 'personne', 'menu_versements', '.menu');" />
@ -118,8 +118,7 @@
label="Activité « %s » - tarif « %s » ;"|args:$activite.label,$tarif.label label="Activité « %s » - tarif « %s » ;"|args:$activite.label,$tarif.label
} }
{/if} {/if}
<span>compte : {$elem.codeCompte} - {$compte->nomCompte}</span> <span>compte : {$elem.codeCompte} ({$compte->nomCompte})</span>
<span> ({$compte.label})</span>
</div> </div>
<ul class="reduction"> <ul class="reduction">
{foreach from=$plugin_config->reduction item="reduc"} {foreach from=$plugin_config->reduction item="reduc"}
@ -154,8 +153,7 @@
label="Versements non rattachés à une activité ;" label="Versements non rattachés à une activité ;"
} }
<?php $compte = $lesComptes[$idCompte]; ?> <?php $compte = $lesComptes[$idCompte]; ?>
<span>compte : {$compte.codeCompte} - {$compte.nomCompte}</span> <span>compte : {$compte.codeCompte} ({$compte.nomCompte})</span>
<span> ({$compte.label})</span>
</div> </div>
<ul class="reduction"> <ul class="reduction">
{foreach from=$plugin_config->reduction item="reduc"} {foreach from=$plugin_config->reduction item="reduc"}

View file

@ -1,4 +1,4 @@
{include file="_head.tpl" title="%s"|args:$plugin.label current="plugin_%s"|args:$plugin.id} {include file="_head.tpl" title="%s"|args:$plugin.name current="plugin_%s"|args:$plugin.id}
<?php <?php
$fmt = new \NumberFormatter('fr_FR', \NumberFormatter::SPELLOUT); $fmt = new \NumberFormatter('fr_FR', \NumberFormatter::SPELLOUT);

View file

@ -34,7 +34,6 @@
$tarifCourant = $versement->idTarif; $tarifCourant = $versement->idTarif;
$personneCourante = $versement->idUser; $personneCourante = $versement->idUser;
$compteCourant = $versement->idCompte; $compteCourant = $versement->idCompte;
$codeCompte = $versement->codeCompte;
?> ?>
{afficher_debut_tarif versement=$versement} {afficher_debut_tarif versement=$versement}
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
@ -49,7 +48,6 @@
$tarifCourant = $versement->idTarif; $tarifCourant = $versement->idTarif;
$personneCourante = $versement->idUser; $personneCourante = $versement->idUser;
$compteCourant = $versement->idCompte; $compteCourant = $versement->idCompte;
$codeCompte = $versement->codeCompte;
?> ?>
{afficher_debut_tarif versement=$versement} {afficher_debut_tarif versement=$versement}
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
@ -62,17 +60,15 @@
$pair = true; $pair = true;
$personneCourante = $versement->idUser; $personneCourante = $versement->idUser;
$compteCourant = $versement->idCompte; $compteCourant = $versement->idCompte;
$codeCompte = $versement->codeCompte;
?> ?>
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante} {afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
{afficher_debut_compte idCompte=$compteCourant} {afficher_debut_compte idCompte=$compteCourant}
{elseif $versement.codeCompte != $codeCompte} {elseif $versement.idCompte != $compteCourant}
{fin_compte} {fin_compte}
{* changement de compte *} {* changement de compte *}
<?php <?php
$pair = true; $pair = true;
$compteCourant = $versement->idCompte; $compteCourant = $versement->idCompte;
$codeCompte = $versement->codeCompte;
?> ?>
{afficher_debut_compte idCompte=$compteCourant} {afficher_debut_compte idCompte=$compteCourant}
{else} {else}

View file

@ -15,7 +15,7 @@
form="versements_personnes" form="versements_personnes"
formaction="generer_recus.php?type=personne&format=pdf" formaction="generer_recus.php?type=personne&format=pdf"
onclick="return verifierChoix(this.form)"} onclick="return verifierChoix(this.form)"}
{button type="submit" label="Imprimer les reçus" shape="print" {button type="submit" target="_dialog" label="Imprimer les reçus" shape="print"
form="versements_personnes" form="versements_personnes"
formaction="generer_recus.php?type=personne&format=print" formaction="generer_recus.php?type=personne&format=print"
onclick="return verifierChoix(this.form)"} onclick="return verifierChoix(this.form)"}
@ -25,14 +25,12 @@
{* Itération sur les personnes *} {* Itération sur les personnes *}
{foreach from=$lesVersements key="rang" item="versement"} {foreach from=$lesVersements key="rang" item="versement"}
{if $rang == 0} {if $rang == 0}
{* 1ère personne *} {* 1ère personne *}
<?php <?php
$pair = true; $pair = true;
$personneCourante = $versement->idUser; $personneCourante = $versement->idUser;
$compteCourant = $versement->idCompte; $compteCourant = $versement->idCompte;
$codeCompte = $versement->codeCompte;
?> ?>
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante} {afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
{afficher_debut_compte idCompte=$compteCourant} {afficher_debut_compte idCompte=$compteCourant}
@ -44,17 +42,15 @@
$pair = true; $pair = true;
$personneCourante = $versement->idUser; $personneCourante = $versement->idUser;
$compteCourant = $versement->idCompte; $compteCourant = $versement->idCompte;
$codeCompte = $versement->codeCompte;
?> ?>
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante} {afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
{afficher_debut_compte idCompte=$compteCourant} {afficher_debut_compte idCompte=$compteCourant}
{elseif $versement.codeCompte != $codeCompte} {elseif $versement.idCompte != $compteCourant}
{fin_compte} {fin_compte}
{* changement de compte *} {* changement de compte *}
<?php <?php
$pair = true; $pair = true;
$compteCourant = $versement->idCompte; $compteCourant = $versement->idCompte;
$codeCompte = $versement->codeCompte;
?> ?>
{afficher_debut_compte idCompte=$compteCourant} {afficher_debut_compte idCompte=$compteCourant}
{else} {else}