Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles

This commit is contained in:
2023-10-26 14:14:51 +02:00
90 changed files with 2818 additions and 599 deletions

View File

@@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Enum\DateGroupingChoiceEnum;
use Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators\ClosingDateAggregatorTest;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* @see ClosingDateAggregatorTest
*/
final readonly class ClosingDateAggregator implements AggregatorInterface
{
private const PREFIX = 'acp_closing_date_agg';
public function buildForm(FormBuilderInterface $builder): void
{
$builder->add('frequency', ChoiceType::class, [
'choices' => array_combine(
array_map(fn (DateGroupingChoiceEnum $c) => 'export.enum.frequency.'.$c->value, DateGroupingChoiceEnum::cases()),
array_map(fn (DateGroupingChoiceEnum $c) => $c->value, DateGroupingChoiceEnum::cases()),
),
'label' => 'export.aggregator.course.by_closing_date.frequency',
'multiple' => false,
'expanded' => true,
]);
}
public function getFormDefaultData(): array
{
return [
'frequency' => 'year',
];
}
public function getLabels($key, array $values, mixed $data)
{
return function (null|string $value): string {
if ('_header' === $value) {
return 'export.aggregator.course.by_closing_date.header';
}
return (string) $value;
};
}
public function getQueryKeys($data)
{
return [self::PREFIX.'_closing_date'];
}
public function getTitle()
{
return 'export.aggregator.course.by_closing_date.title';
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$p = self::PREFIX;
$qb->addSelect(sprintf("TO_CHAR(acp.closingDate, '%s') AS {$p}_closing_date", $data['frequency']));
$qb->addGroupBy("{$p}_closing_date");
$qb->addOrderBy("{$p}_closing_date", 'DESC');
}
public function applyOn()
{
return Declarations::ACP_TYPE;
}
}

View File

@@ -38,7 +38,7 @@ final readonly class DurationAggregator implements AggregatorInterface
match ($data['precision']) {
'day' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator'),
'week' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator'),
'month' => $qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
'month' => $qb->addSelect('(EXTRACT (YEAR FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator'),
default => throw new \LogicException('precision not supported: '.$data['precision']),
};

View File

@@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Enum\DateGroupingChoiceEnum;
use Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators\OpeningDateAggregatorTest;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* @see OpeningDateAggregatorTest
*/
final readonly class OpeningDateAggregator implements AggregatorInterface
{
private const PREFIX = 'acp_opening_date_agg';
public function buildForm(FormBuilderInterface $builder): void
{
$builder->add('frequency', ChoiceType::class, [
'choices' => array_combine(
array_map(fn (DateGroupingChoiceEnum $c) => 'export.enum.frequency.'.$c->value, DateGroupingChoiceEnum::cases()),
array_map(fn (DateGroupingChoiceEnum $c) => $c->value, DateGroupingChoiceEnum::cases()),
),
'label' => 'export.aggregator.course.by_opening_date.frequency',
'multiple' => false,
'expanded' => true,
]);
}
public function getFormDefaultData(): array
{
return [
'frequency' => 'year',
];
}
public function getLabels($key, array $values, mixed $data)
{
return function (null|string $value): string {
if ('_header' === $value) {
return 'export.aggregator.course.by_opening_date.header';
}
return (string) $value;
};
}
public function getQueryKeys($data)
{
return [self::PREFIX.'_opening_date'];
}
public function getTitle()
{
return 'export.aggregator.course.by_opening_date.title';
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$p = self::PREFIX;
$qb->addSelect(sprintf("TO_CHAR(acp.openingDate, '%s') AS {$p}_opening_date", $data['frequency']));
$qb->addGroupBy("{$p}_opening_date");
$qb->addOrderBy("{$p}_opening_date", 'DESC');
}
public function applyOn()
{
return Declarations::ACP_TYPE;
}
}

View File

@@ -49,7 +49,7 @@ final readonly class StepAggregator implements AggregatorInterface
$qb->expr()->lte(self::A.'.startDate', ':'.self::P),
$qb->expr()->orX(
$qb->expr()->isNull(self::A.'.endDate'),
$qb->expr()->lt(self::A.'.endDate', ':'.self::P)
$qb->expr()->gt(self::A.'.endDate', ':'.self::P)
)
)
)

View File

@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators\HandlingThirdPartyAggregatorTest;
use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
/**
* @see HandlingThirdPartyAggregatorTest
*/
final readonly class HandlingThirdPartyAggregator implements AggregatorInterface
{
private const PREFIX = 'acpw_handling3party_agg';
public function __construct(private LabelThirdPartyHelper $labelThirdPartyHelper) {}
public function buildForm(FormBuilderInterface $builder)
{
// no form needed here
}
public function getFormDefaultData(): array
{
return [];
}
public function getLabels($key, array $values, mixed $data)
{
return $this->labelThirdPartyHelper->getLabel($key, $values, 'export.aggregator.course_work.by_handling_third_party.header');
}
public function getQueryKeys($data)
{
return [self::PREFIX.'_h3party'];
}
public function getTitle()
{
return 'export.aggregator.course_work.by_handling_third_party.title';
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$p = self::PREFIX;
$qb
->addSelect("IDENTITY(acpw.handlingThierParty) AS {$p}_h3party")
->addGroupBy("{$p}_h3party");
}
public function applyOn()
{
return Declarations::SOCIAL_WORK_ACTION_TYPE;
}
}

View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Export\Enum;
enum DateGroupingChoiceEnum: string
{
case MONTH = 'YYYY-MM';
case WEEK = 'YYYY-IW';
case YEAR = 'YYYY';
}

View File

@@ -23,16 +23,20 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
{
protected EntityRepository $repository;
private readonly bool $filterStatsByCenters;
public function __construct(
EntityManagerInterface $em,
ParameterBagInterface $parameterBag,
) {
$this->repository = $em->getRepository(AccompanyingPeriod::class);
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder): void
@@ -102,15 +106,19 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
->andWhere('acp.step != :count_acp_step')
->leftJoin('acp.participations', 'acppart')
->leftJoin('acppart.person', 'person')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT);
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('count_acp_step', AccompanyingPeriod::STEP_DRAFT)
->setParameter('authorized_centers', $centers);
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);

