Compare commits

..

23 Commits

Author SHA1 Message Date
444f37ad18 Apply 3 suggestion(s) to 3 file(s) 2023-10-16 15:42:55 +00:00
ada28265ee change join to leftjoin 2023-10-04 14:26:06 +02:00
9bbddd8405 add changie 2023-10-04 12:09:12 +02:00
935210aa1d use translation 2023-10-04 11:54:29 +02:00
9f476dddaf php cs fixer 2023-10-04 11:20:20 +02:00
dac48ea4e0 last processing of review remarks 2023-10-04 11:19:39 +02:00
af4bee4d50 correct test 2023-10-04 10:43:37 +02:00
b0a7612329 make test easier to read 2023-09-29 08:51:14 +02:00
0c5b35926b php cs fixer and phpstan 2023-09-29 07:52:50 +02:00
b38f5800d9 Adapt calendar exports to not take into account calendars of canceled accompanying periods 2023-09-29 07:48:54 +02:00
29983cc2ad Work on test, but still fails 2023-09-21 16:18:51 +02:00
260a173a61 Add test for accompanyingPeriodExportHelper: closing motive exclusion 2023-09-21 15:21:14 +02:00
500b37601a implement new export service for accompanyingcourse exports 2023-09-21 14:15:44 +02:00
5d41b37620 create helper service to exclude accompanying periods from export result based on closing motive 2023-09-21 13:06:19 +02:00
05e86a3360 adjust rendering of closing motive: indicate if isCanceledAccompanyingPeriod 2023-09-18 15:17:26 +02:00
9b061eeaae handle children of closing motive for isCanceledAccompanyingPeriod 2023-09-18 15:16:59 +02:00
3816d68e18 add isCanceledAccompanyingPeriod field to form 2023-09-18 15:16:26 +02:00
7db7f34f62 Adjust closing motive form 2023-09-18 14:36:56 +02:00
6b958d193d add property to closing motive to identify motives related to erroneous accompanying periods 2023-09-18 14:36:28 +02:00
f609bb0645 update changelog 2023-09-18 11:54:12 +02:00
bdee637c9f phpstan 2023-09-18 11:49:33 +02:00
722026b768 changie added bugfix singletaskplaceevent 2023-09-18 10:48:53 +02:00
8ed899a9c4 fix bug in abstract/singletaskplaceevent due to doctrine update 2023-09-18 10:47:10 +02:00
32 changed files with 358 additions and 45 deletions

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Allow closing motives to be identified as 'canceling the accompanying period'
+ don't take canceled accompanying periods into account in exports
time: 2023-10-04T12:08:57.586865276+02:00
custom:
Issue: "146"

3
.changes/v2.6.2.md Normal file
View File

@@ -0,0 +1,3 @@
## v2.6.2 - 2023-09-18
### Fixed
* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved.

View File

@@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
## v2.6.2 - 2023-09-18
### Fixed
* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved.
## v2.6.1 - 2023-09-14
### Fixed
* Filter out active centers in exports, which uses a different PickCenterType.

View File

@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Declarations;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -31,7 +32,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
protected EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(Activity::class);
}
@@ -108,6 +109,8 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Declarations;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -31,7 +32,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
protected EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(Activity::class);
}
@@ -111,6 +112,8 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Declarations;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -31,7 +32,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
protected EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(Activity::class);
}
@@ -105,6 +106,8 @@ class CountActivity implements ExportInterface, GroupedExportInterface
)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb->select('COUNT(DISTINCT activity.id) as export_count_activity');
return $qb;

View File

