From 044bab45ad3f8443679fc4ff29a61dccfb177f80 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 15:29:59 +0100 Subject: [PATCH 1/2] Fix query : was missing parenthesis. --- .../WithParticipationBetweenDatesFilter.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 121abb8d0..ab921c895 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Export\Declarations; use Doctrine\DBAL\Types\Types; @@ -46,16 +47,14 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf $qb ->andWhere( - $qb->expr()->andX( + $qb->expr()->exists( - "SELECT 1 FROM ".AccompanyingPeriodParticipation::class." {$p}_acp ". + "SELECT 1 FROM ".AccompanyingPeriodParticipation::class." {$p}_acp JOIN {$p}_acp.accompanyingPeriod {$p}_acpp ". "WHERE {$p}_acp.person = person ". - "AND OVERLAPSI ({$p}_acp.openingDate, {$p}_acp.closingDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE"), - $qb->expr()->exists( - 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acpp ". - "WHERE {$p}_acpp.person = person ". - "AND OVERLAPSI ({$p}_acpp.startDate, {$p}_acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE") - ) + "AND OVERLAPSI({$p}_acp.startDate, {$p}_acp.endDate), (:{$p}_date_after, :{$p}_date_before) = TRUE ". + "AND OVERLAPSI({$p}_acpp.openingDate, {$p}_acpp.closingDate), (:{$p}_date_after, :{$p}_date_before) = TRUE") + + ) ->setParameter("{$p}_date_after", $this->rollingDateConverter->convert($data['date_after']), Types::DATE_IMMUTABLE) ->setParameter("{$p}_date_before", $this->rollingDateConverter->convert($data['date_before']), Types::DATE_IMMUTABLE); From 34cbd2605c0e8da0ab8bc887b0bc4d772c21f8c2 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 15:32:04 +0100 Subject: [PATCH 2/2] Add a changie --- .changes/unreleased/Feature-20231218-153151.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Feature-20231218-153151.yaml diff --git a/.changes/unreleased/Feature-20231218-153151.yaml b/.changes/unreleased/Feature-20231218-153151.yaml new file mode 100644 index 000000000..8a842bfa2 --- /dev/null +++ b/.changes/unreleased/Feature-20231218-153151.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Create new filter for persons having a participation in an accompanying period + during a certain time span +time: 2023-12-18T15:31:51.489901829+01:00 +custom: + Issue: "231"