View File

@@ -22,11 +22,19 @@ use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInterface
{
public function __construct(protected EntityManagerInterface $em) {}
private readonly bool $filterStatsByCenters;
public function __construct(
protected EntityManagerInterface $em,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder): void
{
@@ -95,15 +103,19 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw')
->join('acpw.accompanyingPeriod', 'acp')
->join('acp.participations', 'acppart')
->join('acppart.person', 'person')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
->join('acppart.person', '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);
->setParameter('authorized_centers', $centers);
}
$qb->select('COUNT(DISTINCT acpw.id) as export_result');

View File

@@ -21,11 +21,19 @@ use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class CountEvaluation implements ExportInterface, GroupedExportInterface
{
public function __construct(private readonly EntityManagerInterface $entityManager) {}
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly EntityManagerInterface $entityManager,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder) {}
@@ -92,15 +100,19 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
->join('workeval.accompanyingPeriodWork', 'acpw')
->join('acpw.accompanyingPeriod', 'acp')
->join('acp.participations', 'acppart')
->join('acppart.person', 'person')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
->join('acppart.person', '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);
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);

View File

@@ -23,13 +23,21 @@ use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class CountHousehold implements ExportInterface, GroupedExportInterface
{
private const TR_PREFIX = 'export.export.nb_household_with_course.';
private readonly bool $filterStatsByCenters;
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly RollingDateConverterInterface $rollingDateConverter) {}
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly RollingDateConverterInterface $rollingDateConverter,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -112,21 +120,25 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
->join('person.accompanyingPeriodParticipations', 'acppart')
->join('acppart.accompanyingPeriod', 'acp')
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
->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)
'
)
)
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
->setParameter('authorized_centers', $centers)
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
$qb
->select('COUNT(DISTINCT household.id) AS household_export_result')
->addSelect('COUNT(DISTINCT acp.id) AS acp_export_result');
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)
'
)
)
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
->setParameter('authorized_centers', $centers);
}
return $qb;
}

View File

@@ -20,11 +20,19 @@ use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class CountPerson implements ExportInterface, GroupedExportInterface
{
public function __construct(protected PersonRepository $personRepository) {}
private readonly bool $filterStatsByCenters;
public function __construct(
protected PersonRepository $personRepository,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -94,13 +102,17 @@ class CountPerson implements ExportInterface, GroupedExportInterface
$qb = $this->personRepository->createQueryBuilder('person');
$qb->select('COUNT(DISTINCT person.id) AS export_result')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
$qb->select('COUNT(DISTINCT person.id) AS export_result');
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)
)
->setParameter('authorized_centers', $centers);
->setParameter('authorized_centers', $centers);
}
return $qb;
}

View File

@@ -22,16 +22,20 @@ use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExportInterface
{
private readonly EntityRepository $repository;
private readonly bool $filterStatsByCenters;
public function __construct(
EntityManagerInterface $em,
ParameterBagInterface $parameterBag,
) {
$this->repository = $em->getRepository(AccompanyingPeriod::class);
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
@@ -105,11 +109,13 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
$qb->join('acppart.person', 'person');
}
$qb->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)->setParameter('authorized_centers', $centers);
if ($this->filterStatsByCenters) {
$qb->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);

View File

@@ -26,15 +26,21 @@ use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
{
private bool $filterStatsByCenters;
public function __construct(
private EntityManagerInterface $entityManager,
private RollingDateConverterInterface $rollingDateConverter,
private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper,
) {}
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -102,16 +108,20 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp
$qb
->from(AccompanyingPeriod::class, 'acp')
->andWhere('acp.step != :list_acp_step')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT);
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
'
)
)
)
->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT)
->setParameter('authorized_centers', $centers);
->setParameter('authorized_centers', $centers);
}
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));

View File

@@ -44,6 +44,7 @@ use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterface
@@ -78,6 +79,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
'updatedBy',
];
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly DateTimeHelper $dateTimeHelper,
@@ -90,8 +93,11 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
private readonly SocialActionRender $socialActionRender,
private readonly RollingDateConverterInterface $rollingDateConverter,
private readonly AggregateStringHelper $aggregateStringHelper,
private readonly SocialActionRepository $socialActionRepository
) {}
private readonly SocialActionRepository $socialActionRepository,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -214,15 +220,19 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
// get participants at the given date
->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
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)
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);

View File

@@ -37,6 +37,7 @@ use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class ListEvaluation implements ListInterface, GroupedExportInterface
@@ -68,7 +69,24 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
'updatedBy',
];
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly SocialIssueRender $socialIssueRender, private readonly SocialIssueRepository $socialIssueRepository, private readonly SocialActionRender $socialActionRender, private readonly SocialActionRepository $socialActionRepository, private readonly UserHelper $userHelper, private readonly LabelPersonHelper $personHelper, private readonly DateTimeHelper $dateTimeHelper, private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private readonly AggregateStringHelper $aggregateStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {}
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly SocialIssueRender $socialIssueRender,
private readonly SocialIssueRepository $socialIssueRepository,
private readonly SocialActionRender $socialActionRender,
private readonly SocialActionRepository $socialActionRepository,
private readonly UserHelper $userHelper,
private readonly LabelPersonHelper $personHelper,
private readonly DateTimeHelper $dateTimeHelper,
private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
private readonly AggregateStringHelper $aggregateStringHelper,
private readonly RollingDateConverterInterface $rollingDateConverter,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -190,15 +208,19 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
// get participants at the given date
->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
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)
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);

View File

