début refonte gestion versements
FossilOrigin-Name: 1be54b8a985d3fb24895bae4cc5481743edf0a68dbb0eb4278580df3ce7f530d
This commit is contained in:
parent
2e8eb26e5a
commit
af7816d97f
11 changed files with 322 additions and 112 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue