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.
This commit is contained in:
Julien Fastré 2025-04-14 15:50:39 +02:00
parent e701e96187
commit f85b0c8cf7
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 9 additions and 1 deletions

View File

@ -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()]);
}

View File

@ -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