@@ -29,6 +29,7 @@ use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
@@ -42,14 +43,18 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
'compositionComment',
'compositionType',
];
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly ExportAddressHelper $addressHelper,
private readonly AggregateStringHelper $aggregateStringHelper,
private readonly EntityManagerInterface $entityManager,
private readonly RollingDateConverterInterface $rollingDateConverter,
private readonly TranslatableStringExportLabelHelper $translatableStringHelper
) {}
private readonly TranslatableStringExportLabelHelper $translatableStringHelper,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -138,16 +143,20 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
->join('person.accompanyingPeriodParticipations', 'acppart')
->join('acppart.accompanyingPeriod', 'acp')
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
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)
'
)
)
)
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
->setParameter('authorized_centers', $centers)
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
->setParameter('authorized_centers', $centers);
}
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));

View File

@@ -29,6 +29,7 @@ use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Callback;
@@ -40,14 +41,18 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
class ListPerson implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface
{
private array $slugs = [];
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly ExportAddressHelper $addressHelper,
private readonly CustomFieldProvider $customFieldProvider,
private readonly ListPersonHelper $listPersonHelper,
private readonly EntityManagerInterface $entityManager,
private readonly TranslatableStringHelper $translatableStringHelper
) {}
private readonly TranslatableStringHelper $translatableStringHelper,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -184,16 +189,18 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
throw new \Doctrine\DBAL\Exception\InvalidArgumentException('any fields have been checked');
}
$qb = $this->entityManager->createQueryBuilder();
$qb = $this->entityManager->createQueryBuilder()
->from(Person::class, 'person');
$qb
->from(Person::class, 'person')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.Person\PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.Person\PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)
)
->setParameter('authorized_centers', $centers);
->setParameter('authorized_centers', $centers);
}
$fields = $data['fields'];

View File

@@ -17,7 +17,9 @@ use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Export\Helper\ExportAddressHelper;
use Chill\MainBundle\Export\ListInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
@@ -27,6 +29,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTimeImmutable;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Callback;
@@ -37,9 +40,19 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
*
* Details of the accompanying period are not included
*/
class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface
final readonly class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface
{
public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly ListPersonHelper $listPersonHelper, private readonly EntityManagerInterface $entityManager) {}
private bool $filterStatsByCenters;
public function __construct(
private ExportAddressHelper $addressHelper,
private ListPersonHelper $listPersonHelper,
private EntityManagerInterface $entityManager,
private RollingDateConverterInterface $rollingDateConverter,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -69,10 +82,9 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
])],
]);
$builder->add('address_date', ChillDateType::class, [
$builder->add('address_date_rolling', PickRollingDateType::class, [
'label' => 'Data valid at this date',
'help' => 'Data regarding center, addresses, and so on will be computed at this date',
'input' => 'datetime_immutable',
]);
}
@@ -80,7 +92,7 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
{
$choices = array_combine(ListPersonHelper::FIELDS, ListPersonHelper::FIELDS);
return ['fields' => array_values($choices), 'address_date' => new \DateTimeImmutable()];
return ['fields' => array_values($choices), 'address_date_rolling' => new RollingDate(RollingDate::T_TODAY)];
}
public function getAllowedFormattersTypes()
@@ -162,16 +174,20 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
$qb->from(Person::class, 'person')
->join('person.accompanyingPeriodParticipations', 'acppart')
->join('acppart.accompanyingPeriod', 'acp')
->andWhere($qb->expr()->neq('acp.step', "'".AccompanyingPeriod::STEP_DRAFT."'"))
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)->setParameter('authorized_centers', $centers);
->andWhere($qb->expr()->neq('acp.step', "'".AccompanyingPeriod::STEP_DRAFT."'"));
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)->setParameter('authorized_centers', $centers);
}
$fields = $data['fields'];
$this->listPersonHelper->addSelect($qb, $fields, $data['address_date']);
$this->listPersonHelper->addSelect($qb, $fields, $this->rollingDateConverter->convert($data['address_date_rolling']));
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);

View File

@@ -28,6 +28,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTimeImmutable;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
/**
@@ -35,12 +36,17 @@ use Symfony\Component\Form\FormBuilderInterface;
*/
final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInterface, GroupedExportInterface
{
private bool $filterStatsByCenters;
public function __construct(
private ListPersonHelper $listPersonHelper,
private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper,
private EntityManagerInterface $entityManager,
private RollingDateConverterInterface $rollingDateConverter,
) {}
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -114,12 +120,16 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte
$qb->from(Person::class, 'person')
->join('person.accompanyingPeriodParticipations', 'acppart')
->join('acppart.accompanyingPeriod', 'acp')
->andWhere($qb->expr()->neq('acp.step', "'".AccompanyingPeriod::STEP_DRAFT."'"))
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)->setParameter('authorized_centers', $centers);
->andWhere($qb->expr()->neq('acp.step', "'".AccompanyingPeriod::STEP_DRAFT."'"));
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
)
)->setParameter('authorized_centers', $centers);
}
$this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date']));
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date']));

View File

