mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-02 14:07:43 +00:00
Merge branch 'ticket/supplementary-comments-on-motive' into 'ticket-app-master'
Add `supplementaryComments` property to Motive entity, update fixtures and types See merge request Chill-Projet/chill-bundles!861
This commit is contained in:
commit
1b74c119dc
@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\TicketBundle\DataFixtures\ORM;
|
namespace Chill\TicketBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\TicketBundle\Entity\EmergencyStatusEnum;
|
||||||
use Chill\TicketBundle\Entity\Motive;
|
use Chill\TicketBundle\Entity\Motive;
|
||||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||||
@ -25,58 +26,73 @@ final class LoadMotives extends Fixture implements FixtureGroupInterface
|
|||||||
|
|
||||||
public function load(ObjectManager $manager)
|
public function load(ObjectManager $manager)
|
||||||
{
|
{
|
||||||
foreach (explode("\n", self::MOTIVES) as $label) {
|
foreach (explode("\n", self::MOTIVES) as $row) {
|
||||||
if ('' === trim($label)) {
|
if ('' === trim($row)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = str_getcsv($row);
|
||||||
|
if ('' === $data[0]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$motive = new Motive();
|
$motive = new Motive();
|
||||||
$motive->setLabel(['fr' => trim($label)]);
|
$motive->setLabel(['fr' => trim((string) $data[0])]);
|
||||||
|
$motive->setMakeTicketEmergency(match ($data[1]) {
|
||||||
|
'true' => EmergencyStatusEnum::YES,
|
||||||
|
'false' => EmergencyStatusEnum::NO,
|
||||||
|
default => throw new \UnexpectedValueException('Unexpected value'),
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (array_slice($data, 2) as $supplementaryComment) {
|
||||||
|
if ('' !== trim((string) $supplementaryComment)) {
|
||||||
|
$motive->addSupplementaryComment(['label' => trim((string) $supplementaryComment)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$manager->persist($motive);
|
$manager->persist($motive);
|
||||||
}
|
}
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
private const MOTIVES = <<<'TXT'
|
private const MOTIVES = <<<'CSV'
|
||||||
Coordonnées
|
"Coordonnées",false,"Nouvelles coordonnées",
|
||||||
Horaire de passage
|
"Horaire de passage",false,
|
||||||
Retard de livraison
|
"Retard de livraison",false,
|
||||||
Erreur de livraison
|
"Erreur de livraison",false,
|
||||||
Colis incomplet
|
"Colis incomplet",false,
|
||||||
MATLOC
|
"MATLOC",false,
|
||||||
Retard DASRI
|
"Retard DASRI",false,
|
||||||
Planning d'astreintes
|
"Planning d'astreintes",false,
|
||||||
Planning des tournées
|
"Planning des tournées",false,
|
||||||
Contrôle pompe
|
"Contrôle pompe",true,
|
||||||
Changement de rendez-vous
|
"Changement de rendez-vous",false,"Date du nouveau rendez-vous","Lieu du nouveau rendez-vous",
|
||||||
Renseignement facturation/prestation
|
"Renseignement facturation/prestation",false,
|
||||||
Décès patient
|
"Décès patient",false,"Date et heures du décès","Autorisation préalable du médecin pour le décès",
|
||||||
Demande de prise en charge
|
"Demande de prise en charge",false,
|
||||||
Information absence
|
"Information absence",false,
|
||||||
Demande bulletin de situation
|
"Demande bulletin de situation",false,
|
||||||
Difficultés accès logement
|
"Difficultés accès logement",false,
|
||||||
Déplacement inutile
|
"Déplacement inutile",false,
|
||||||
Problème de prélèvement/de commande
|
"Problème de prélèvement/de commande",false,
|
||||||
Parc auto
|
"Parc auto",false,
|
||||||
Demande d'admission
|
"Demande d'admission",false,
|
||||||
Retrait de matériel au domicile
|
"Retrait de matériel au domicile",false,
|
||||||
Comptes-rendus
|
"Comptes-rendus",false,
|
||||||
Démarchage commercial
|
"Démarchage commercial",false,
|
||||||
Demande de transport
|
"Demande de transport",false,
|
||||||
Demande laboratoire
|
"Demande laboratoire",false,
|
||||||
Demande admission
|
"Demande admission",false,
|
||||||
Suivi de prise en charge
|
"Suivi de prise en charge",false,
|
||||||
Mauvaise adresse
|
"Mauvaise adresse",false,
|
||||||
Patient absent
|
"Patient absent",false,
|
||||||
Annulation
|
"Annulation",false,
|
||||||
Colis perdu
|
"Colis perdu",false,
|
||||||
Changement de rendez-vous
|
"Changement de rendez-vous",false,
|
||||||
Coordination interservices
|
"Coordination interservices",false,
|
||||||
Problème de substitution produits
|
"Problème de substitution produits",true,
|
||||||
Problème ordonnance
|
"Problème ordonnance",false,
|
||||||
Réclamations facture
|
"Réclamations facture",false,"Numéro de facture concerné",
|
||||||
Préparation urgente
|
"Préparation urgente",true,
|
||||||
TXT;
|
CSV;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,10 @@ class Motive
|
|||||||
#[Serializer\Groups(['read'])]
|
#[Serializer\Groups(['read'])]
|
||||||
private ?EmergencyStatusEnum $makeTicketEmergency = null;
|
private ?EmergencyStatusEnum $makeTicketEmergency = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['jsonb' => true, 'default' => '[]'])]
|
||||||
|
#[Serializer\Groups(['read'])]
|
||||||
|
private array $supplementaryComments = [];
|
||||||
|
|
||||||
public function isActive(): bool
|
public function isActive(): bool
|
||||||
{
|
{
|
||||||
return $this->active;
|
return $this->active;
|
||||||
@ -76,4 +80,22 @@ class Motive
|
|||||||
{
|
{
|
||||||
return null !== $this->makeTicketEmergency;
|
return null !== $this->makeTicketEmergency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the supplementary comments.
|
||||||
|
*
|
||||||
|
* @return array<array{label: string}>
|
||||||
|
*/
|
||||||
|
public function getSupplementaryComments(): array
|
||||||
|
{
|
||||||
|
return $this->supplementaryComments;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{label: string} $supplementaryComments
|
||||||
|
*/
|
||||||
|
public function addSupplementaryComment(array $supplementaryComments): void
|
||||||
|
{
|
||||||
|
$this->supplementaryComments[] = $supplementaryComments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,9 @@ export interface Comment {
|
|||||||
updatedBy: User | null;
|
updatedBy: User | null;
|
||||||
updatedAt: DateTime | null;
|
updatedAt: DateTime | null;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
|
supplementaryComments: {
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddresseeHistory {
|
export interface AddresseeHistory {
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
<?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\Ticket;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
final class Version20250711131126 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add supplementaryComments property to Motive entity as JSONB type to store list of comments with label';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_ticket.motive ADD supplementaryComments JSONB DEFAULT \'[]\' NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_ticket.motive DROP supplementaryComments');
|
||||||
|
}
|
||||||
|
}
|
@ -99,6 +99,8 @@ class ReplaceMotiveControllerTest extends KernelTestCase
|
|||||||
$entityManager->flush()->shouldBeCalled();
|
$entityManager->flush()->shouldBeCalled();
|
||||||
|
|
||||||
$changeEmergencyCommandHandler = $this->prophesize(ChangeEmergencyStateCommandHandler::class);
|
$changeEmergencyCommandHandler = $this->prophesize(ChangeEmergencyStateCommandHandler::class);
|
||||||
|
$changeEmergencyCommandHandler->__invoke(Argument::any(), Argument::any())->shouldBeCalled()
|
||||||
|
->will(fn (array $args) => $args[0]);
|
||||||
|
|
||||||
$handler = new ReplaceMotiveCommandHandler(
|
$handler = new ReplaceMotiveCommandHandler(
|
||||||
new MockClock(),
|
new MockClock(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user