From b9890d13026b0fc3a99455630d31303e5e32858c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 10:33:30 +0100 Subject: [PATCH] Minor fixes --- .../WithParticipationBetweenDatesFilter.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 52d788894..121abb8d0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -46,14 +46,19 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf $qb ->andWhere( - $qb->expr()->exists( - 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acpp ". - "WHERE {$p}_acpp.person = person ". - "AND OVERLAPSI (acpp.startDate, acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = 'TRUE' ") + $qb->expr()->andX( + $qb->expr()->exists( + "SELECT 1 FROM ".AccompanyingPeriodParticipation::class." {$p}_acp ". + "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") + ) ) ->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); - } public function applyOn(): string @@ -75,7 +80,7 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf public function getFormDefaultData(): array { return [ - 'date_after' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'date_after' => new RollingDate(RollingDate::T_YEAR_CURRENT_START), 'date_before' => new RollingDate(RollingDate::T_TODAY), ]; }