Commit be545f39 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Correction pour afficher la bonne piece jointe fourni

parent 7a4112b6
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -151,8 +151,8 @@ class PieceJointeService extends AbstractEntityService
            pjf.annee <= :annee
        AND 
            (pjf.dateArchive IS NULL OR pjf.dateArchive > :annee)  
        ORDER BY pjf.annee DESC";

        ";
        $lpjf = $this->getEntityManager()->createQuery($dql)->setParameters([
            'intervenant' => $intervenant->getCode(),
            'annee'       => $intervenant->getAnnee()->getId(),
@@ -164,8 +164,12 @@ class PieceJointeService extends AbstractEntityService
        foreach ($lpjf as $pjf) {
            $pj                              = $pjf->getPieceJointe();
            $pj->annee = $pjf->getAnnee();
            //Gérer les cas où plusieurs PJ sont éligible mais sans date d'archive, on prend la première uniquement.
            if(!array_key_exists($pj->getType()->getId(), $result))
            {
                $result[$pj->getType()->getId()] = $pj;
            }
        }

        return $result;
    }