Commit f6dbddef authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Anomalie #23524 : Bug de recherche sur les types d'organisation quand l'option...

Anomalie #23524 : Bug de recherche sur les types d'organisation quand l'option 'Tous' est selectionnée
parent fc0ece53
Loading
Loading
Loading
Loading
+22 −7
Original line number Diff line number Diff line
@@ -224,15 +224,30 @@ class OrganizationService implements ServiceLocatorAwareInterface, EntityManager

        }

        // -------------------------------------------------------------------------------------------------------------
        // FILTRE sur les types d'organisations
        if (isset($filter['type']) && $filter['type']){

            // On purge les types vides (option "Tous")
            $cleanTypes = [];

            foreach ($filter['type'] as $typeValue) {
                if( $typeValue ){
                    $cleanTypes[] = $typeValue;
                }
            }

            if( count($cleanTypes) > 0 ){
                $types = $this->getEntityManager()->getRepository(OrganizationType::class)->createQueryBuilder('t')
                    ->where('t.id IN (:types)')
                ->setParameter('types', $filter['type'])
                    ->setParameter('types', $cleanTypes)
                    ->getQuery()
                    ->getResult();

                $qb->leftJoin('o.typeObj', 't')
                ->andWhere('t.id IN(:type)')->setParameter('type', $types);
                    ->andWhere('t.id IN(:type)')
                    ->setParameter('type', $types);
            }
        }

        if (isset($filter['active']) && $filter['active']){