@@ -15,7 +15,9 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
use Chill\PersonBundle\Export\Declarations;
@@ -24,28 +26,34 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportInterface
final readonly class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportInterface
{
private readonly EntityRepository $repository;
private bool $filterStatsByCenters;
public function __construct(
EntityManagerInterface $em,
private RollingDateConverterInterface $rollingDateConverter,
ParameterBagInterface $parameterBag,
) {
$this->repository = $em->getRepository(AccompanyingPeriod::class);
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder): void
{
$builder->add('closingdate', ChillDateType::class, [
$builder->add('closingdate_rolling', PickRollingDateType::class, [
'label' => 'Closingdate to apply',
]);
}
public function getFormDefaultData(): array
{
return ['closingdate' => new \DateTime('now')];
return ['closingdate_rolling' => new RollingDate(RollingDate::T_TODAY)];
}
public function getAllowedFormattersTypes(): array
@@ -118,20 +126,24 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
->addSelect('COUNT(DISTINCT acppart.id) AS count_acppart_export_result')
->addSelect('COUNT(DISTINCT person.id) AS count_pers_export_result')
->addSelect('COUNT(DISTINCT acp.id) AS count_acp_export_result')
->setParameter('force_closingDate', $data['closingdate'])
->setParameter('force_closingDate', $this->rollingDateConverter->convert($data['closingdate_rolling']))
->leftJoin('acp.participations', 'acppart')
->leftJoin('acppart.person', 'person')
->andWhere('acp.step != :count_acp_step')
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT);
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('count_acp_step', AccompanyingPeriod::STEP_DRAFT)
->setParameter('authorized_centers', $centers);
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);

View File

@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Export\Declarations;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final readonly class HandlingThirdPartyFilter implements FilterInterface
{
private const PREFIX = 'acpw_handling_3party_filter';
public function __construct(
private ThirdPartyRender $thirdPartyRender,
) {}
public function getTitle()
{
return 'export.filter.work.by_handling3party.title';
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('handling_3parties', PickThirdpartyDynamicType::class, [
'label' => 'export.filter.work.by_handling3party.pick_3parties',
'multiple' => true,
]);
}
public function getFormDefaultData(): array
{
return ['handling_3parties' => []];
}
public function describeAction($data, $format = 'string')
{
return [
'export.filter.work.by_handling3party.Only 3 parties %3parties%',
[
'%3parties%' => implode(
', ',
array_map(fn (ThirdParty $thirdParty) => $this->thirdPartyRender->renderString($thirdParty, []), $data['handling_3parties'])
),
],
];
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$p = self::PREFIX;
$qb->andWhere("acpw.handlingThierParty IN (:{$p}_3ps)");
$qb->setParameter("{$p}_3ps", $data['handling_3parties']);
}
public function applyOn()
{
return Declarations::SOCIAL_WORK_ACTION_TYPE;
}
}

View File

@@ -61,7 +61,7 @@ class StepFilterOnDate implements FilterInterface
$qb->expr()->lte(self::A.'.startDate', ':'.self::P),
$qb->expr()->orX(
$qb->expr()->isNull(self::A.'.endDate'),
$qb->expr()->lt(self::A.'.endDate', ':'.self::P)
$qb->expr()->gt(self::A.'.endDate', ':'.self::P)
)
)
)

View File

