From 500b37601aca5ed6753588d4ef667dff426f1540 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 21 Sep 2023 13:06:50 +0200 Subject: [PATCH] implement new export service for accompanyingcourse exports --- .../Export/LinkedToACP/AvgActivityDuration.php | 9 ++++++++- .../Export/LinkedToACP/AvgActivityVisitDuration.php | 9 ++++++++- .../Export/Export/LinkedToACP/CountActivity.php | 12 ++++++++++-- .../Export/Export/LinkedToACP/ListActivity.php | 9 ++++++++- .../Export/LinkedToACP/SumActivityDuration.php | 9 ++++++++- .../Export/LinkedToACP/SumActivityVisitDuration.php | 9 ++++++++- .../Export/AccompanyingCourseExportHelper.php | 4 ++-- .../Export/Export/CountAccompanyingCourse.php | 9 ++++++++- .../Export/Export/CountAccompanyingPeriodWork.php | 9 ++++++++- .../Export/Export/CountEvaluation.php | 9 ++++++++- .../Export/CountPersonWithAccompanyingCourse.php | 9 ++++++++- .../Export/Export/ListAccompanyingPeriod.php | 4 ++++ .../Export/Export/ListAccompanyingPeriodWork.php | 9 ++++++++- .../Export/Export/ListEvaluation.php | 9 ++++++++- .../Export/ListPersonHavingAccompanyingPeriod.php | 9 ++++++++- .../ListPersonWithAccompanyingPeriodDetails.php | 4 ++++ .../Export/Export/StatAccompanyingCourseDuration.php | 9 ++++++++- 17 files changed, 124 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index 128704296..7fe114401 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -30,10 +31,14 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface { protected EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->repository = $em->getRepository(Activity::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) {} @@ -108,6 +113,8 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface ) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index f1e926c64..dc26dc926 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -30,10 +31,14 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac { protected EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->repository = $em->getRepository(Activity::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -111,6 +116,8 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac ) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 28a318541..b6615f8e5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -30,10 +31,15 @@ class CountActivity implements ExportInterface, GroupedExportInterface { protected EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em - ) { + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper + +) { $this->repository = $em->getRepository(Activity::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) {} @@ -105,6 +111,8 @@ class CountActivity implements ExportInterface, GroupedExportInterface ) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $qb->select('COUNT(DISTINCT activity.id) as export_count_activity'); return $qb; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php index 9ed6bcda2..73d98e954 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php @@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Export\ListActivityHelper; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Entity\Scope; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper; use Chill\MainBundle\Export\ListInterface; @@ -30,14 +31,18 @@ class ListActivity implements ListInterface, GroupedExportInterface private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( ListActivityHelper $helper, EntityManagerInterface $entityManager, - TranslatableStringExportLabelHelper $translatableStringExportLabelHelper + TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->helper = $helper; $this->entityManager = $entityManager; $this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -147,6 +152,8 @@ class ListActivity implements ListInterface, GroupedExportInterface ->addSelect('(SELECT AGGREGATE(acpScope.name) FROM ' . Scope::class . ' acpScope WHERE acpScope MEMBER OF acp.scopes) AS scopesNames') ->addGroupBy('scopesNames'); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index 8adb3b77f..f9bb4fa37 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -30,10 +31,14 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface { protected EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->repository = $em->getRepository(Activity::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -111,6 +116,8 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface ) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index cc424e68b..979974d36 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -30,10 +31,14 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac { protected EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->repository = $em->getRepository(Activity::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -111,6 +116,8 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac ) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + return $qb; } diff --git a/src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php b/src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php index dae4ce254..3c49eb124 100644 --- a/src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php +++ b/src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php @@ -4,9 +4,9 @@ namespace Chill\MainBundle\Export; use Doctrine\ORM\QueryBuilder; -class AccompanyingCourseExportHelper +final readonly class AccompanyingCourseExportHelper { - public static function addClosingMotiveExclusionCriteria(QueryBuilder $qb): QueryBuilder + public static function addClosingMotiveExclusionClause(QueryBuilder $qb): QueryBuilder { $qb->leftJoin('acp.closingMotive', 'cm') ->andWhere( diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 58ef24e42..6fa24df4e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -29,10 +30,14 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface { protected EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->repository = $em->getRepository(AccompanyingPeriod::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder): void @@ -111,6 +116,8 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface ->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $qb->select('COUNT(DISTINCT acp.id) AS export_result'); return $qb; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php index cf9feb3af..a42c7eb66 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -28,10 +29,14 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter { protected EntityManagerInterface $em; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->em = $em; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder): void @@ -112,6 +117,8 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter $qb->select('COUNT(DISTINCT acpw.id) as export_result'); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index d9795e3ba..b61d2b5b1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -27,10 +28,14 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface { private EntityManagerInterface $entityManager; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->entityManager = $em; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -110,6 +115,8 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface ) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $qb->select('COUNT(DISTINCT workeval.id) AS export_result'); return $qb; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php index ae7238d4e..63fa63f46 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -29,10 +30,14 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor { private EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->repository = $em->getRepository(AccompanyingPeriod::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -111,6 +116,8 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor ) )->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $qb->select('COUNT(DISTINCT person.id) AS export_result'); return $qb; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index 4c8c0cae8..c00e6e602 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\Scope; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\Helper\DateTimeHelper; @@ -52,6 +53,7 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper, + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) {} public function buildForm(FormBuilderInterface $builder) @@ -132,6 +134,8 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $qb ->addOrderBy('acp.openingDate') ->addOrderBy('acp.closingDate') diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php index c437454c2..9e225a47c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\Helper\AggregateStringHelper; @@ -100,6 +101,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac private UserHelper $userHelper; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( EntityManagerInterface $entityManager, DateTimeHelper $dateTimeHelper, @@ -112,7 +115,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac SocialActionRender $socialActionRender, RollingDateConverterInterface $rollingDateConverter, AggregateStringHelper $aggregateStringHelper, - SocialActionRepository $socialActionRepository + SocialActionRepository $socialActionRepository, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->entityManager = $entityManager; $this->dateTimeHelper = $dateTimeHelper; @@ -126,6 +130,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac $this->rollingDateConverter = $rollingDateConverter; $this->aggregateStringHelper = $aggregateStringHelper; $this->socialActionRepository = $socialActionRepository; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -291,6 +296,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac ->setParameter('authorized_centers', $centers) ->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date'])); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); return $qb; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php index c3e273733..8a2d6752a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\Helper\AggregateStringHelper; @@ -90,6 +91,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface private UserHelper $userHelper; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( EntityManagerInterface $entityManager, SocialIssueRender $socialIssueRender, @@ -101,7 +104,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface DateTimeHelper $dateTimeHelper, TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, AggregateStringHelper $aggregateStringHelper, - RollingDateConverterInterface $rollingDateConverter + RollingDateConverterInterface $rollingDateConverter, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->entityManager = $entityManager; $this->socialIssueRender = $socialIssueRender; @@ -114,6 +118,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface $this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper; $this->aggregateStringHelper = $aggregateStringHelper; $this->rollingDateConverter = $rollingDateConverter; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -270,6 +275,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface ->setParameter('authorized_centers', $centers) ->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date'])); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); return $qb; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php index 408d0b3af..533f6cd60 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -48,14 +49,18 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf private ListPersonHelper $listPersonHelper; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( ExportAddressHelper $addressHelper, ListPersonHelper $listPersonHelper, - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->addressHelper = $addressHelper; $this->listPersonHelper = $listPersonHelper; $this->entityManager = $em; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -190,6 +195,8 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf $this->listPersonHelper->addSelect($qb, $fields, $data['address_date']); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $qb ->addOrderBy('person.lastName') ->addOrderBy('person.firstName') diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php index 66d4d1530..0a1819884 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -50,6 +51,7 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper, private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) {} public function buildForm(FormBuilderInterface $builder) @@ -133,6 +135,8 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte $this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date'])); $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date'])); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + $qb ->addOrderBy('person.lastName') ->addOrderBy('person.firstName') diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 66b47131d..e558163dc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -31,10 +32,14 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn { private EntityRepository $repository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->repository = $em->getRepository(AccompanyingPeriod::class); + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder): void @@ -142,6 +147,8 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn ->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT) ->setParameter('authorized_centers', $centers); + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + return $qb; }