From 52a80f96219420cbdbb2c0ffe5ab7ea0bf58d7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 15 Apr 2025 14:54:15 +0200 Subject: [PATCH] Add flash message for successful ACPW merge This update informs users when accompanying period works are successfully merged by adding a success flash message. A new translatable message was also added for proper localization of this notification. --- .../AccompanyingPeriodWorkDuplicateController.php | 7 +++++++ src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 1 + 2 files changed, 8 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php index 09b6d4431..84d5fea0b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php @@ -18,7 +18,9 @@ use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepos use Chill\PersonBundle\Service\AccompanyingPeriodWork\AccompanyingPeriodWorkMergeService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Translation\TranslatableMessage; use Symfony\Contracts\Translation\TranslatorInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; @@ -91,6 +93,11 @@ class AccompanyingPeriodWorkDuplicateController extends AbstractController $this->accompanyingPeriodWorkMergeService->merge($acpw1, $acpw2); + $session = $request->getSession(); + if ($session instanceof Session) { + $session->getFlashBag()->add('success', new TranslatableMessage('acpw_duplicate.Successfully merged')); + } + return $this->redirectToRoute('chill_person_accompanying_period_work_show', ['id' => $acpw1->getId()]); } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 7e993b803..a4f8ec33f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1508,3 +1508,4 @@ acpw_duplicate: Accompanying period work to keep: Action d'accompagnement à conserver to keep: Action d'accompagnement à conserver to delete: Action d'accompagnement à supprimer + Successfully merged: Action d'accompagnement fusionnée avec succès.