From 24833be6811b474e31ac8f6bca702c1a9ee98609 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 25 Nov 2022 14:15:56 +0100 Subject: [PATCH 1/2] take into account null value in formatter --- .../ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php index 4084bfb4f..6b77e5b2b 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php @@ -445,6 +445,8 @@ class SpreadSheetFormatter implements FormatterInterface $this->initializeCache($key); } + $value = null === $value ? '' : $value; + return call_user_func($this->cacheDisplayableResult[$key], $value); } From 3ebf3ae148aacdc6ab44dab20a710c98df3ad85d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 25 Nov 2022 14:16:44 +0100 Subject: [PATCH 2/2] fix activity list export for linked with person --- .../Export/LinkedToPerson/ListActivity.php | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index dee5dce8d..f052c5885 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -210,10 +210,20 @@ class ListActivity implements ListInterface, GroupedExportInterface $qb ->from('ChillActivityBundle:Activity', 'activity') - ->join('activity.person', 'person') - ->join('actperson.center', 'actcenter') - ->andWhere('actcenter IN (:authorized_centers)') - ->setParameter('authorized_centers', $centers); + ->join('activity.person', 'actperson') + ->join('actperson.centerHistory', 'centerHistory'); + + $qb->where( + $qb->expr()->andX( + $qb->expr()->lte('centerHistory.startDate', 'activity.date'), + $qb->expr()->orX( + $qb->expr()->isNull('centerHistory.endDate'), + $qb->expr()->gt('centerHistory.endDate', 'activity.date') + ) + ) + ) + ->andWhere($qb->expr()->in('centerHistory.center', ':centers')) + ->setParameter('centers', $centers); foreach ($this->fields as $f) { if (in_array($f, $data['fields'], true)) { @@ -224,17 +234,17 @@ class ListActivity implements ListInterface, GroupedExportInterface break; case 'person_firstname': - $qb->addSelect('person.firstName AS person_firstname'); + $qb->addSelect('actperson.firstName AS person_firstname'); break; case 'person_lastname': - $qb->addSelect('person.lastName AS person_lastname'); + $qb->addSelect('actperson.lastName AS person_lastname'); break; case 'person_id': - $qb->addSelect('person.id AS person_id'); + $qb->addSelect('actperson.id AS person_id'); break; @@ -251,7 +261,7 @@ class ListActivity implements ListInterface, GroupedExportInterface break; case 'type_name': - $qb->join('activity.type', 'type'); + $qb->join('activity.activityType', 'type'); $qb->addSelect('type.name AS type_name'); break; @@ -263,6 +273,11 @@ class ListActivity implements ListInterface, GroupedExportInterface break; + case 'attendee': + $qb->addSelect('IDENTITY(activity.attendee) AS attendee'); + + break; + default: $qb->addSelect(sprintf('activity.%s as %s', $f, $f));