From 1b831bc424a6d3c729eec9b0575d6525a1a25285 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 16 Jan 2025 15:19:38 +0100 Subject: [PATCH] Fix activity between dates filter: condition added for alias --- .changes/unreleased/Fixed-20250116-151459.yaml | 5 +++++ .../PersonFilters/PersonHavingActivityBetweenDateFilter.php | 4 +++- .../Controller/SocialWorkExportController.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250116-151459.yaml diff --git a/.changes/unreleased/Fixed-20250116-151459.yaml b/.changes/unreleased/Fixed-20250116-151459.yaml new file mode 100644 index 000000000..40647c18d --- /dev/null +++ b/.changes/unreleased/Fixed-20250116-151459.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: 'Export: fix missing alias in activity between certain dates filter. Condition added for alias.' +time: 2025-01-16T15:14:59.323517319+01:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php index 6362b8295..2fd628edb 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php @@ -55,7 +55,9 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem .' AND ' .'(person_person_having_activity.id = person.id OR person MEMBER OF activity_person_having_activity.persons)'); - $sqb->andWhere('activity_person_having_activity.id = activity.id'); + if (\in_array('activity', $qb->getAllAliases(), true)) { + $sqb->andWhere('activity_person_having_activity.id = activity.id'); + } if (isset($data['reasons']) && [] !== $data['reasons']) { // add clause activity reason diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php index c13969431..b70010362 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php @@ -53,7 +53,7 @@ class SocialWorkExportController extends AbstractController $socialIssues = $this->socialIssueRepository->findAll(); - $socialIssues = array_map(fn($issue) => [ + $socialIssues = array_map(fn ($issue) => [ 'id' => $issue->getId(), 'title' => $this->socialIssueRender->renderString($issue, []), 'ordering' => $issue->getOrdering(), @@ -106,7 +106,7 @@ class SocialWorkExportController extends AbstractController $socialActions = $this->socialActionRepository->findAll(); - $socialActions = array_map(fn($action) => [ + $socialActions = array_map(fn ($action) => [ 'id' => $action->getId(), 'title' => $this->socialActionRender->renderString($action, []), 'desactivationDate' => $action->getDesactivationDate(),