Skip to content

Commit

Permalink
Merge pull request #1447 from MTES-MCT/fix/1419-avoid-visite-notifica…
Browse files Browse the repository at this point in the history
…tions

[BO - Visites] Notifications pour agents uniquement si pas un agent qui remplit la visite
  • Loading branch information
sfinx13 authored Jul 10, 2023
2 parents 7c8f5b0 + 0bf0c83 commit f6206c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Service/Signalement/VisiteNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ public function notifyAgents(
?Affectation $affectation = null,
): void {
if ($intervention) {
$listUsersPartner = $intervention->getPartner() && $intervention->getPartner() != $currentUser->getPartner() ?
$intervention->getPartner()->getUsers()->toArray() : [];
if ($notifyAdminTerritory) {
$listUsersTerritoryAdmin = $this->userRepository->findActiveTerritoryAdmins($intervention->getSignalement()->getTerritory());
$listUsersPartner = $intervention->getPartner() ? $intervention->getPartner()->getUsers()->toArray() : [];
$listUsersToNotify = array_unique(array_merge($listUsersTerritoryAdmin, $listUsersPartner), \SORT_REGULAR);
} else {
$listUsersToNotify = $intervention->getPartner() ? $intervention->getPartner()->getUsers() : [];
$listUsersToNotify = $listUsersPartner;
}
} else {
$listUsersToNotify = $affectation->getPartner()->getUsers();
Expand Down

0 comments on commit f6206c8

Please sign in to comment.