From 034c2b2dee4611e6772c180ff513dc1aeeb64ecd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Tue, 18 Feb 2025 10:29:40 +0100
Subject: [PATCH] bug mep

---
 .../src/Tbl/Process/PaiementDebugger.php        |  7 ++++++-
 .../src/Tbl/Process/PaiementProcess.php         | 17 +++++++++++------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/module/Paiement/src/Tbl/Process/PaiementDebugger.php b/module/Paiement/src/Tbl/Process/PaiementDebugger.php
index 1a9d9f02df..444f0fc063 100644
--- a/module/Paiement/src/Tbl/Process/PaiementDebugger.php
+++ b/module/Paiement/src/Tbl/Process/PaiementDebugger.php
@@ -19,6 +19,8 @@ use Paiement\Entity\Db\TauxRemu;
 use Paiement\Tbl\Process\Sub\ServiceAPayer;
 use Referentiel\Entity\Db\ServiceReferentiel;
 use Referentiel\Entity\Db\VolumeHoraireReferentiel;
+use Service\Entity\Db\EtatVolumeHoraire;
+use Service\Entity\Db\TypeVolumeHoraire;
 use UnicaenApp\Entity\HistoriqueAwareInterface;
 
 /**
@@ -365,10 +367,13 @@ class PaiementDebugger
           'Dernière modification par ' || u.display_name || ' le ' || to_char(vhr.histo_modification,'dd/mm/YYYY') histo
         FROM
           formule_resultat_volume_horaire frvh
+          JOIN formule_resultat_intervenant fri ON fri.id = frvh.formule_resultat_intervenant_id
+          JOIN type_volume_horaire tvh ON tvh.id = fri.type_volume_horaire_id AND tvh.code = '".TypeVolumeHoraire::CODE_REALISE."'
+          JOIN etat_volume_horaire evh ON evh.id = fri.etat_volume_horaire_id AND evh.code = '".EtatVolumeHoraire::CODE_VALIDE."'
           JOIN volume_horaire_ref vhr ON vhr.id = frvh.volume_horaire_ref_id
           JOIN utilisateur u ON u.id = vhr.histo_modificateur_id
         WHERE
-          frvh.id = :frsr
+          frvh.service_referentiel_id = :frsr
         ORDER BY
           frvh.id
         ";
diff --git a/module/Paiement/src/Tbl/Process/PaiementProcess.php b/module/Paiement/src/Tbl/Process/PaiementProcess.php
index d0ced00fd9..8efef11500 100755
--- a/module/Paiement/src/Tbl/Process/PaiementProcess.php
+++ b/module/Paiement/src/Tbl/Process/PaiementProcess.php
@@ -195,14 +195,19 @@ class PaiementProcess implements ProcessInterface
             $this->services[$key] = $sap;
         }
 
+        $lap             = new LigneAPayer();
+        $tauxRemu        = (int)$data['TAUX_REMU_ID'];
+        $horaireDebut    = (string)$data['HORAIRE_DEBUT'];
+        $lap->tauxValeur = $this->getServiceTauxRemu()->tauxValeur($tauxRemu, $horaireDebut);
+        $lap->pourcAA    = $this->repartiteur->fromBdd($data);
+        $lap->fromBdd($data);
         if (!array_key_exists($lapKey, $this->services[$key]->lignesAPayer)) {
-            $lap             = new LigneAPayer();
-            $tauxRemu        = (int)$data['TAUX_REMU_ID'];
-            $horaireDebut    = (string)$data['HORAIRE_DEBUT'];
-            $lap->tauxValeur = $this->getServiceTauxRemu()->tauxValeur($tauxRemu, $horaireDebut);
-            $lap->pourcAA    = $this->repartiteur->fromBdd($data);
-            $lap->fromBdd($data);
+
             $this->services[$key]->lignesAPayer[$lapKey] = $lap;
+        }else{
+            $olap = &$this->services[$key]->lignesAPayer[$lapKey];
+            $olap->heuresAA += $lap->heuresAA;
+            $olap->heuresAC += $lap->heuresAC;
         }
 
         if ($mepKey > 0 && !array_key_exists($mepKey, $this->services[$key]->misesEnPaiement)) {
-- 
GitLab