@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Export\ListActivityHelper;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
use Chill\MainBundle\Export\ListInterface;
@@ -33,7 +34,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
public function __construct(
ListActivityHelper $helper,
EntityManagerInterface $entityManager,
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
) {
$this->helper = $helper;
$this->entityManager = $entityManager;
@@ -147,6 +148,8 @@ class ListActivity implements ListInterface, GroupedExportInterface
->addSelect('(SELECT AGGREGATE(acpScope.name) FROM ' . Scope::class . ' acpScope WHERE acpScope MEMBER OF acp.scopes) AS scopesNames')
->addGroupBy('scopesNames');
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Declarations;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -31,7 +32,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
protected EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(Activity::class);
}
@@ -111,6 +112,8 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Declarations;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -31,7 +32,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
protected EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(Activity::class);
}
@@ -111,6 +112,8 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -27,8 +28,9 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
{
private CalendarRepository $calendarRepository;
public function __construct(CalendarRepository $calendarRepository)
{
public function __construct(
CalendarRepository $calendarRepository,
) {
$this->calendarRepository = $calendarRepository;
}
@@ -98,6 +100,9 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb->select('COUNT(cal.id) AS export_result');
$qb->leftJoin('cal.accompanyingPeriod', 'acp');
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -27,7 +28,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
private CalendarRepository $calendarRepository;
public function __construct(
CalendarRepository $calendarRepository
CalendarRepository $calendarRepository,
) {
$this->calendarRepository = $calendarRepository;
}
@@ -92,8 +93,10 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
{
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb
->select('AVG(cal.endDate - cal.startDate) AS export_result');
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
$qb->join('cal.accompanyingPeriod', 'acp');
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -27,7 +28,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
private CalendarRepository $calendarRepository;
public function __construct(
CalendarRepository $calendarRepository
CalendarRepository $calendarRepository,
) {
$this->calendarRepository = $calendarRepository;
}
@@ -92,8 +93,10 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
{
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb
->select('SUM(cal.endDate - cal.startDate) AS export_result');
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
$qb->join('cal.accompanyingPeriod', 'acp');
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -0,0 +1,31 @@
<?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\MainBundle\Export;
use Doctrine\ORM\QueryBuilder;
final readonly class AccompanyingCourseExportHelper
{
public static function addClosingMotiveExclusionClause(QueryBuilder $qb): QueryBuilder
{
$qb->leftJoin('acp.closingMotive', 'acpmotive')
->andWhere(
$qb->expr()->orX(
$qb->expr()->eq('acpmotive.isCanceledAccompanyingPeriod', 'false'),
$qb->expr()->isNull('acpmotive.closingMotive')
)
);
return $qb;
}
}

View File

@@ -0,0 +1,122 @@
<?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 Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepositoryInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
* @internal
* @coversNothing
*/
class AccompanyingCourseExportHelperTest extends KernelTestCase
{
/**
* @var list<array{0: class-string, 1: int}>
*/
private static array $entitiesToDelete = [];
private EntityManagerInterface $em;
private AccompanyingCourseExportHelper $accompanyingCourseExportHelper;
protected function setUp(): void
{
self::bootKernel();
$this->em = self::$container->get(EntityManagerInterface::class);
$this->accompanyingCourseExportHelper = self::$container->get(AccompanyingCourseExportHelper::class);
}
public static function tearDownAfterClass(): void
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
foreach (self::$entitiesToDelete as [$class, $id]) {
$entity = $em->find($class, $id);
if (null !== $entity) {
$em->remove($entity);
}
}
$em->flush();
}
public function testExclusionOnClosingMotive(): void
{
[$periodA, $periodB, $periodC] = $this->prepareData();
$qb = $this->em->getRepository(AccompanyingPeriod::class)->createQueryBuilder('acp');
$this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb->select('acp.id');
$periodIdsFound = array_map(fn ($el) => $el['id'], $qb->getQuery()->getResult());
$periodA = $this->em->find(AccompanyingPeriod::class, $periodA->getId());
$periodB = $this->em->find(AccompanyingPeriod::class, $periodB->getId());
$periodC = $this->em->find(AccompanyingPeriod::class, $periodC->getId());
self::assertContains($periodA->getId(), $periodIdsFound, 'Period without canceled closing motive has been found');
self::assertNotContains($periodB->getId(), $periodIdsFound, 'Period with canceled closing motive has not been found');
self::assertNotContains($periodC->getId(), $periodIdsFound, 'Period with child canceled closing motive has not been found');
}
private function prepareData()
{
$cmA = new ClosingMotive();
$cmA->setIsCanceledAccompanyingPeriod(false);
$cmB = new ClosingMotive();
$cmB->setIsCanceledAccompanyingPeriod(true);
$cmChild = new ClosingMotive();
$cmB->addChildren($cmChild);
$this->em->persist($cmA);
$this->em->persist($cmB);
$this->em->persist($cmChild);
$periodA = new AccompanyingPeriod();
$periodB = new AccompanyingPeriod();
$periodC = new AccompanyingPeriod();
$periodA->setClosingMotive($cmA);
$periodB->setClosingMotive($cmB);
$periodC->setClosingMotive($cmChild);
$this->em->persist($periodA);
$this->em->persist($periodB);
$this->em->persist($periodC);
self::$entitiesToDelete[] = [ClosingMotive::class, $cmChild];
self::$entitiesToDelete[] = [ClosingMotive::class, $cmA];
self::$entitiesToDelete[] = [ClosingMotive::class, $cmB];
self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodA];
self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodB];
self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodC];
$this->em->flush();
$this->em->clear();
return [$periodA, $periodB, $periodC];
}
}

