From f85b0c8cf79feb6fd900acfa82453928948ef0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 14 Apr 2025 15:50:39 +0200 Subject: [PATCH] Add flash message for successful third-party merge This commit introduces a flash message to inform users when a third-party merge is successful. It uses Symfony's `FlashBag` and `TranslatableMessage` for better user feedback and localization support. --- .../Controller/ThirdpartyDuplicateController.php | 7 +++++++ .../ChillThirdPartyBundle/translations/messages.fr.yml | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php index 0c27d13ff..ab42b5656 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php @@ -17,8 +17,10 @@ use Chill\ThirdPartyBundle\Form\ThirdpartyFindDuplicateType; use Chill\ThirdPartyBundle\Service\ThirdpartyMergeService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Routing\Annotation\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; +use Symfony\Component\Translation\TranslatableMessage; use Symfony\Contracts\Translation\TranslatorInterface; class ThirdpartyDuplicateController extends AbstractController @@ -84,6 +86,11 @@ class ThirdpartyDuplicateController extends AbstractController $this->thirdPartyMergeService->merge($thirdparty1, $thirdparty2); + $session = $request->getSession(); + if ($session instanceof Session) { + $session->getFlashBag()->add('success', new TranslatableMessage('thirdparty_duplicate.Merge successful')); + } + return $this->redirectToRoute('chill_crud_3party_3party_view', ['id' => $thirdparty1->getId()]); } diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml index 85f7b2405..2c794ef99 100644 --- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml @@ -139,8 +139,9 @@ thirdparty_duplicate: Thirdparty to keep: Tiers à conserver Thirdparty to delete: Tiers à supprimer Thirdparty to delete explanation: Ce tiers sera supprimé. Seuls les contacts de ce tiers, énumérés ci-dessous, seront transférés. - Thirdparty to keep explanation: Ce tiers sera conserver + Thirdparty to keep explanation: Ce tiers sera conservé Data to keep: Données conservées You cannot merge a thirdparty with itself. Please choose a different thirdparty: Vous ne pouvez pas fusionner un tiers avec lui-même. Veuillez choisir un autre tiers. A thirdparty can only be merged with a thirdparty of the same kind: Un tiers ne peut être fusionné qu'avec un tiers de même type. Two child thirdparties must have the same parent: Deux tiers de type « contact » doivent avoir le même tiers parent. + Merge successful: La fusion a été effectuée avec succès