mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Merge branch '146_parcours_annules' into rector/rules-symfony
This commit is contained in:
@@ -70,6 +70,11 @@ class ClosingMotive
|
||||
*/
|
||||
private ?ClosingMotive $parent = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
|
||||
*/
|
||||
private bool $isCanceledAccompanyingPeriod = false;
|
||||
|
||||
/**
|
||||
* ClosingMotive constructor.
|
||||
*/
|
||||
@@ -85,7 +90,7 @@ class ClosingMotive
|
||||
}
|
||||
|
||||
$this->children->add($child);
|
||||
$child->setParent($this);
|
||||
$child->setParent($this)->setIsCanceledAccompanyingPeriod($this->getIsCanceledAccompanyingPeriod());
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -128,6 +133,11 @@ class ClosingMotive
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
public function getIsCanceledAccompanyingPeriod(): bool
|
||||
{
|
||||
return $this->isCanceledAccompanyingPeriod;
|
||||
}
|
||||
|
||||
public function hasParent(): bool
|
||||
{
|
||||
return null !== $this->parent;
|
||||
@@ -153,6 +163,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)) {
|
||||
@@ -219,4 +234,15 @@ class ClosingMotive
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setIsCanceledAccompanyingPeriod(bool $isCanceledAP): ClosingMotive
|
||||
{
|
||||
$this->isCanceledAccompanyingPeriod = $isCanceledAP;
|
||||
|
||||
foreach ($this->getChildren() as $child) {
|
||||
$child->setIsCanceledAccompanyingPeriod($isCanceledAP);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
@@ -106,6 +107,8 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
|
||||
|
||||
$qb->select('COUNT(DISTINCT acpw.id) as export_result');
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -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,6 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
@@ -104,6 +104,8 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
$qb->select('COUNT(DISTINCT workeval.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
|
@@ -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 readonly 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;
|
||||
|
@@ -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')
|
||||
|
@@ -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;
|
||||
@@ -207,6 +208,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;
|
||||
|
@@ -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;
|
||||
@@ -199,6 +200,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;
|
||||
|
@@ -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;
|
||||
@@ -176,6 +177,8 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf
|
||||
|
||||
$this->listPersonHelper->addSelect($qb, $fields, $data['address_date']);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
$qb
|
||||
->addOrderBy('person.lastName')
|
||||
->addOrderBy('person.firstName')
|
||||
|
@@ -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')
|
||||
|
@@ -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 readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
EntityManagerInterface $em,
|
||||
) {
|
||||
$this->repository = $em->getRepository(AccompanyingPeriod::class);
|
||||
}
|
||||
@@ -133,6 +134,8 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
||||
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
@@ -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')
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
@@ -54,6 +55,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) {
|
||||
@@ -62,7 +64,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
|
||||
return $this->renderStringRecursive(
|
||||
$motive->getParent(),
|
||||
$newExisting,
|
||||
$newExisting . ' ' . $isCancled,
|
||||
$options
|
||||
);
|
||||
}
|
||||
@@ -71,6 +73,6 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
return $newExisting . self::SEPARATOR . $existing;
|
||||
}
|
||||
|
||||
return $newExisting;
|
||||
return $newExisting . ' ' . $isCancled;
|
||||
}
|
||||
}
|
||||
|
@@ -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');
|
||||
}
|
||||
}
|
@@ -347,6 +347,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
|
||||
|
||||
|
Reference in New Issue
Block a user