Compare commits
2 Commits
3818a38106
...
21fc95f71e
Author | SHA1 | Date |
---|---|---|
Arnaud Fornerot | 21fc95f71e | |
afornerot | c6d349696e |
|
@ -45,7 +45,9 @@ class AlertRepository extends EntityRepository
|
|||
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
|
||||
$niveau01=($user?$user->getNiveau01():null);
|
||||
$groups=($user?$user->getGroups():[]);
|
||||
|
||||
|
||||
$userreads=($user?$user->getAlertreaders():[]);
|
||||
|
||||
// Initialisation du calcul des alerts
|
||||
$alerts=new ArrayCollection();
|
||||
|
||||
|
@ -67,8 +69,9 @@ class AlertRepository extends EntityRepository
|
|||
->setParameter("alertcategory",$alertcategoryfilter);
|
||||
}
|
||||
$alertsroles=$qb->getQuery()->getResult();
|
||||
|
||||
foreach($alertsroles as $alertrole) {
|
||||
if(!$alerts->contains($alertrole)&&!$alertrole->getReaders()->contains($user)) $alerts->add($alertrole);
|
||||
if(!$alerts->contains($alertrole)&&!$userreads->contains($alertrole)) $alerts->add($alertrole);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +94,7 @@ class AlertRepository extends EntityRepository
|
|||
}
|
||||
$alertsniveau01s=$qb->getQuery()->getResult();
|
||||
foreach($alertsniveau01s as $alertniveau01) {
|
||||
if(!$alerts->contains($alertniveau01)&&!$alertniveau01->getReaders()->contains($user)) $alerts->add($alertniveau01);
|
||||
if(!$alerts->contains($alertniveau01)&&!$userreads->contains($alertniveau01)) $alerts->add($alertniveau01);
|
||||
}
|
||||
|
||||
// Récupération des alerts par group
|
||||
|
@ -113,8 +116,8 @@ class AlertRepository extends EntityRepository
|
|||
->setParameter("alertcategory",$alertcategoryfilter);
|
||||
}
|
||||
$alertsgroups=$qb->getQuery()->getResult();
|
||||
foreach($alertsgroups as $alertgroup) {
|
||||
if(!$alerts->contains($alertgroup)&&!$alertgroup->getReaders()->contains($user)) $alerts->add($alertgroup);
|
||||
foreach($alertsgroups as $alertgroup) {
|
||||
if(!$alerts->contains($alertgroup)&&!$userreads->contains($alertgroup)) $alerts->add($alertgroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,8 +144,8 @@ class AlertRepository extends EntityRepository
|
|||
->setParameter("alertcategory",$alertcategoryfilter);
|
||||
}
|
||||
$alertsitems=$qb->getQuery()->getResult();
|
||||
foreach($alertsitems as $alertitem) {
|
||||
if(!$alerts->contains($alertitem)&&!$alertitem->getReaders()->contains($user)) $alerts->add($alertitem);
|
||||
foreach($alertsitems as $alertitem) {
|
||||
if(!$alerts->contains($alertitem)&&!$userreads->contains($alertitem)) $alerts->add($alertitem);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue