mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-25 16:14:59 +00:00
Compare commits
2 Commits
146_parcou
...
2.6.3
Author | SHA1 | Date | |
---|---|---|---|
b7119a2733 | |||
eca26a15e6 |
@@ -1,6 +0,0 @@
|
||||
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"
|
4
.changes/v2.6.3.md
Normal file
4
.changes/v2.6.3.md
Normal file
@@ -0,0 +1,4 @@
|
||||
## v2.6.3 - 2023-09-19
|
||||
### Fixed
|
||||
* Remove id property from document
|
||||
mappedsuperclass
|
@@ -6,6 +6,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
|
||||
## v2.6.3 - 2023-09-19
|
||||
### Fixed
|
||||
* Remove id property from document
|
||||
mappedsuperclass
|
||||
|
||||
## v2.6.2 - 2023-09-18
|
||||
### Fixed
|
||||
* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved.
|
||||
|
@@ -14,7 +14,6 @@ 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;
|
||||
@@ -32,7 +31,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
@@ -109,8 +108,6 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,6 @@ 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;
|
||||
@@ -32,7 +31,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
@@ -112,8 +111,6 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,6 @@ 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;
|
||||
@@ -32,7 +31,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
@@ -106,8 +105,6 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
$qb->select('COUNT(DISTINCT activity.id) as export_count_activity');
|
||||
|
||||
return $qb;
|
||||
|
@@ -15,7 +15,6 @@ 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;
|
||||
@@ -34,7 +33,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
public function __construct(
|
||||
ListActivityHelper $helper,
|
||||
EntityManagerInterface $entityManager,
|
||||
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
|
||||
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper
|
||||
) {
|
||||
$this->helper = $helper;
|
||||
$this->entityManager = $entityManager;
|
||||
@@ -148,8 +147,6 @@ 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;
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,6 @@ 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;
|
||||
@@ -32,7 +31,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
@@ -112,8 +111,6 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,6 @@ 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;
|
||||
@@ -32,7 +31,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
@@ -112,8 +111,6 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,6 @@ 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;
|
||||
@@ -28,9 +27,8 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
private CalendarRepository $calendarRepository;
|
||||
|
||||
public function __construct(
|
||||
CalendarRepository $calendarRepository,
|
||||
) {
|
||||
public function __construct(CalendarRepository $calendarRepository)
|
||||
{
|
||||
$this->calendarRepository = $calendarRepository;
|
||||
}
|
||||
|
||||
@@ -100,9 +98,6 @@ 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;
|
||||
}
|
||||
|
@@ -13,7 +13,6 @@ 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;
|
||||
@@ -28,7 +27,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||
private CalendarRepository $calendarRepository;
|
||||
|
||||
public function __construct(
|
||||
CalendarRepository $calendarRepository,
|
||||
CalendarRepository $calendarRepository
|
||||
) {
|
||||
$this->calendarRepository = $calendarRepository;
|
||||
}
|
||||
@@ -93,10 +92,8 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||
|
||||
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
||||
$qb->join('cal.accompanyingPeriod', 'acp');
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
$qb
|
||||
->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -13,7 +13,6 @@ 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;
|
||||
@@ -28,7 +27,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||
private CalendarRepository $calendarRepository;
|
||||
|
||||
public function __construct(
|
||||
CalendarRepository $calendarRepository,
|
||||
CalendarRepository $calendarRepository
|
||||
) {
|
||||
$this->calendarRepository = $calendarRepository;
|
||||
}
|
||||
@@ -93,10 +92,8 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||
|
||||
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
||||
$qb->join('cal.accompanyingPeriod', 'acp');
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
$qb
|
||||
->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -28,6 +28,13 @@ class AccompanyingCourseDocument extends Document implements HasScopesInterface,
|
||||
*/
|
||||
private ?AccompanyingPeriod $course = null;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
public function getCenters(): ?iterable
|
||||
{
|
||||
return $this->course->getCenters();
|
||||
@@ -38,6 +45,11 @@ class AccompanyingCourseDocument extends Document implements HasScopesInterface,
|
||||
return $this->course;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getScopes(): iterable
|
||||
{
|
||||
if (null === $this->course) {
|
||||
@@ -53,4 +65,11 @@ class AccompanyingCourseDocument extends Document implements HasScopesInterface,
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setId($id): self
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -49,13 +49,6 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
*/
|
||||
private $description = '';
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
|
||||
@@ -103,11 +96,6 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getObject(): ?StoredObject
|
||||
{
|
||||
return $this->object;
|
||||
|
@@ -23,6 +23,13 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
class PersonDocument extends Document implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
*/
|
||||
@@ -40,6 +47,11 @@ class PersonDocument extends Document implements HasCenterInterface, HasScopeInt
|
||||
return $this->getPerson()->getCenter();
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPerson(): Person
|
||||
{
|
||||
return $this->person;
|
||||
@@ -50,6 +62,13 @@ class PersonDocument extends Document implements HasCenterInterface, HasScopeInt
|
||||
return $this->scope;
|
||||
}
|
||||
|
||||
public function setId($id): self
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPerson($person): self
|
||||
{
|
||||
$this->person = $person;
|
||||
|
@@ -1,31 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
@@ -1,122 +0,0 @@
|
||||
<?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];
|
||||
}
|
||||
|
||||
}
|
@@ -52,4 +52,3 @@ services:
|
||||
$exportManager: '@Chill\MainBundle\Export\ExportManager'
|
||||
tags:
|
||||
- { name: chill.export_formatter, alias: 'csv_pivoted_list' }
|
||||
|
||||
|
@@ -69,11 +69,6 @@ class ClosingMotive
|
||||
*/
|
||||
private ?ClosingMotive $parent = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
|
||||
*/
|
||||
private bool $isCanceledAccompanyingPeriod = false;
|
||||
|
||||
/**
|
||||
* ClosingMotive constructor.
|
||||
*/
|
||||
@@ -89,7 +84,7 @@ class ClosingMotive
|
||||
}
|
||||
|
||||
$this->children->add($child);
|
||||
$child->setParent($this)->setIsCanceledAccompanyingPeriod($this->getIsCanceledAccompanyingPeriod());
|
||||
$child->setParent($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -132,11 +127,6 @@ class ClosingMotive
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
public function getIsCanceledAccompanyingPeriod(): bool
|
||||
{
|
||||
return $this->isCanceledAccompanyingPeriod;
|
||||
}
|
||||
|
||||
public function hasParent(): bool
|
||||
{
|
||||
return null !== $this->parent;
|
||||
@@ -162,11 +152,6 @@ 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)) {
|
||||
@@ -233,15 +218,4 @@ class ClosingMotive
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setIsCanceledAccompanyingPeriod(bool $isCanceledAP): ClosingMotive
|
||||
{
|
||||
$this->isCanceledAccompanyingPeriod = $isCanceledAP;
|
||||
|
||||
foreach ($this->getChildren() as $child) {
|
||||
$child->setIsCanceledAccompanyingPeriod($isCanceledAP);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
@@ -31,7 +30,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(AccompanyingPeriod::class);
|
||||
}
|
||||
@@ -112,8 +111,6 @@ 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;
|
||||
|
@@ -11,7 +11,6 @@ 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 +29,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->em = $em;
|
||||
}
|
||||
@@ -113,8 +112,6 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
|
||||
|
||||
$qb->select('COUNT(DISTINCT acpw.id) as export_result');
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@ 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 +28,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->entityManager = $em;
|
||||
}
|
||||
@@ -111,8 +110,6 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
$qb->select('COUNT(DISTINCT workeval.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
@@ -31,7 +30,7 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(AccompanyingPeriod::class);
|
||||
}
|
||||
@@ -112,8 +111,6 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
|
||||
)
|
||||
)->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
$qb->select('COUNT(DISTINCT person.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
|
@@ -13,7 +13,6 @@ 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;
|
||||
@@ -133,8 +132,6 @@ 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')
|
||||
|
@@ -11,7 +11,6 @@ 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;
|
||||
@@ -113,7 +112,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
|
||||
SocialActionRender $socialActionRender,
|
||||
RollingDateConverterInterface $rollingDateConverter,
|
||||
AggregateStringHelper $aggregateStringHelper,
|
||||
SocialActionRepository $socialActionRepository,
|
||||
SocialActionRepository $socialActionRepository
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->dateTimeHelper = $dateTimeHelper;
|
||||
@@ -292,8 +291,6 @@ 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;
|
||||
|
@@ -11,7 +11,6 @@ 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;
|
||||
@@ -102,7 +101,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
|
||||
DateTimeHelper $dateTimeHelper,
|
||||
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
|
||||
AggregateStringHelper $aggregateStringHelper,
|
||||
RollingDateConverterInterface $rollingDateConverter,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->socialIssueRender = $socialIssueRender;
|
||||
@@ -271,8 +270,6 @@ 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;
|
||||
|
@@ -11,7 +11,6 @@ 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;
|
||||
@@ -52,7 +51,7 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
|
||||
public function __construct(
|
||||
ExportAddressHelper $addressHelper,
|
||||
ListPersonHelper $listPersonHelper,
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->addressHelper = $addressHelper;
|
||||
$this->listPersonHelper = $listPersonHelper;
|
||||
@@ -191,8 +190,6 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
|
||||
|
||||
$this->listPersonHelper->addSelect($qb, $fields, $data['address_date']);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
$qb
|
||||
->addOrderBy('person.lastName')
|
||||
->addOrderBy('person.firstName')
|
||||
|
@@ -11,7 +11,6 @@ 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;
|
||||
@@ -134,8 +133,6 @@ 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')
|
||||
|
@@ -11,7 +11,6 @@ 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;
|
||||
@@ -33,7 +32,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(AccompanyingPeriod::class);
|
||||
}
|
||||
@@ -143,8 +142,6 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
||||
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -19,20 +19,12 @@ 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
|
||||
@@ -54,11 +46,6 @@ 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')
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,6 @@ 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.
|
||||
@@ -33,7 +32,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
*/
|
||||
private $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
@@ -63,7 +62,6 @@ 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) {
|
||||
@@ -72,7 +70,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
|
||||
return $this->renderStringRecursive(
|
||||
$motive->getParent(),
|
||||
$newExisting . ' ' . $isCancled,
|
||||
$newExisting,
|
||||
$options
|
||||
);
|
||||
}
|
||||
@@ -81,6 +79,6 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
return $newExisting . self::SEPARATOR . $existing;
|
||||
}
|
||||
|
||||
return $newExisting . ' ' . $isCancled;
|
||||
return $newExisting;
|
||||
}
|
||||
}
|
||||
|
@@ -1,36 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
@@ -349,9 +349,6 @@ 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
|
||||
|
||||
|
Reference in New Issue
Block a user