mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-10 14:18:25 +00:00
[person duplicate] fix direction in page confirm
This commit is contained in:
@@ -83,11 +83,12 @@ class PersonDuplicateController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function confirmAction($person1_id, $person2_id, Request $request)
|
||||
public function confirmAction($personIdFrom, $personIdTo, Request $request)
|
||||
{
|
||||
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
||||
$personFrom = $this->personRepository->find($personIdFrom);
|
||||
$personTo = $this->personRepository->find($personIdTo);
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_DUPLICATE', $person1,
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_DUPLICATE', $personFrom,
|
||||
"You are not allowed to see this person.");
|
||||
|
||||
$form = $this->createForm(PersonConfimDuplicateType::class);
|
||||
@@ -95,14 +96,14 @@ class PersonDuplicateController extends Controller
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$event = new PrivacyEvent($person1, array(
|
||||
$event = new PrivacyEvent($personFrom, array(
|
||||
'element_class' => Person::class,
|
||||
'action' => 'move'
|
||||
));
|
||||
$event->addPerson($person2);
|
||||
$event->addPerson($personTo);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
$sqls = $this->personMove->getSQL($person2, $person1);
|
||||
$sqls = $this->personMove->getSQL($personFrom, $personTo);
|
||||
|
||||
$connection = $this->getDoctrine()->getConnection();
|
||||
|
||||
@@ -114,17 +115,17 @@ class PersonDuplicateController extends Controller
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('The de-duplicate operation success'));
|
||||
|
||||
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
||||
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $personTo->getId()]);
|
||||
}
|
||||
|
||||
return $this->render('ChillPersonBundle:PersonDuplicate:confirm.html.twig', [
|
||||
'person' => $person1,
|
||||
'person2' => $person2,
|
||||
'personFrom' => $personFrom,
|
||||
'personTo' => $personTo,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function notDuplicateAction($person1_id, $person2_id)
|
||||
public function notDuplicateAction($person1_id, $person2_id, Request $request)
|
||||
{
|
||||
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
||||
|
||||
@@ -144,10 +145,14 @@ class PersonDuplicateController extends Controller
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
}
|
||||
|
||||
if ($request->query->has('returnPath')) {
|
||||
return $this->redirect($request->query->get('returnPath'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
||||
}
|
||||
|
||||
public function removeNotDuplicateAction($person1_id, $person2_id)
|
||||
public function removeNotDuplicateAction($person1_id, $person2_id, Request $request)
|
||||
{
|
||||
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
||||
|
||||
@@ -162,6 +167,10 @@ class PersonDuplicateController extends Controller
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
}
|
||||
|
||||
if ($request->query->has('returnPath')) {
|
||||
return $this->redirect($request->query->get('returnPath'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
||||
}
|
||||
|
||||
@@ -198,13 +207,13 @@ class PersonDuplicateController extends Controller
|
||||
|
||||
if ($direction === 'starting') {
|
||||
$params = [
|
||||
'person1_id' => $person->getId(),
|
||||
'person2_id' => $person2->getId(),
|
||||
'personIdFrom' => $person->getId(),
|
||||
'personIdTo' => $person2->getId(),
|
||||
];
|
||||
} else {
|
||||
$params = [
|
||||
'person1_id' => $person2->getId(),
|
||||
'person2_id' => $person->getId(),
|
||||
'personIdFrom' => $person2->getId(),
|
||||
'personIdTo' => $person->getId(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user