From efe27bf1008a0446d3ae3c3ad2afe69e51428920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 12 Sep 2018 10:54:00 +0200 Subject: [PATCH] [activity report count] do not count activities from centers not selected --- CHANGELOG.md | 6 ++++++ Export/Export/CountActivity.php | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..aa01db268 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ + +Master branch +============= + +- [report activity count] fix error: do not show centers which are not selected in results. + diff --git a/Export/Export/CountActivity.php b/Export/Export/CountActivity.php index cdab3dd74..00f741fce 100644 --- a/Export/Export/CountActivity.php +++ b/Export/Export/CountActivity.php @@ -69,6 +69,7 @@ class CountActivity implements ExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = array()) { $qb = $this->entityManager->createQueryBuilder(); + $centers = array_map(function($el) { return $el['center']; }, $acl); $qb->select('COUNT(activity.id) as export_count_activity') ->from('ChillActivityBundle:Activity', 'activity') @@ -78,6 +79,10 @@ class CountActivity implements ExportInterface $qb->join('activity.person', 'person'); } + $qb->where($qb->expr()->in('person.center', ':centers')) + ->setParameter('centers', $centers) + ; + return $qb; }