From de4cd60b3d09b45d0cbc2f1cedc4affa0aff7f0f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Jul 2022 12:52:02 +0200 Subject: [PATCH 1/3] query adjusted to fetch only active objectives for a social action --- .../Repository/SocialWork/GoalRepository.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php index ec74b1919..58608bb6c 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Repository\SocialWork; use Chill\PersonBundle\Entity\SocialWork\Goal; use Chill\PersonBundle\Entity\SocialWork\SocialAction; +use DateTime; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; @@ -73,6 +74,14 @@ final class GoalRepository implements ObjectRepository $qb = $this->buildQueryBySocialActionWithDescendants($action); $qb->select('g'); + $qb->andWhere( + $qb->expr()->orX( + $qb->expr()->isNull('g.desactivationDate'), + $qb->expr()->gt('g.desactivationDate', ':now') + ) + ) + ->setParameter('now', new DateTime('now')); + foreach ($orderBy as $sort => $order) { $qb->addOrderBy('g.' . $sort, $order); } From 62720005884a479e598a44923201692132e322b9 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Jul 2022 12:53:20 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ed9cdebf..fff655f1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to * [person-thirdparty]: fix quick-add of names that consist of multiple parts (eg. De Vlieger) within onthefly modal person/thirdparty * [search]: Order of birthdate fields changed in advanced search to avoid confusion. * [workflow]: Constraint added to workflow (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/675) +* [social_action]: only show active objectives (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/625) ## Test releases From 62dc9097080933ad966380d76eed16fe29ceb899 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Jul 2022 14:51:40 +0200 Subject: [PATCH 3/3] php cs fixes, stan ok! --- .../ChillPersonBundle/Repository/SocialWork/GoalRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php index 58608bb6c..3dbf811f4 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php @@ -80,7 +80,7 @@ final class GoalRepository implements ObjectRepository $qb->expr()->gt('g.desactivationDate', ':now') ) ) - ->setParameter('now', new DateTime('now')); + ->setParameter('now', new DateTime('now')); foreach ($orderBy as $sort => $order) { $qb->addOrderBy('g.' . $sort, $order);