Merge branch 'ticket-app-master' into ticket/64-identifiants-person

This commit is contained in:
2025-09-29 13:21:06 +02:00
6 changed files with 276 additions and 15 deletions

View File

@@ -0,0 +1,8 @@
In this directory, you find an example of file for the command `chill:main:ticket_motives_import`.
This file contains a list of ticket motives to import into the system. Each entry is a dictionary with two keys: `code` and `label`. The `code` key contains the unique code for the ticket motive, and the `label` key contains the human-readable label for the ticket motive.
The `stored_objects` key contains the documents that will be associated with the tickets. They must be found in the same directory.
The command `chill:main:ticket_motives_import` uses this file to import the specified ticket motives into the system.

View File

@@ -0,0 +1,136 @@
- label:
fr: Appel famille pour annonce de décès
urgent: false
supplementary_informations:
- label:
fr: Date du décès
- label:
fr: lieu du décès (domicile ou hôpital)
- label:
fr: nom de lhôpital
- label:
fr: service concerné
stored_objects:
- label:
fr: ☀️ De 07h à 21h
filename: 2_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🌙 De 21h à 07h du matin
filename: 3_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🗓️ Dimanches et jours fériés
filename: 4_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 'Appel famille pour annonce absence : hospitalisation ou consultation'
urgent: false
supplementary_informations:
- label:
fr: Quel hôpital
- label:
fr: quel service
- label:
fr: pour quelles raisons
- label:
fr: 'consultation : date et heure'
- label:
fr: hospitalisation complète ou HDJ
stored_objects:
- label:
fr: ☀️ De 07h à 21h
filename: 5_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🌙 De 21h à 07h du matin
filename: 6_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🗓️ Dimanches et jours fériés
filename: 7_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 'Appel famille pour annonce absence : interruption de prise en charge'
urgent: false
supplementary_informations:
- label:
fr: Pour quelles raisons ? Date
- label:
fr: durée
- label:
fr: accord médical ?
stored_objects:
- label:
fr: ☀️ De 07h à 21h
filename: 8_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🌙 De 21h à 07h du matin
filename: 9_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🗓️ Dimanches et jours fériés
filename: 10_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 'Appel famille pour annonce absence : changement dadresse'
urgent: false
supplementary_informations:
- label:
fr:
- label:
fr: Pourquoi ? Pour combien de temps ? Besoin dun relais des soins ? Nouvelle adresse ?
stored_objects:
- label:
fr: ☀️ De 07h à 21h
filename: 11_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🌙 De 21h à 07h du matin
filename: 12_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🗓️ Dimanches et jours fériés
filename: 13_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: Appel famille pour altération de létat général du patient
urgent: true
supplementary_informations:
- label:
fr: Recherche des symptômes
- label:
fr: Attentes par rapport à la demande
stored_objects:
- label:
fr: ☀️ De 07h à 21h
filename: 14_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🌙 De 21h à 07h du matin
filename: 15_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🗓️ Dimanches et jours fériés
filename: 16_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: Appel famille pour prise en charge de la douleur
urgent: true
supplementary_informations:
- label:
fr: Localisation douleur
- label:
fr: Horaire dernier passage
- label:
fr: Traitements en cours
stored_objects:
- label:
fr: ☀️ De 07h à 21h
filename: 17_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🌙 De 21h à 07h du matin
filename: 18_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🗓️ Dimanches et jours fériés
filename: 19_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: Appel famille pour information sur la date de prise en charge
urgent: false
supplementary_informations: []
stored_objects:
- label:
fr: ☀️ De 07h à 21h
filename: 20_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🌙 De 21h à 07h du matin
filename: 21_doc_20250402_Pelotons flux externes consolidés.pdf
- label:
fr: 🗓️ Dimanches et jours fériés
filename: 22_doc_20250402_Pelotons flux externes consolidés.pdf

View File

@@ -0,0 +1,6 @@
In this directory, you find an example of file for the command `chill:main:override_translation`.
This file contains a list of translations to override in the translation catalogue. Each entry is a dictionary with two keys: `from` and `to`. The `from` key contains the original translation string, and the `to` key contains the replacement string.
The command `chill:main:override_translation` uses this file to generate a new translation catalogue with the specified overrides applied.

View File

@@ -0,0 +1,8 @@
- {from: "de l'usager", to: "du patient"}
- {from: "l'usager", to: "le patient"}
- {from: "L'usager", to: "Le patient"}
- {from: "d'usagers", to: "de patients"}
- {from: "usagers", to: "patients"}
- {from: "Usagers", to: "Patients"}
- {from: "usager", to: "patient"}
- {from: "Usager", to: "Patient"}

View File

