diff --git a/src/Repository/SignalementRepository.php b/src/Repository/SignalementRepository.php index 0b72d82e8..6bcabd963 100755 --- a/src/Repository/SignalementRepository.php +++ b/src/Repository/SignalementRepository.php @@ -1390,7 +1390,7 @@ public function findSignalementsBetweenDates(\DateTimeImmutable $startDate, \Dat public function findForAPI(User $user, int $limit = 1, int $page = 1, ?string $uuid = null, ?string $reference = null): array { - $partner = $user->getPartner(); // TODO : impact multi territoire + $partners = $user->getPartners(); $offset = ($page - 1) * $limit; $qb = $this->createQueryBuilder('s') ->select('s', 'desordrePrecisions', 'desordreCategories', 'desordreCriteres', 'signalementQualifications', @@ -1405,8 +1405,8 @@ public function findForAPI(User $user, int $limit = 1, int $page = 1, ?string $u ->leftJoin('s.affectations', 'affectations') ->leftJoin('s.interventions', 'interventions') ->leftJoin('s.territory', 'territory') - ->where('affectations.partner = :partner') - ->setParameter('partner', $partner) + ->where('affectations.partner IN (:partners)') + ->setParameter('partners', $partners) ->orderBy('s.createdAt', 'DESC') ->setFirstResult($offset) ->setMaxResults($limit); diff --git a/tests/Functional/Controller/Back/BackUserControllerTest.php b/tests/Functional/Controller/Back/BackUserControllerTest.php index 73e32cb8d..231d96614 100644 --- a/tests/Functional/Controller/Back/BackUserControllerTest.php +++ b/tests/Functional/Controller/Back/BackUserControllerTest.php @@ -36,12 +36,12 @@ public function provideParamsUserList(): iterable { yield 'Search without params' => [[], 57]; yield 'Search with queryUser admin' => [['queryUser' => 'admin'], 21]; - yield 'Search with territory 13' => [['territory' => 13], 10]; + yield 'Search with territory 13' => [['territory' => 13], 11]; yield 'Search with territory 13 and partner 6 and 7' => [['territory' => 13, 'partners' => [6, 7]], 2]; yield 'Search with status 0' => [['statut' => 0], 8]; yield 'Search with role ROLE_ADMIN' => [['role' => 'ROLE_ADMIN'], 3]; yield 'Search with role ROLE_ADMIN and territory 13' => [['role' => 'ROLE_ADMIN', 'territory' => 13], 0]; - yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 8]; + yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 9]; yield 'Search with territory 13 and partnerType Ars' => [['territory' => 13, 'partnerType' => 'ARS'], 1]; } @@ -67,13 +67,13 @@ public function testUserExport(array $params, int $nb): void public function provideParamsUserExport(): iterable { - yield 'Search without params' => [[], 10]; + yield 'Search without params' => [[], 11]; yield 'Search with queryUser user' => [['queryUser' => 'user'], 6]; - yield 'Search with partner 6 and 7' => [['partners' => [2]], 4]; - yield 'Search with status 1' => [['statut' => 1], 8]; + yield 'Search with partner 6 and 7' => [['partners' => [2]], 5]; + yield 'Search with status 1' => [['statut' => 1], 9]; yield 'Search with role ROLE_USER_PARTNER' => [['role' => 'ROLE_USER_PARTNER'], 6]; yield 'Search with role ROLE_USER_PARTNER and status 1' => [['role' => 'ROLE_USER_PARTNER', 'statut' => 1], 4]; - yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 10]; + yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 11]; yield 'Search with partnerType Ars' => [['partnerType' => 'ARS'], 1]; } } diff --git a/tests/Functional/Service/Signalement/VisiteNotifierTest.php b/tests/Functional/Service/Signalement/VisiteNotifierTest.php index 0d5e919ec..785ff9d71 100644 --- a/tests/Functional/Service/Signalement/VisiteNotifierTest.php +++ b/tests/Functional/Service/Signalement/VisiteNotifierTest.php @@ -44,7 +44,7 @@ public function testNotifyVisiteToConclude() $intervention = $signalement->getInterventions()[0]; $nbNotified = $this->visiteNotifier->notifyVisiteToConclude($intervention); - $this->assertEquals($nbNotified, 4); + $this->assertEquals($nbNotified, 5); } public function testNotifyVisiteToConclude69()