mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '350-validation_person_duplicate' into 'master'
Resolve "Erreur 500 lorsqu'un utilisateur fusionne deux dossiers d'usagers, et que les deux dossiers usagers sélectionnés sont les mêmes" Closes #350 See merge request Chill-Projet/chill-bundles!788
This commit is contained in:
commit
7c79b65f48
6
.changes/unreleased/Fixed-20250128-130242.yaml
Normal file
6
.changes/unreleased/Fixed-20250128-130242.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: Add validation error to manual selection of person in PersonDuplicateController
|
||||
time: 2025-01-28T13:02:42.369442185+01:00
|
||||
custom:
|
||||
Issue: "350"
|
||||
SchemaChange: No schema change
|
@ -29,6 +29,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function count;
|
||||
|
||||
class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
|
||||
@ -40,6 +41,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private readonly Security $security,
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
|
||||
private readonly TranslatorInterface $translator,
|
||||
) {}
|
||||
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm', name: 'chill_person_duplicate_confirm')]
|
||||
@ -125,7 +127,14 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
|
||||
$person2 = $form->get('person')->getData();
|
||||
|
||||
if (null === $person2) {
|
||||
throw $this->createNotFoundException("Person with id {$person2->getId}() not".' found on this server');
|
||||
throw $this->createNotFoundException('Person not found on this server');
|
||||
}
|
||||
|
||||
// Validation: Ensure person1 is not the same as person2
|
||||
if ($person->getId() === $person2->getId()) {
|
||||
$this->addFlash('error', $this->translator->trans('Person1 cannot be the same as Person2'));
|
||||
|
||||
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person2->getId()]);
|
||||
}
|
||||
|
||||
$direction = $form->get('direction')->getData();
|
||||
|
@ -127,6 +127,7 @@ not-duplicate: Faux-positif
|
||||
Switch to truefalse: Marquer comme faux-positif
|
||||
Switch to duplicate: Marquer comme doublon
|
||||
No duplicate candidates: Il n'y a pas de doublons détectés, ni de faux-positifs
|
||||
Person1 cannot be the same as Person2: La personne que vous sélectionnez ne peut pas être la même que celle de ce dossier.
|
||||
|
||||
# addresses part
|
||||
address_street_address_1: Adresse ligne 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user