View File

@@ -52,3 +52,4 @@ services:
$exportManager: '@Chill\MainBundle\Export\ExportManager'
tags:
- { name: chill.export_formatter, alias: 'csv_pivoted_list' }

View File

@@ -69,6 +69,11 @@ class ClosingMotive
*/
private ?ClosingMotive $parent = null;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
private bool $isCanceledAccompanyingPeriod = false;
/**
* ClosingMotive constructor.
*/
@@ -84,7 +89,7 @@ class ClosingMotive
}
$this->children->add($child);
$child->setParent($this);
$child->setParent($this)->setIsCanceledAccompanyingPeriod($this->getIsCanceledAccompanyingPeriod());
return $this;
}
@@ -127,6 +132,11 @@ class ClosingMotive
return $this->parent;
}
public function getIsCanceledAccompanyingPeriod(): bool
{
return $this->isCanceledAccompanyingPeriod;
}
public function hasParent(): bool
{
return null !== $this->parent;
@@ -152,6 +162,11 @@ class ClosingMotive
return $this->children->count() > 0;
}
public function isCanceledAccompanyingPeriod(): bool
{
return $this->isCanceledAccompanyingPeriod;
}
public function removeChildren(ClosingMotive $child): ClosingMotive
{
if ($this->children->removeElement($child)) {
@@ -218,4 +233,15 @@ class ClosingMotive
return $this;
}
public function setIsCanceledAccompanyingPeriod(bool $isCanceledAP): ClosingMotive
{
$this->isCanceledAccompanyingPeriod = $isCanceledAP;
foreach ($this->getChildren() as $child) {
$child->setIsCanceledAccompanyingPeriod($isCanceledAP);
}
return $this;
}
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -30,7 +31,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
protected EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(AccompanyingPeriod::class);
}
@@ -111,6 +112,8 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb->select('COUNT(DISTINCT acp.id) AS export_result');
return $qb;

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -29,7 +30,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
protected EntityManagerInterface $em;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->em = $em;
}
@@ -112,6 +113,8 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
$qb->select('COUNT(DISTINCT acpw.id) as export_result');
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -28,7 +29,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
private EntityManagerInterface $entityManager;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->entityManager = $em;
}
@@ -110,6 +111,8 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb->select('COUNT(DISTINCT workeval.id) AS export_result');
return $qb;

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -30,7 +31,7 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
private EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(AccompanyingPeriod::class);
}
@@ -111,6 +112,8 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
)
)->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb->select('COUNT(DISTINCT person.id) AS export_result');
return $qb;

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Export\Helper\DateTimeHelper;
@@ -132,6 +133,8 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb
->addOrderBy('acp.openingDate')
->addOrderBy('acp.closingDate')

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Export\Helper\AggregateStringHelper;
@@ -112,7 +113,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
SocialActionRender $socialActionRender,
RollingDateConverterInterface $rollingDateConverter,
AggregateStringHelper $aggregateStringHelper,
SocialActionRepository $socialActionRepository
SocialActionRepository $socialActionRepository,
) {
$this->entityManager = $entityManager;
$this->dateTimeHelper = $dateTimeHelper;
@@ -291,6 +292,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
->setParameter('authorized_centers', $centers)
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
return $qb;

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Export\Helper\AggregateStringHelper;
@@ -101,7 +102,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
DateTimeHelper $dateTimeHelper,
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
AggregateStringHelper $aggregateStringHelper,
RollingDateConverterInterface $rollingDateConverter
RollingDateConverterInterface $rollingDateConverter,
) {
$this->entityManager = $entityManager;
$this->socialIssueRender = $socialIssueRender;
@@ -270,6 +271,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
->setParameter('authorized_centers', $centers)
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
return $qb;

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -51,7 +52,7 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
public function __construct(
ExportAddressHelper $addressHelper,
ListPersonHelper $listPersonHelper,
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->addressHelper = $addressHelper;
$this->listPersonHelper = $listPersonHelper;
@@ -190,6 +191,8 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
$this->listPersonHelper->addSelect($qb, $fields, $data['address_date']);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb
->addOrderBy('person.lastName')
->addOrderBy('person.firstName')

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -133,6 +134,8 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte
$this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date']));
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date']));
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb
->addOrderBy('person.lastName')
->addOrderBy('person.firstName')

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
@@ -32,7 +33,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
private EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->repository = $em->getRepository(AccompanyingPeriod::class);
}
@@ -142,6 +143,8 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT)
->setParameter('authorized_centers', $centers);
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;
}

