From 2cc5fa06ae238cea79777bb29cc45249d7f12d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 10 Nov 2023 18:01:13 +0100 Subject: [PATCH] Export: split export about person on accompanying period work: one with the people associated with the work, another one with the people associated with the accompanying period --- .../unreleased/Feature-20231110-175928.yaml | 7 + ...rkAssociatePersonOnAccompanyingPeriod.php} | 8 +- ...panyingPeriodWorkAssociatePersonOnWork.php | 139 +++++++ ...rkAssociatePersonOnAccompanyingPeriod.php} | 8 +- ...panyingPeriodWorkAssociatePersonOnWork.php | 348 ++++++++++++++++++ ...sociatePersonOnAccompanyingPeriodTest.php} | 12 +- ...ingPeriodWorkAssociatePersonOnWorkTest.php | 48 +++ ...ssociatePersonOnAccompanyingPeriodTest.php | 103 ++++++ ...ngPeriodWorkAssociatePersonOnWorkTest.php} | 8 +- .../services/exports_social_actions.yaml | 14 +- .../translations/messages.fr.yml | 20 +- 11 files changed, 691 insertions(+), 24 deletions(-) create mode 100644 .changes/unreleased/Feature-20231110-175928.yaml rename src/Bundle/ChillPersonBundle/Export/Export/{CountAccompanyingPeriodWork.php => CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php} (90%) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWork.php rename src/Bundle/ChillPersonBundle/Export/Export/{ListAccompanyingPeriodWork.php => ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php} (97%) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php rename src/Bundle/ChillPersonBundle/Tests/Export/Export/{CountAccompanyingPeriodWorkTest.php => CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php} (69%) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php rename src/Bundle/ChillPersonBundle/Tests/Export/Export/{ListAccompanyingPeriodWorkTest.php => ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php} (91%) diff --git a/.changes/unreleased/Feature-20231110-175928.yaml b/.changes/unreleased/Feature-20231110-175928.yaml new file mode 100644 index 000000000..a42e1210d --- /dev/null +++ b/.changes/unreleased/Feature-20231110-175928.yaml @@ -0,0 +1,7 @@ +kind: Feature +body: 'Export: split export about person on accompanying period work: one with the + people associated with the work, another one with the people associated with the + accompanying period' +time: 2023-11-10T17:59:28.388361356+01:00 +custom: + Issue: "200" diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php rename to src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php index e274ac5cd..a73e4f037 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php @@ -25,7 +25,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; -class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInterface +class CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod implements ExportInterface, GroupedExportInterface { private readonly bool $filterStatsByCenters; @@ -53,7 +53,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter public function getDescription(): string { - return 'Count social work actions by various parameters'; + return 'export.export.count_accompanying_period_work_associate_person.description'; } public function getGroup(): string @@ -68,7 +68,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter } $labels = array_combine($values, $values); - $labels['_header'] = $this->getTitle(); + $labels['_header'] = 'export.export.count_accompanying_period_work_associate_person.header'; return static fn ($value) => $labels[$value]; } @@ -85,7 +85,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter public function getTitle(): string { - return 'Count social work actions'; + return 'export.export.count_accompanying_period_work_associate_person.title'; } public function getType(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWork.php new file mode 100644 index 000000000..4f43a78b0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWork.php @@ -0,0 +1,139 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // No form necessary? + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.count_accompanying_period_work_associate_work.description'; + } + + public function getGroup(): string + { + return 'Exports of social work actions'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_result' !== $key) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + $labels = array_combine($values, $values); + $labels['_header'] = 'export.export.count_accompanying_period_work_associate_work.header'; + + return static fn ($value) => $labels[$value]; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.count_accompanying_period_work_associate_work.title'; + } + + public function getType(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->em->createQueryBuilder(); + + $qb + ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acpw.persons', 'person'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person + AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + $qb->select('COUNT(DISTINCT acpw.id) as export_result'); + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php rename to src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php index 81c60bae6..49b21ef69 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php @@ -47,7 +47,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; -class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterface +class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod implements ListInterface, GroupedExportInterface { private const FIELDS = [ 'id', @@ -121,7 +121,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac public function getDescription(): string { - return 'export.list.acpw.List description'; + return 'export.list.acpw_associate_period.List description'; } public function getGroup(): string @@ -190,12 +190,12 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac public function getResult($query, $data) { - return dump($query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR)); + return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR); } public function getTitle(): string { - return 'export.list.acpw.List of accompanying period works'; + return 'export.list.acpw_associate_period.List of accompanying period works'; } public function getType(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php new file mode 100644 index 000000000..4e68d5341 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php @@ -0,0 +1,348 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('calc_date', PickRollingDateType::class, [ + 'label' => 'export.list.acpw.Date of calculation for associated elements', + 'help' => 'export.list.acpw.help_description', + 'required' => true, + ]); + } + + public function getFormDefaultData(): array + { + return ['calc_date' => new RollingDate(RollingDate::T_TODAY)]; + } + + public function getAllowedFormattersTypes() + { + return [FormatterInterface::TYPE_LIST]; + } + + public function getDescription(): string + { + return 'export.list.acpw_associate_work.List description'; + } + + public function getGroup(): string + { + return 'Exports of social work actions'; + } + + public function getLabels($key, array $values, $data) + { + return match ($key) { + 'startDate', 'endDate', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.acpw.'.$key), + 'socialAction' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.'.$key; + } + + if (null === $value) { + return ''; + } + + return $this->socialActionRender->renderString( + $this->socialActionRepository->find($value), + [] + ); + }, + 'socialIssue' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.'.$key; + } + + if (null === $value) { + return ''; + } + + return $this->socialIssueRender->renderString( + $this->socialIssueRepository->find($value), + [] + ); + }, + 'createdBy', 'updatedBy', 'acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'referrers' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + // 'acpwReferrers' => $this->userHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + 'personsName' => $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + 'handlingThierParty' => $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'thirdParties' => $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + 'personsId', 'goalsId', 'goalResultsId', 'resultsId', 'evaluationsId' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + 'goalsTitle', 'goalResultsTitle', 'resultsTitle', 'evaluationsTitle' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + default => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.'.$key; + } + + if (null === $value) { + return ''; + } + + return $value; + }, + }; + } + + public function getQueryKeys($data) + { + return self::FIELDS; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.list.acpw_associate_work.List of accompanying period works'; + } + + public function getType(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->entityManager->createQueryBuilder(); + + $qb + ->from(AccompanyingPeriodWork::class, 'acpw') + ->distinct() + ->select('acpw.id AS id') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acpw.persons', 'person') + ; + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person + AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + $this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + ]; + } + + private function addSelectClauses(QueryBuilder $qb, \DateTimeImmutable $calcDate): void + { + // add regular fields + foreach ([ + 'startDate', + 'endDate', + 'note', + 'createdAt', + 'updatedAt', + ] as $field) { + $qb->addSelect(sprintf('acpw.%s AS %s', $field, $field)); + } + + // those with identity + foreach ([ + 'createdBy', + 'updatedBy', + 'handlingThierParty', + ] as $field) { + $qb->addSelect(sprintf('IDENTITY(acpw.%s) AS %s', $field, $field)); + } + + // join socialaction + $qb + ->join('acpw.socialAction', 'sa') + ->addSelect('sa.id AS socialActionId') + ->addSelect('sa.id AS socialAction') + ->addSelect('IDENTITY(sa.issue) AS socialIssue'); + + // join acp + $qb + ->addSelect('acp.id AS acp_id') + ->addSelect('IDENTITY(acp.user) AS acp_user'); + + // persons + $qb + ->addSelect('(SELECT AGGREGATE(person_acpw_member.id) FROM '.Person::class.' person_acpw_member ' + .'WHERE person_acpw_member MEMBER OF acpw.persons) AS personsId') + ->addSelect('(SELECT AGGREGATE(person1_acpw_member.id) FROM '.Person::class.' person1_acpw_member ' + .'WHERE person1_acpw_member MEMBER OF acpw.persons) AS personsName'); + + // referrers => at date XXXX + $qb + ->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM '.UserHistory::class.' history '. + 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calcDate AND (history.endDate IS NULL OR history.endDate > :calcDate)) AS referrers'); + + /* + // acpwReferrers at date XXX + $qb + ->addSelect('( + SELECT IDENTITY(acpw_ref_history.accompanyingPeriodWork) AS acpw_ref_history_id, + JSON_BUILD_OBJECT(\'uid\', IDENTITY(acpw_ref_history.user), \'d\', acpw_ref_history.startDate) + FROM ' . AccompanyingPeriodWorkReferrerHistory::class . ' acpw_ref_history ' . + 'WHERE acpw_ref_history.accompanyingPeriodWork = acpw AND acpw_ref_history.startDate <= :calcDate AND (acpw_ref_history.endDate IS NULL or acpw_ref_history.endDate > :calcDate) GROUP BY acpw_ref_history_id) AS acpwReferrers' + ); + */ + + // thirdparties + $qb + ->addSelect('(SELECT AGGREGATE(tp.id) FROM '.ThirdParty::class.' tp ' + .'WHERE tp MEMBER OF acpw.thirdParties) AS thirdParties'); + + // goals + $qb + ->addSelect('(SELECT AGGREGATE(IDENTITY(goal.goal)) FROM '.AccompanyingPeriodWorkGoal::class.' goal ' + .'WHERE goal MEMBER OF acpw.goals) AS goalsId') + ->addSelect('(SELECT AGGREGATE(g.title) FROM '.AccompanyingPeriodWorkGoal::class.' goal1 ' + .'LEFT JOIN '.Goal::class.' g WITH goal1.goal = g.id WHERE goal1 MEMBER OF acpw.goals) AS goalsTitle'); + + // goals results + $qb + ->addSelect('(SELECT AGGREGATE(wr.id) FROM '.Result::class.' wr ' + .'JOIN '.AccompanyingPeriodWorkGoal::class.' wg WITH wr MEMBER OF wg.results ' + .'WHERE wg MEMBER OF acpw.goals) AS goalResultsId') + ->addSelect('(SELECT AGGREGATE(wr1.title) FROM '.Result::class.' wr1 ' + .'JOIN '.AccompanyingPeriodWorkGoal::class.' wg1 WITH wr1 MEMBER OF wg1.results ' + .'WHERE wg1 MEMBER OF acpw.goals) AS goalResultsTitle'); + + // results + $qb + ->addSelect('(SELECT AGGREGATE(result.id) FROM '.Result::class.' result ' + .'WHERE result MEMBER OF acpw.results ) AS resultsId ') + ->addSelect('(SELECT AGGREGATE (result1.title) FROM '.Result::class.' result1 ' + .'WHERE result1 MEMBER OF acpw.results ) AS resultsTitle '); + + // evaluations + $qb + ->addSelect('(SELECT AGGREGATE(IDENTITY(we.evaluation)) FROM '.AccompanyingPeriodWorkEvaluation::class.' we ' + .'WHERE we MEMBER OF acpw.accompanyingPeriodWorkEvaluations ) AS evaluationsId ') + ->addSelect('(SELECT AGGREGATE(ev.title) FROM '.AccompanyingPeriodWorkEvaluation::class.' we1 ' + .'LEFT JOIN '.Evaluation::class.' ev WITH we1.evaluation = ev.id ' + .'WHERE we1 MEMBER OF acpw.accompanyingPeriodWorkEvaluations ) AS evaluationsTitle '); + + $qb->setParameter('calcDate', $calcDate); + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php similarity index 69% rename from src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php index 271f448d6..5caabf351 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php @@ -13,7 +13,7 @@ namespace Export\Export; use Chill\MainBundle\Test\Export\AbstractExportTest; use Chill\PersonBundle\Export\Declarations; -use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork; +use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod; use Doctrine\ORM\EntityManagerInterface; /** @@ -21,23 +21,19 @@ use Doctrine\ORM\EntityManagerInterface; * * @coversNothing */ -final class CountAccompanyingPeriodWorkTest extends AbstractExportTest +final class CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest extends AbstractExportTest { - private CountAccompanyingPeriodWork $export; - protected function setUp(): void { self::bootKernel(); - - $this->export = self::$container->get(CountAccompanyingPeriodWork::class); } public function getExport() { $em = self::$container->get(EntityManagerInterface::class); - yield new CountAccompanyingPeriodWork($em, $this->getParameters(true)); - yield new CountAccompanyingPeriodWork($em, $this->getParameters(false)); + yield new CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod($em, $this->getParameters(true)); + yield new CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod($em, $this->getParameters(false)); } public function getFormData(): array diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php new file mode 100644 index 000000000..6b6e7b7b4 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php @@ -0,0 +1,48 @@ +get(EntityManagerInterface::class); + + yield new CountAccompanyingPeriodWorkAssociatePersonOnWork($em, $this->getParameters(true)); + yield new CountAccompanyingPeriodWorkAssociatePersonOnwork($em, $this->getParameters(false)); + } + + public function getFormData(): array + { + return [[]]; + } + + public function getModifiersCombination() + { + return [[Declarations::SOCIAL_WORK_ACTION_TYPE]]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php new file mode 100644 index 000000000..aacd1bf55 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php @@ -0,0 +1,103 @@ +get(EntityManagerInterface::class); + $dateTimeHelper = self::$container->get(DateTimeHelper::class); + $userHelper = self::$container->get(UserHelper::class); + $personHelper = self::$container->get(LabelPersonHelper::class); + $thirdPartyHelper = self::$container->get(LabelThirdPartyHelper::class); + $translatableStringExportLabelHelper = self::$container->get(TranslatableStringExportLabelHelper::class); + $socialIssueRender = self::$container->get(SocialIssueRender::class); + $socialIssueRepository = self::$container->get(SocialIssueRepository::class); + $socialActionRender = self::$container->get(SocialActionRender::class); + $rollingDateConverter = self::$container->get(RollingDateConverterInterface::class); + $aggregateStringHelper = self::$container->get(AggregateStringHelper::class); + $socialActionRepository = self::$container->get(SocialActionRepository::class); + + yield new ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod( + $entityManager, + $dateTimeHelper, + $userHelper, + $personHelper, + $thirdPartyHelper, + $translatableStringExportLabelHelper, + $socialIssueRender, + $socialIssueRepository, + $socialActionRender, + $rollingDateConverter, + $aggregateStringHelper, + $socialActionRepository, + $this->getParameters(true), + ); + + yield new ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod( + $entityManager, + $dateTimeHelper, + $userHelper, + $personHelper, + $thirdPartyHelper, + $translatableStringExportLabelHelper, + $socialIssueRender, + $socialIssueRepository, + $socialActionRender, + $rollingDateConverter, + $aggregateStringHelper, + $socialActionRepository, + $this->getParameters(false), + ); + } + + public function getFormData() + { + return [ + ['calc_date' => new RollingDate(RollingDate::T_TODAY)], + ]; + } + + public function getModifiersCombination() + { + return [[Declarations::ACP_TYPE]]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php index ab8ca7c38..2f65ac85b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php @@ -19,7 +19,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Test\Export\AbstractExportTest; use Chill\PersonBundle\Export\Declarations; -use Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWork; +use Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWorkAssociatePersonOnWork; use Chill\PersonBundle\Export\Helper\LabelPersonHelper; use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository; @@ -33,7 +33,7 @@ use Doctrine\ORM\EntityManagerInterface; * * @coversNothing */ -class ListAccompanyingPeriodWorkTest extends AbstractExportTest +class ListAccompanyingPeriodWorkAssociatePersonOnWorkTest extends AbstractExportTest { protected function setUp(): void { @@ -56,7 +56,7 @@ class ListAccompanyingPeriodWorkTest extends AbstractExportTest $aggregateStringHelper = self::$container->get(AggregateStringHelper::class); $socialActionRepository = self::$container->get(SocialActionRepository::class); - yield new ListAccompanyingPeriodWork( + yield new ListAccompanyingPeriodWorkAssociatePersonOnWork( $entityManager, $dateTimeHelper, $userHelper, @@ -72,7 +72,7 @@ class ListAccompanyingPeriodWorkTest extends AbstractExportTest $this->getParameters(true), ); - yield new ListAccompanyingPeriodWork( + yield new ListAccompanyingPeriodWorkAssociatePersonOnWork( $entityManager, $dateTimeHelper, $userHelper, diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 57be6bf40..f813455d8 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -4,14 +4,24 @@ services: autoconfigure: true ## Indicators - Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork: + Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod: tags: + # the name is not matching the class name: it is kept for backward compatibility - { name: chill.export, alias: count_social_work_actions } - Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWork: + Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWorkAssociatePersonOnWork: tags: + - { name: chill.export, alias: count_social_work_actions_associate_person_work } + + Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod: + tags: + # the name is not matching the class name: it is kept for backward compatibility - { name: chill.export, alias: list_social_work_actions } + Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWorkAssociatePersonOnWork: + tags: + - { name: chill.export, alias: list_social_work_actions_associate_person_work } + ## FILTERS chill.person.export.filter_social_work_type: class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\SocialWorkTypeFilter diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 87c0e3703..ceebe7d1b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -379,8 +379,6 @@ Create an average of accompanying courses duration of each person participation Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré Exports of social work actions: Exports des actions d'accompagnement -Count social work actions: Nombre d'actions -Count social work actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. Exports of evaluations: Exports des évaluations @@ -1000,6 +998,16 @@ export: Count household with accompanying course by various parameters.: Compte le nombre de ménages impliqués dans un parcours selon différents filtres. Date of calculation of household members: Date à laquelle les membres du ménages sont comptabilisés + count_accompanying_period_work_associate_person: + title: Nombre d'actions, filtres et regroupements sur les usagers du parcours + description: Compte le nombre d'actions d'accompagnement avec des filtres et regroupements possibles sur les usagers, les parcours et les actions. Les filtres et regroupements agissent sur les usagers concernés par le parcours de l'action. + header: Nombre d'actions + + count_accompanying_period_work_associate_work: + title: Nombre d'actions, filtres et regroupements sur les usagers de l'action + description: Compte le nombre d'actions d'accompagnement avec des filtres et regroupements possibles sur les usagers, les parcours et les actions. Les filtres et regroupements agissent sur les usagers concernés par l'action. + header: Nombre d'actions + aggregator: person: by_household_composition: @@ -1272,6 +1280,14 @@ export: updatedBy: Modifié par timeSpent: Temps de rédaction (minutes) + acpw_associate_work: + List of accompanying period works: Liste des actions, filtres sur les usagers de l'action + List description: Compte le nombre d'actions d'accompagnement avec des filtres possibles sur les usagers, les parcours et les actions. Les filtres et regroupements agissent sur les usagers concernés par l'action. + + acpw_associate_period: + List of accompanying period works: Liste des actions, filtres sur les usagers du parcours + List description: Génère une liste des actions d'accompagnement, avec des filtres possibles sur les usagers, les parcours et les actions. Les filtres des usagers agissent sur les usagers concernés par le parcours de l'action. + acpw: List of accompanying period works: Liste des actions List description: Génère une liste des actions d'accompagnement, filtrée sur différents paramètres.