fix bug in listing users in form filtering tasks

This commit is contained in:
Julien Fastré 2018-10-18 19:59:11 +02:00
parent e25621ef79
commit c36778184d
2 changed files with 8 additions and 1 deletions

5
CHANGELOG.md Normal file
View File

@ -0,0 +1,5 @@
Branch master
=============
- fix bug in filter task form: allow to show the list of users, which was hidden when the user had access to multiple centers;

View File

@ -237,10 +237,11 @@ class SingleTaskListType extends AbstractType
} }
$i = 0; $i = 0;
$circleCenterCond = $qb->expr()->orX();
foreach ($centers as $center) { foreach ($centers as $center) {
$circles = $this->authorizationHelper->getReachableCircles($user, $role, $center); $circles = $this->authorizationHelper->getReachableCircles($user, $role, $center);
// add condition about person and circle // add condition about person and circle
$qb->andWhere( $circleCenterCond->add(
$qb->expr()->andX() $qb->expr()->andX()
->add($qb->expr()->eq('person.center', ':center_'.$i)) ->add($qb->expr()->eq('person.center', ':center_'.$i))
->add($qb->expr()->in('task.circle', ':circles_'.$i)) ->add($qb->expr()->in('task.circle', ':circles_'.$i))
@ -252,6 +253,7 @@ class SingleTaskListType extends AbstractType
// increase counter // increase counter
$i++; $i++;
} }
$qb->andWhere($circleCenterCond);
return $qb->getQuery()->getResult(); return $qb->getQuery()->getResult();
} }