From 51ac4e0938038acf775e10de292438700a5eba10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Nov 2022 13:44:04 +0100 Subject: [PATCH] Feature: [export] filter accompanying period which has no action - work --- .../AccompanyingCourseFilters/HasNoActionFilter.php | 12 ++++-------- .../ChillPersonBundle/translations/messages.fr.yml | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoActionFilter.php index 771b8d063..54c28d027 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoActionFilter.php @@ -12,10 +12,10 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -use function in_array; class HasNoActionFilter implements FilterInterface { @@ -24,13 +24,9 @@ class HasNoActionFilter implements FilterInterface return null; } - public function alterQuery(QueryBuilder $qb, $data) + public function alterQuery(QueryBuilder $qb, $data): void { - if (!in_array('acpw', $qb->getAllAliases(), true)) { - $qb->join('acp.works', 'acpw'); - } - - $qb->andWhere('COUNT(acp.works) IS NULL'); + $qb->andWhere('NOT EXISTS (SELECT 1 FROM ' . AccompanyingPeriodWork::class . ' work WHERE work.accompanyingPeriod = acp)'); } public function applyOn(): string @@ -38,7 +34,7 @@ class HasNoActionFilter implements FilterInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) + public function buildForm(FormBuilderInterface $builder): void { // no form } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 3821253ed..4b1919f8d 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -569,7 +569,7 @@ Filter by which has no referrer: Filtrer les parcours sans référent "Filtered acp which has no referrer on date: %date%": "Filtré les parcours sans référent à cette date: %date%" Has no referrer on this date: N'a pas de référent à cette date Filter by which has no action: Filtrer les parcours qui n’ont pas d’actions -Filtered acp which has no actions: Filtré les parcours qui n'ont pas d'actions +Filtered acp which has no actions: 'Filtré: uniquement les parcours qui n''ont pas d''actions' Group by number of actions: Grouper les parcours par nombre d’actions Filter by creator: Filtrer les parcours par créateur Filter by creator job: Filtrer les parcours par métier du créateur