@@ -28,7 +28,7 @@ use Symfony\Component\Form\FormBuilderInterface;
*
* Makes use of AccompanyingPeriodInfo
*/
readonly class UserWorkingOnCourseFilter implements FilterInterface
final readonly class UserWorkingOnCourseFilter implements FilterInterface
{
public function __construct(
private UserRender $userRender,

View File

@@ -66,7 +66,7 @@ class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface
{
$builder
->add('date_calc', PickRollingDateType::class, [
'label' => 'Compute address at date',
'label' => 'export.filter.person.by_address_ref_status.Address at date',
'required' => true,
])
->add('ref_statuses', ChoiceType::class, [

View File

@@ -18,6 +18,21 @@ class LabelPersonHelper
{
public function __construct(private readonly PersonRepository $personRepository, private readonly PersonRenderInterface $personRender) {}
public function getLabel(string $key, array $values, string $header): callable
{
return function (null|int|string $value) use ($header): string {
if ('_header' === $value) {
return $header;
}
if ('' === $value || null === $value || null === $person = $this->personRepository->find($value)) {
return '';
}
return $this->personRender->renderString($person, []);
};
}
public function getLabelMulti(string $key, array $values, string $header): callable
{
return function ($value) use ($header) {

View File

@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ClosingDateAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ClosingDateAggregatorTest extends AbstractAggregatorTest
{
private static ClosingDateAggregator $closingDateAggregator;
private static EntityManagerInterface $entityManager;
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::bootKernel();
self::$closingDateAggregator = self::$container->get(ClosingDateAggregator::class);
self::$entityManager = self::$container->get(EntityManagerInterface::class);
}
public function getAggregator()
{
return self::$closingDateAggregator;
}
public function getFormData()
{
yield ['frequency' => 'YYYY'];
yield ['frequency' => 'YYYY-MM'];
yield ['frequency' => 'YYYY-IV'];
}
public function getQueryBuilders()
{
self::bootKernel();
self::$entityManager = self::$container->get(EntityManagerInterface::class);
$data = [
self::$entityManager->createQueryBuilder()
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp'),
];
self::ensureKernelShutdown();
return $data;
}
}

View File

@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\OpeningDateAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class OpeningDateAggregatorTest extends AbstractAggregatorTest
{
private static OpeningDateAggregator $openingDateAggregator;
private static EntityManagerInterface $entityManager;
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::bootKernel();
self::$openingDateAggregator = self::$container->get(OpeningDateAggregator::class);
self::$entityManager = self::$container->get(EntityManagerInterface::class);
}
public function getAggregator()
{
return self::$openingDateAggregator;
}
public function getFormData()
{
yield ['frequency' => 'YYYY'];
yield ['frequency' => 'YYYY-MM'];
yield ['frequency' => 'YYYY-IV'];
}
public function getQueryBuilders()
{
self::bootKernel();
self::$entityManager = self::$container->get(EntityManagerInterface::class);
$data = [
self::$entityManager->createQueryBuilder()
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp'),
];
self::ensureKernelShutdown();
return $data;
}
}

View File

@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\HandlingThirdPartyAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class HandlingThirdPartyAggregatorTest extends AbstractAggregatorTest
{
private static HandlingThirdPartyAggregator $handlingThirdPartyAggregator;
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::bootKernel();
self::$handlingThirdPartyAggregator = self::$container->get(HandlingThirdPartyAggregator::class);
}
public function getAggregator()
{
return self::$handlingThirdPartyAggregator;
}
public function getFormData()
{
return [
[],
];
}
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container
->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('count(acpw.id)')
->from(AccompanyingPeriodWork::class, 'acpw'),
];
}
}

View File

@@ -14,6 +14,7 @@ namespace Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\CountAccompanyingCourse;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -22,18 +23,17 @@ use Chill\PersonBundle\Export\Export\CountAccompanyingCourse;
*/
final class CountAccompanyingCourseTest extends AbstractExportTest
{
private CountAccompanyingCourse $export;
protected function setUp(): void
{
self::bootKernel();
$this->export = self::$container->get('chill.person.export.count_accompanyingcourse');
}
public function getExport()
{
return $this->export;
$em = self::$container->get(EntityManagerInterface::class);
yield new CountAccompanyingCourse($em, $this->getParameters(true));
yield new CountAccompanyingCourse($em, $this->getParameters(false));
}
public function getFormData(): array

View File

@@ -14,6 +14,7 @@ namespace Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -33,7 +34,10 @@ final class CountAccompanyingPeriodWorkTest extends AbstractExportTest
public function getExport()
{
return $this->export;
$em = self::$container->get(EntityManagerInterface::class);
yield new CountAccompanyingPeriodWork($em, $this->getParameters(true));
yield new CountAccompanyingPeriodWork($em, $this->getParameters(false));
}
public function getFormData(): array

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Export\CountPerson;
use Chill\PersonBundle\Repository\PersonRepository;
/**
* Test CountPerson export.
@@ -23,18 +24,17 @@ use Chill\PersonBundle\Export\Export\CountPerson;
*/
final class CountPersonTest extends AbstractExportTest
{
private ?object $export = null;
protected function setUp(): void
{
self::bootKernel();
$this->export = self::$container->get(CountPerson::class);
}
public function getExport()
{
return $this->export;
$personRepository = self::$container->get(PersonRepository::class);
yield new CountPerson($personRepository, $this->getParameters(true));
yield new CountPerson($personRepository, $this->getParameters(false));
}
public function getFormData()

View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\CountPersonWithAccompanyingCourse;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class CountPersonWithAccompanyingCourseTest extends AbstractExportTest
{
protected function setUp(): void
{
self::bootKernel();
}
public function getExport()
{
$em = self::$container->get(EntityManagerInterface::class);
yield new CountPersonWithAccompanyingCourse($em, $this->getParameters(true));
yield new CountPersonWithAccompanyingCourse($em, $this->getParameters(false));
}
public function getFormData()
{
return [[]];
}
public function getModifiersCombination()
{
return [[Declarations::ACP_TYPE]];
}
}

View File

@@ -11,43 +11,51 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Repository\CenterRepositoryInterface;
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\ListAccompanyingPeriod;
use Doctrine\ORM\AbstractQuery;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ListAccompanyingPeriodTest extends KernelTestCase
class ListAccompanyingPeriodTest extends AbstractExportTest
{
private ListAccompanyingPeriod $listAccompanyingPeriod;
private readonly ListAccompanyingPeriod $listAccompanyingPeriod;
private CenterRepositoryInterface $centerRepository;
private readonly CenterRepositoryInterface $centerRepository;
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
$this->listAccompanyingPeriod = self::$container->get(ListAccompanyingPeriod::class);
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
}
public function testQuery(): void
public function getExport()
{
$centers = $this->centerRepository->findAll();
$em = self::$container->get(EntityManagerInterface::class);
$rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
$listAccompanyingPeriodHelper = self::$container->get(ListAccompanyingPeriodHelper::class);
$query = $this->listAccompanyingPeriod->initiateQuery([], array_map(fn (Center $c) => ['center' => $c], $centers), $exportOpts = ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
yield new ListAccompanyingPeriod($em, $rollingDateConverter, $listAccompanyingPeriodHelper, $this->getParameters(true));
yield new ListAccompanyingPeriod($em, $rollingDateConverter, $listAccompanyingPeriodHelper, $this->getParameters(false));
}
$query->setMaxResults(1);
public function getFormData()
{
return [
['calc_date' => new RollingDate(RollingDate::T_TODAY)],
];
}
$actual = $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
self::assertIsArray($actual);
public function getModifiersCombination()
{
return [[Declarations::ACP_TYPE]];
}
}

View File

@@ -11,40 +11,93 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Repository\CenterRepositoryInterface;
use Chill\MainBundle\Export\Helper\AggregateStringHelper;
use Chill\MainBundle\Export\Helper\DateTimeHelper;
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
use Chill\MainBundle\Export\Helper\UserHelper;
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 Doctrine\ORM\AbstractQuery;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ListAccompanyingPeriodWorkTest extends KernelTestCase
class ListAccompanyingPeriodWorkTest extends AbstractExportTest
{
private ListAccompanyingPeriodWork $listAccompanyingPeriodWork;
private CenterRepositoryInterface $centerRepository;
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
$this->listAccompanyingPeriodWork = self::$container->get(ListAccompanyingPeriodWork::class);
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
}
public function testQuery(): void
public function getExport()
{
$centers = $this->centerRepository->findAll();
$entityManager = self::$container->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);
$query = $this->listAccompanyingPeriodWork->initiateQuery([], array_map(fn (Center $c) => ['center' => $c], $centers), ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
$query->setMaxResults(1);
yield new ListAccompanyingPeriodWork(
$entityManager,
$dateTimeHelper,
$userHelper,
$personHelper,
$thirdPartyHelper,
$translatableStringExportLabelHelper,
$socialIssueRender,
$socialIssueRepository,
$socialActionRender,
$rollingDateConverter,
$aggregateStringHelper,
$socialActionRepository,
$this->getParameters(true),
);
self::assertIsArray($query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY));
yield new ListAccompanyingPeriodWork(
$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]];
}
}

View File

@@ -12,18 +12,30 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Export\Helper\AggregateStringHelper;
use Chill\MainBundle\Export\Helper\DateTimeHelper;
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
use Chill\MainBundle\Export\Helper\UserHelper;
use Chill\MainBundle\Repository\CenterRepositoryInterface;
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\ListEvaluation;
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
use Doctrine\ORM\AbstractQuery;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ListEvaluationTest extends KernelTestCase
class ListEvaluationTest extends AbstractExportTest
{
private ListEvaluation $listEvaluation;
@@ -38,6 +50,61 @@ class ListEvaluationTest extends KernelTestCase
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
}
public function getExport()
{
$entityManager = self::$container->get(EntityManagerInterface::class);
$dateTimeHelper = self::$container->get(DateTimeHelper::class);
$userHelper = self::$container->get(UserHelper::class);
$personHelper = self::$container->get(LabelPersonHelper::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 ListEvaluation(
$entityManager,
$socialIssueRender,
$socialIssueRepository,
$socialActionRender,
$socialActionRepository,
$userHelper,
$personHelper,
$dateTimeHelper,
$translatableStringExportLabelHelper,
$aggregateStringHelper,
$rollingDateConverter,
$this->getParameters(true),
);
yield new ListEvaluation(
$entityManager,
$socialIssueRender,
$socialIssueRepository,
$socialActionRender,
$socialActionRepository,
$userHelper,
$personHelper,
$dateTimeHelper,
$translatableStringExportLabelHelper,
$aggregateStringHelper,
$rollingDateConverter,
$this->getParameters(false),
);
}
public function getFormData()
{
return [['calc_date' => new RollingDate(RollingDate::T_TODAY)]];
}
public function getModifiersCombination()
{
return [[Declarations::ACP_TYPE]];
}
public function testQuery(): void
{
$centers = $this->centerRepository->findAll();

View File

@@ -0,0 +1,72 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Export\Helper\AggregateStringHelper;
use Chill\MainBundle\Export\Helper\ExportAddressHelper;
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
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\ListHouseholdInPeriod;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ListHouseholdInPeriodTest extends AbstractExportTest
{
protected function setUp(): void
{
self::bootKernel();
}
public function getExport()
{
$addressHelper = self::$container->get(ExportAddressHelper::class);
$aggregateStringHelper = self::$container->get(AggregateStringHelper::class);
$entityManager = self::$container->get(EntityManagerInterface::class);
$rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
$translatableStringHelper = self::$container->get(TranslatableStringExportLabelHelper::class);
yield new ListHouseholdInPeriod(
$addressHelper,
$aggregateStringHelper,
$entityManager,
$rollingDateConverter,
$translatableStringHelper,
$this->getParameters(true),
);
yield new ListHouseholdInPeriod(
$addressHelper,
$aggregateStringHelper,
$entityManager,
$rollingDateConverter,
$translatableStringHelper,
$this->getParameters(false),
);
}
public function getFormData()
{
return [['calc_date' => new RollingDate(RollingDate::T_TODAY)]];
}
public function getModifiersCombination()
{
return [[Declarations::PERSON_TYPE]];
}
}

View File

@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Export\Helper\ExportAddressHelper;
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\ListPersonHavingAccompanyingPeriod;
use Chill\PersonBundle\Export\Helper\ListPersonHelper;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ListPersonHavingAccompanyingPeriodTest extends AbstractExportTest
{
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
}
public function getExport()
{
$addressHelper = self::$container->get(ExportAddressHelper::class);
$listPersonHelper = self::$container->get(ListPersonHelper::class);
$entityManager = self::$container->get(EntityManagerInterface::class);
$rollingDateconverter = self::$container->get(RollingDateConverterInterface::class);
yield new ListPersonHavingAccompanyingPeriod(
$addressHelper,
$listPersonHelper,
$entityManager,
$rollingDateconverter,
$this->getParameters(true),
);
yield new ListPersonHavingAccompanyingPeriod(
$addressHelper,
$listPersonHelper,
$entityManager,
$rollingDateconverter,
$this->getParameters(false),
);
}
public function getFormData()
{
return [['address_date_rolling' => new RollingDate(RollingDate::T_TODAY), 'fields' => ListPersonHelper::FIELDS]];
}
public function getModifiersCombination()
{
return [[Declarations::PERSON_TYPE, Declarations::ACP_TYPE]];
}
}

View File

@@ -11,8 +11,13 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
use Chill\MainBundle\Export\Helper\ExportAddressHelper;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Export\ListPerson;
use Chill\PersonBundle\Export\Helper\ListPersonHelper;
use Doctrine\ORM\EntityManagerInterface;
use Prophecy\PhpUnit\ProphecyTrait;
/**
@@ -45,7 +50,29 @@ final class ListPersonTest extends AbstractExportTest
public function getExport()
{
return $this->export;
$addressHelper = self::$container->get(ExportAddressHelper::class);
$customFieldProvider = self::$container->get(CustomFieldProvider::class);
$listPersonHelper = self::$container->get(ListPersonHelper::class);
$entityManager = self::$container->get(EntityManagerInterface::class);
$translatableStringHelper = self::$container->get(TranslatableStringHelper::class);
yield new ListPerson(
$addressHelper,
$customFieldProvider,
$listPersonHelper,
$entityManager,
$translatableStringHelper,
$this->getParameters(true),
);
yield new ListPerson(
$addressHelper,
$customFieldProvider,
$listPersonHelper,
$entityManager,
$translatableStringHelper,
$this->getParameters(false),
);
}
public function getFormData(): iterable

View File

@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Export;
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\ListPersonWithAccompanyingPeriodDetails;
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
use Chill\PersonBundle\Export\Helper\ListPersonHelper;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ListPersonWithAccompanyingPeriodDetailsTest extends AbstractExportTest
{
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
}
public function getExport()
{
$listPersonHelper = self::$container->get(ListPersonHelper::class);
$listAccompanyingPeriodHelper = self::$container->get(ListAccompanyingPeriodHelper::class);
$entityManager = self::$container->get(EntityManagerInterface::class);
$rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
yield new ListPersonWithAccompanyingPeriodDetails(
$listPersonHelper,
$listAccompanyingPeriodHelper,
$entityManager,
$rollingDateConverter,
$this->getParameters(true),
);
yield new ListPersonWithAccompanyingPeriodDetails(
$listPersonHelper,
$listAccompanyingPeriodHelper,
$entityManager,
$rollingDateConverter,
$this->getParameters(false),
);
}
public function getFormData()
{
return [
['address_date' => new RollingDate(RollingDate::T_TODAY)],
];
}
public function getModifiersCombination()
{
return [
[Declarations::PERSON_TYPE, Declarations::ACP_TYPE],
];
}
}

View File

@@ -11,9 +11,12 @@ declare(strict_types=1);
namespace Export\Export;
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\StatAccompanyingCourseDuration;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -33,13 +36,17 @@ final class StatAccompanyingCourseDurationTest extends AbstractExportTest
public function getExport()
{
return $this->export;
$em = self::$container->get(EntityManagerInterface::class);
$rollingDateconverter = self::$container->get(RollingDateConverterInterface::class);
yield new StatAccompanyingCourseDuration($em, $rollingDateconverter, $this->getParameters(true));
yield new StatAccompanyingCourseDuration($em, $rollingDateconverter, $this->getParameters(false));
}
public function getFormData(): array
{
return [
['closingdate' => \DateTime::createFromFormat('Y-m-d', '2022-06-30')],
['closingdate_rolling' => new RollingDate(RollingDate::T_TODAY)],
];
}

View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Filter\SocialWorkFilters;
use Chill\MainBundle\Test\Export\AbstractFilterTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\HandlingThirdPartyFilter;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class HandlingThirdPartyFilterTest extends AbstractFilterTest
{
private ThirdPartyRender $thirdPartyRender;
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
$this->thirdPartyRender = self::$container->get(ThirdPartyRender::class);
}
public function getFilter()
{
return new HandlingThirdPartyFilter($this->thirdPartyRender);
}
public function getFormData()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$thirdParties = $em->createQuery('SELECT tp FROM '.ThirdParty::class.' tp')
->setMaxResults(2)
->getResult();
return [
[
'handling_3parties' => $thirdParties,
],
];
}
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('acpw.id')
->from(AccompanyingPeriodWork::class, 'acpw'),
];
}
}

View File

@@ -251,3 +251,11 @@ services:
Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ScopeWorkingOnCourseAggregator:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_scope_working_on_course_aggregator }
Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\OpeningDateAggregator:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_opening_date_aggregator }
Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ClosingDateAggregator:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_closing_date_aggregator }

View File

@@ -1,116 +1,93 @@
services:
_defaults:
autowire: true
autoconfigure: true
## Indicators
Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork:
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: count_social_work_actions }
## Indicators
Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork:
tags:
- { name: chill.export, alias: count_social_work_actions }
Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWork:
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: list_social_work_actions }
Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWork:
tags:
- { name: chill.export, alias: list_social_work_actions }
## FILTERS
chill.person.export.filter_social_work_type:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\SocialWorkTypeFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: social_work_type_filter }
## FILTERS
chill.person.export.filter_social_work_type:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\SocialWorkTypeFilter
tags:
- { name: chill.export_filter, alias: social_work_type_filter }
chill.person.export.filter_scope:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\ScopeFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: social_work_actions_scope_filter }
chill.person.export.filter_scope:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\ScopeFilter
tags:
- { name: chill.export_filter, alias: social_work_actions_scope_filter }
chill.person.export.filter_job:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\JobFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: social_work_actions_job_filter }
chill.person.export.filter_job:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\JobFilter
tags:
- { name: chill.export_filter, alias: social_work_actions_job_filter }
chill.person.export.filter_treatingagent:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\ReferrerFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: social_work_actions_treatingagent_filter }
chill.person.export.filter_treatingagent:
class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\ReferrerFilter
tags:
- { name: chill.export_filter, alias: social_work_actions_treatingagent_filter }
Chill\PersonBundle\Export\Filter\SocialWorkFilters\CurrentActionFilter:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: social_work_actions_current_filter }
Chill\PersonBundle\Export\Filter\SocialWorkFilters\CurrentActionFilter:
tags:
- { name: chill.export_filter, alias: social_work_actions_current_filter }
Chill\PersonBundle\Export\Filter\SocialWorkFilters\AccompanyingPeriodWorkStartDateBetweenDateFilter:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: social_work_actions_start_btw_dates_filter }
Chill\PersonBundle\Export\Filter\SocialWorkFilters\AccompanyingPeriodWorkStartDateBetweenDateFilter:
tags:
- { name: chill.export_filter, alias: social_work_actions_start_btw_dates_filter }
Chill\PersonBundle\Export\Filter\SocialWorkFilters\AccompanyingPeriodWorkEndDateBetweenDateFilter:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: social_work_actions_end_btw_dates_filter }
Chill\PersonBundle\Export\Filter\SocialWorkFilters\AccompanyingPeriodWorkEndDateBetweenDateFilter:
tags:
- { name: chill.export_filter, alias: social_work_actions_end_btw_dates_filter }
## AGGREGATORS
chill.person.export.aggregator_action_type:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_action_type_aggregator }
## AGGREGATORS
chill.person.export.aggregator_action_type:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator
tags:
- { name: chill.export_aggregator, alias: social_work_actions_action_type_aggregator }
chill.person.export.aggregator_treatingagent_scope:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ScopeAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_treatingagent_scope_aggregator }
chill.person.export.aggregator_treatingagent_scope:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ScopeAggregator
tags:
- { name: chill.export_aggregator, alias: social_work_actions_treatingagent_scope_aggregator }
chill.person.export.aggregator_treatingagent_job:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\JobAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_treatingagent_job_aggregator }
chill.person.export.aggregator_treatingagent_job:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\JobAggregator
tags:
- { name: chill.export_aggregator, alias: social_work_actions_treatingagent_job_aggregator }
Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_treatingagent_aggregator }
Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator:
tags:
- { name: chill.export_aggregator, alias: social_work_actions_treatingagent_aggregator }
chill.person.export.aggregator_goal:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_goal_aggregator }
chill.person.export.aggregator_goal:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator
tags:
- { name: chill.export_aggregator, alias: social_work_actions_goal_aggregator }
chill.person.export.aggregator_result:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ResultAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_result_aggregator }
chill.person.export.aggregator_result:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ResultAggregator
tags:
- { name: chill.export_aggregator, alias: social_work_actions_result_aggregator }
chill.person.export.aggregator_goalresult:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalResultAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_goal_result_aggregator }
chill.person.export.aggregator_goalresult:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalResultAggregator
tags:
- { name: chill.export_aggregator, alias: social_work_actions_goal_result_aggregator }
Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\CurrentActionAggregator:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_current_aggregator }
Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\CurrentActionAggregator:
tags:
- { name: chill.export_aggregator, alias: social_work_actions_current_aggregator }
Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\HandlingThirdPartyAggregator:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_handling3party_aggregator }
Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\HandlingThirdPartyFilter:
tags:
- { name: chill.export_filter, alias: 'acpw_handling3party_filter'}

View File

@@ -480,7 +480,7 @@ acp_geog_agg_unitrefid: Clé de la zone géographique
Geographical layer: Couche géographique
Select a geographical layer: Choisir une couche géographique
Group people by geographical unit based on his address: Grouper les usagers par zone géographique (sur base de l'adresse)
Filter by person's geographical unit (based on address): Filter les usagers par zone géographique (sur base de l'adresse)
Filter by person's geographical unit (based on address): Filtrer les usagers par zone géographique (sur base de l'adresse)
Filter by socialaction: Filtrer les parcours par action d'accompagnement
Accepted socialactions: Actions d'accompagnement
@@ -505,10 +505,10 @@ Accepted origins: Origines
"Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%"
Group by origin: Grouper les parcours par origine du parcours
Filter by closing motive: Filtrer les parcours par motif de fermeture
Filter by closing motive: Filtrer les parcours par motif de clôture
Accepted closingmotives: Motifs de clôture
"Filtered by closingmotive: only %closingmotives%": "Filtré par motif de clôture: uniquement %closingmotives%"
Group by closing motive: Grouper les parcours par motif de fermeture
Group by closing motive: Grouper les parcours par motif de clôture
Filter by administrative location: Filtrer les parcours par localisation administrative
Accepted locations: Localisations administratives
@@ -516,7 +516,7 @@ Administrative location: Localisation administrative
"Filtered by administratives locations: only %locations%": "Filtré par localisation administrative: uniquement %locations%"
Group by administrative location: Grouper les parcours par localisation administrative
Filter by requestor: Filtrer les parcours selon la présence du demandeur au sein des usagers concernés
Filter by requestor: Filtrer les parcours selon la nature du demandeur
Accepted choices: ''
is person concerned: Le demandeur est un usager concerné
is other person: Le demandeur est un usager, mais n'est pas concerné
@@ -981,6 +981,11 @@ notification:
personId: Identifiant de l'usager
export:
enum:
frequency:
YYYY-IW: par semaine
YYYY-MM: par mois
YYYY: par année
export:
acp_stats:
avg_duration: Moyenne de la durée de participation de chaque usager concerné
@@ -1037,6 +1042,14 @@ export:
Calc date: Date de calcul du service de l'intervenant
by_scope:
Group course by scope: Grouper les parcours par service
by_opening_date:
title: Grouper les parcours par date d'ouverture
frequency: Intervalle de regroupement
header: Date d'ouverture des parcours (période)
by_closing_date:
title: Grouper les parcours par date de cloture
frequency: Intervalle de regroupement
header: Date de cloture des parcours (période)
course_work:
by_treating_agent:
@@ -1053,6 +1066,9 @@ export:
by_agent_job:
Group by treating agent job: Grouper les actions par métier de l'agent traitant
Calc date: Date de calcul du métier de l'agent traitant
by_handling_third_party:
title: Grouper les actions par tiers traitant
header: Tiers traitant
eval:
by_end_date:
@@ -1084,21 +1100,22 @@ export:
Persons filtered by no composition at %date%: Uniquement les usagers sans composition de ménage à la date du %date%
Date calc: Date de calcul
by_address_ref_status:
Filter by person's address ref status: Filtrer par comparaison avec l'adresse de référence
Filter by person's address ref status: Filtrer les usagers par comparaison avec l'adresse de référence
to_review: Diffère de l'adresse de référence
reviewed: Diffère de l'adresse de référence mais conservé par l'utilisateur
match: Identique à l'adresse de référence
Filtered by person\'s address status computed at %datecalc%, only %statuses%: Filtré par comparaison à l'adresse de référence, calculé à %datecalc%, seulement %statuses%
Status: Statut
Address at date: Adresse à la date
course:
having_info_within_interval:
title: Filter les parcours ayant reçu une intervention entre deux dates
title: Filtrer les parcours ayant reçu une intervention entre deux dates
start_date: Début de la période
end_date: Fin de la période
Only course with events between %startDate% and %endDate%: Seulement les parcours ayant reçu une intervention entre le %startDate% et le %endDate%
by_user_working:
title: Filter les parcours par intervenant, entre deux dates
title: Filtrer les parcours par intervenant, entre deux dates
'Filtered by user working on course: only %users%, between %start_date% and %end_date%': 'Filtré par intervenants sur le parcours: seulement %users%, entre le %start_date% et le %end_date%'
User working after: Intervention après le
User working before: Intervention avant le
@@ -1168,6 +1185,10 @@ export:
Calc date: Date à laquelle l'agent est en situation de désignation sur l'action
calc_date_help: Il s'agit de la date à laquelle l'agent est actif comme agent traitant de l'action, et non la date à la quelle l'agent est désigné comme agent traitant.
"Filtered by treating agent: only %agents%": "Filtré par agent traitant: uniquement %agents%"
by_handling3party:
title: Filtrer les actions par tiers traitant
Only 3 parties %3parties%: "Seulement les actions d'accompagnement qui ont pour tiers traitant: %3parties%"
pick_3parties: Tiers traitants des actions
list:
person_with_acp:
@@ -1205,7 +1226,7 @@ export:
referrer: Référent
referrerSince: Référent depuis le
locationIsPerson: Parcours localisé auprès d'un usager concerné
locationIsTemp: Parcours avec une localisation temporaire
locationIsTemp: Parcours avec une localisation temporaire ou auprès d'un usager
locationPersonName: Usager auprès duquel le parcours est localisé
locationPersonId: Identifiant de l'usager auprès duquel le parcours est localisé
acpaddress_fieldscountry: Pays de l'adresse