View File

@@ -19,12 +19,20 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Class ClosingMotiveType.
*/
class ClosingMotiveType extends AbstractType
{
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
@@ -46,6 +54,11 @@ class ClosingMotiveType extends AbstractType
'placeholder' => 'closing_motive.any parent',
'multiple' => false,
'only_leaf' => false,
])
->add('isCanceledAccompanyingPeriod', CheckboxType::class, [
'label' => $this->translator->trans('Consider canceled'),
'required' => false,
'help' => $this->translator->trans('Canceled parcours help')
]);
}

View File

@@ -16,6 +16,7 @@ use Chill\MainBundle\Templating\Entity\BoxUtilsChillEntityRenderTrait;
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Render closing motive.
@@ -32,7 +33,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
*/
private $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper)
public function __construct(TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
{
$this->translatableStringHelper = $translatableStringHelper;
}
@@ -62,6 +63,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
private function renderStringRecursive(ClosingMotive $motive, string $existing, array $options)
{
$newExisting = $this->translatableStringHelper->localize($motive->getName());
$isCancled = $motive->getIsCanceledAccompanyingPeriod() ? $this->translator->trans('( Canceled period )') : '';
if ($motive->hasParent()) {
if ('' !== $existing) {
@@ -70,7 +72,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
return $this->renderStringRecursive(
$motive->getParent(),
$newExisting,
$newExisting . ' ' . $isCancled,
$options
);
}
@@ -79,6 +81,6 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
return $newExisting . self::SEPARATOR . $existing;
}
return $newExisting;
return $newExisting . ' ' . $isCancled;
}
}

View File

@@ -0,0 +1,36 @@
<?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\Migrations\Person;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add isCanceledAccompanyingPeriod property to ClosingMotive
*/
final class Version20230918115305 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add isCanceledAccompanyingPeriod property to ClosingMotive';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive ADD isCanceledAccompanyingPeriod BOOLEAN DEFAULT FALSE NOT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive DROP isCanceledAccompanyingPeriod');
}
}

View File

@@ -349,6 +349,9 @@ CHILL_PERSON_HOUSEHOLD_STATS: Statistiques sur les ménages
#period
Period closed!: Parcours clôturé!
Pediod closing form is not valide: Le formulaire de fermeture n'est pas valide
Consider canceled: Permet de considérer les parcours comme annulés
Canceled parcours help: Si coché, les parcours avec ce motif de cloture seront considérés comme annulés et ne seront pas pris en compte pour les statistiques. La modification se reflétera pour tous les motifs enfants
( Canceled period ): ( annulé )
#widget

View File

@@ -44,15 +44,6 @@ class AbstractTaskPlaceEvent
*/
private $datetime;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
@@ -90,16 +81,6 @@ class AbstractTaskPlaceEvent
return $this->datetime;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get transition.
*

View File

@@ -31,6 +31,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class SingleTaskPlaceEvent extends AbstractTaskPlaceEvent
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var SingleTask
* @ORM\ManyToOne(
@@ -51,4 +60,21 @@ class SingleTaskPlaceEvent extends AbstractTaskPlaceEvent
return $this;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
public function setId($id): self
{
$this->id = $id;
return $this;
}
}