@@ -0,0 +1,115 @@
<?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\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Reader\TranslationReaderInterface;
use Symfony\Component\Translation\Writer\TranslationWriterInterface;
use Symfony\Component\Yaml\Yaml;
class OverrideTranslationCommand extends Command
{
public function __construct(
private readonly TranslationReaderInterface $reader,
private readonly TranslationWriterInterface $writer,
) {
$this->setName('chill:main:override_translation');
parent::__construct();
}
protected function configure(): void
{
$this
->setDescription('Generate a translation catalogue with translation remplacements based on replacements provided in a YAML file.')
->addArgument('locale', InputArgument::REQUIRED, 'The locale to process (e.g. fr, en).')
->addArgument('overrides', InputArgument::REQUIRED, 'Path to the overrides YAML file (list of {from, to}).');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$locale = (string) $input->getArgument('locale');
$overridesPath = (string) $input->getArgument('overrides');
$catalogue = $this->loadCatalogue($locale);
$overrides = $this->loadOverrides($overridesPath);
$toOverrideCatalogue = new MessageCatalogue($locale);
foreach ($catalogue->getDomains() as $domain) {
// hack: we have to replace the suffix ".intl-icu" by "+intl-ic"
$domain = str_replace('.intl-icu', '+intl-icu', $domain);
foreach ($catalogue->all($domain) as $key => $translation) {
foreach ($overrides as $changes) {
$from = $changes['from'];
$to = $changes['to'];
if (is_string($translation) && str_contains($translation, $from)) {
$newTranslation = strtr($translation, [$from => $to]);
$toOverrideCatalogue->set($key, $newTranslation, $domain);
$translation = $newTranslation;
}
}
}
}
/** @var KernelInterface $kernel */
/* @phpstan-ignore-next-line */
$kernel = $this->getApplication()->getKernel();
$outputDir = rtrim($kernel->getProjectDir(), '/').'/translations';
if (!is_dir($outputDir)) {
@mkdir($outputDir, 0775, true);
}
// Writer expects the 'path' option to be a directory; it will create the proper file name
$this->writer->write($toOverrideCatalogue, 'yaml', ['path' => $outputDir]);
$output->writeln(sprintf('Override catalogue written to %s (domain: messages, locale: %s).', $outputDir, $locale));
return Command::SUCCESS;
}
/**
* @return list<array{from: string, to: string}>
*/
private function loadOverrides(string $path): array
{
return Yaml::parseFile($path);
}
private function loadCatalogue(string $locale): MessageCatalogue
{
/** @var KernelInterface $kernel */
/* @phpstan-ignore-next-line */
$kernel = $this->getApplication()->getKernel();
// collect path for translations
$transPaths = [];
foreach ($kernel->getBundles() as $bundle) {
$bundleDir = $bundle->getPath();
$transPaths[] = is_dir($bundleDir.'/Resources/translations') ? $bundleDir.'/Resources/translations' : $bundle->getPath().'/translations';
}
$currentCatalogue = new MessageCatalogue($locale);
foreach ($transPaths as $path) {
if (is_dir($path)) {
$this->reader->read($path, $currentCatalogue);
}
}
return $currentCatalogue;
}
}

View File

@@ -42,38 +42,26 @@ services:
- { name: console.command } - { name: console.command }
Chill\MainBundle\Command\LoadAddressesFRFromBANOCommand: Chill\MainBundle\Command\LoadAddressesFRFromBANOCommand:
autoconfigure: true
autowire: true
tags: tags:
- { name: console.command } - { name: console.command }
Chill\MainBundle\Command\LoadAddressesFRFromBANCommand: Chill\MainBundle\Command\LoadAddressesFRFromBANCommand:
autoconfigure: true
autowire: true
tags: tags:
- { name: console.command } - { name: console.command }
Chill\MainBundle\Command\LoadAddressesBEFromBestAddressCommand: Chill\MainBundle\Command\LoadAddressesBEFromBestAddressCommand:
autoconfigure: true
autowire: true
tags: tags:
- { name: console.command } - { name: console.command }
Chill\MainBundle\Command\LoadPostalCodeFR: Chill\MainBundle\Command\LoadPostalCodeFR:
autoconfigure: true
autowire: true
tags: tags:
- { name: console.command } - { name: console.command }
Chill\MainBundle\Command\LoadAddressesLUFromBDAddressCommand: Chill\MainBundle\Command\LoadAddressesLUFromBDAddressCommand:
autoconfigure: true
autowire: true
tags: tags:
- { name: console.command } - { name: console.command }
Chill\MainBundle\Command\ExecuteCronJobCommand: Chill\MainBundle\Command\ExecuteCronJobCommand:
autoconfigure: true
autowire: true
tags: tags:
- {name: console.command } - {name: console.command }
@@ -81,6 +69,6 @@ services:
tags: tags:
- {name: console.command} - {name: console.command}
Chill\MainBundle\Command\DumpListPermissionsCommand: Chill\MainBundle\Command\DumpListPermissionsCommand: ~
autoconfigure: true
autowire: true Chill\MainBundle\Command\OverrideTranslationCommand: ~