mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[person duplicate] fix direction in page confirm
This commit is contained in:
parent
c32ba2bee4
commit
08bf5f9922
@ -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.");
|
"You are not allowed to see this person.");
|
||||||
|
|
||||||
$form = $this->createForm(PersonConfimDuplicateType::class);
|
$form = $this->createForm(PersonConfimDuplicateType::class);
|
||||||
@ -95,14 +96,14 @@ class PersonDuplicateController extends Controller
|
|||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$event = new PrivacyEvent($person1, array(
|
$event = new PrivacyEvent($personFrom, array(
|
||||||
'element_class' => Person::class,
|
'element_class' => Person::class,
|
||||||
'action' => 'move'
|
'action' => 'move'
|
||||||
));
|
));
|
||||||
$event->addPerson($person2);
|
$event->addPerson($personTo);
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
$sqls = $this->personMove->getSQL($person2, $person1);
|
$sqls = $this->personMove->getSQL($personFrom, $personTo);
|
||||||
|
|
||||||
$connection = $this->getDoctrine()->getConnection();
|
$connection = $this->getDoctrine()->getConnection();
|
||||||
|
|
||||||
@ -114,17 +115,17 @@ class PersonDuplicateController extends Controller
|
|||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans('The de-duplicate operation success'));
|
$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', [
|
return $this->render('ChillPersonBundle:PersonDuplicate:confirm.html.twig', [
|
||||||
'person' => $person1,
|
'personFrom' => $personFrom,
|
||||||
'person2' => $person2,
|
'personTo' => $personTo,
|
||||||
'form' => $form->createView(),
|
'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);
|
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
||||||
|
|
||||||
@ -144,10 +145,14 @@ class PersonDuplicateController extends Controller
|
|||||||
$this->getDoctrine()->getManager()->flush();
|
$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()]);
|
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);
|
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
||||||
|
|
||||||
@ -162,6 +167,10 @@ class PersonDuplicateController extends Controller
|
|||||||
$this->getDoctrine()->getManager()->flush();
|
$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()]);
|
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,13 +207,13 @@ class PersonDuplicateController extends Controller
|
|||||||
|
|
||||||
if ($direction === 'starting') {
|
if ($direction === 'starting') {
|
||||||
$params = [
|
$params = [
|
||||||
'person1_id' => $person->getId(),
|
'personIdFrom' => $person->getId(),
|
||||||
'person2_id' => $person2->getId(),
|
'personIdTo' => $person2->getId(),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$params = [
|
$params = [
|
||||||
'person1_id' => $person2->getId(),
|
'personIdFrom' => $person2->getId(),
|
||||||
'person2_id' => $person->getId(),
|
'personIdTo' => $person->getId(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ chill_person_duplicate_view:
|
|||||||
controller: Chill\PersonBundle\Controller\PersonDuplicateController::viewAction
|
controller: Chill\PersonBundle\Controller\PersonDuplicateController::viewAction
|
||||||
|
|
||||||
chill_person_duplicate_confirm:
|
chill_person_duplicate_confirm:
|
||||||
path: /{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm
|
path: /{_locale}/person/{personIdFrom}/duplicate/{personIdTo}/confirm
|
||||||
controller: Chill\PersonBundle\Controller\PersonDuplicateController::confirmAction
|
controller: Chill\PersonBundle\Controller\PersonDuplicateController::confirmAction
|
||||||
|
|
||||||
chill_person_duplicate_not_duplicate:
|
chill_person_duplicate_not_duplicate:
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
{% set activeRouteKey = 'chill_person_duplicate' %}
|
{% set activeRouteKey = 'chill_person_duplicate' %}
|
||||||
{% import '@ChillPerson/PersonDuplicate/_sidepane.html.twig' as sidepane %}
|
{% import '@ChillPerson/PersonDuplicate/_sidepane.html.twig' as sidepane %}
|
||||||
|
|
||||||
{% block title %}{{ 'Person duplicate'|trans|capitalize ~ ' ' ~ person.firstName|capitalize ~
|
{% block title %}{{ 'Person duplicate'|trans|capitalize ~ ' ' ~ personFrom|chill_entity_render_string }}{% endblock %}
|
||||||
' ' ~ person.lastName }}{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<style>
|
<style>
|
||||||
@ -31,12 +30,12 @@
|
|||||||
</p>
|
</p>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
||||||
<h1><span><a class="btn btn-show" target="_blank" title="{{ 'Open in another window'|trans }}" href="{{ path('chill_person_view', { person_id : person2.id }) }}"></a></span>
|
<h1><span><a class="btn btn-show" target="_blank" title="{{ 'Open in another window'|trans }}" href="{{ path('chill_person_view', { person_id : personFrom.id }) }}"></a></span>
|
||||||
{{ person2 }}
|
{{ personFrom }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h4>{{ 'Deleted datas'|trans ~ ':' }}</h4>
|
<h4>{{ 'Deleted datas'|trans ~ ':' }}</h4>
|
||||||
{{ sidepane.details(person2) }}
|
{{ sidepane.details(personFrom) }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -47,12 +46,12 @@
|
|||||||
</p>
|
</p>
|
||||||
<div class="col border">
|
<div class="col border">
|
||||||
|
|
||||||
<h1><span><a class="btn btn-show" target="_blank" title="{{ 'Open in another window'|trans }}" href="{{ path('chill_person_view', { person_id : person.id }) }}"></a></span>
|
<h1><span><a class="btn btn-show" target="_blank" title="{{ 'Open in another window'|trans }}" href="{{ path('chill_person_view', { person_id : personTo.id }) }}"></a></span>
|
||||||
{{ person }}
|
{{ personTo }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h4>{{ 'Keeped datas'|trans ~ ':' }}</h4>
|
<h4>{{ 'Keeped datas'|trans ~ ':' }}</h4>
|
||||||
{{ sidepane.details(person) }}
|
{{ sidepane.details(personTo) }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -71,12 +70,12 @@
|
|||||||
|
|
||||||
<ul class="sticky-form-buttons record_actions">
|
<ul class="sticky-form-buttons record_actions">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ chill_return_path_or('chill_person_duplicate_view', {'person_id': person.id }) }}" class="sc-button bt-cancel btn btn-chill-gray center margin-5">
|
<a href="{{ chill_return_path_or('chill_person_duplicate_view', {'person_id': personTo.id }) }}" class="sc-button bt-cancel btn btn-chill-gray center margin-5">
|
||||||
{{ 'Return'|trans }}
|
{{ 'Return'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="">
|
<li class="">
|
||||||
<a href="{{ path('chill_person_duplicate_confirm', { person1_id : person2.id, person2_id : person.id }) }}"
|
<a href="{{ path('chill_person_duplicate_confirm', { personIdTo : personFrom.id, personIdFrom : personTo.id }) }}"
|
||||||
class="sc-button bt-orange btn btn-action">
|
class="sc-button bt-orange btn btn-action">
|
||||||
<i class="fa fa-exchange"></i>
|
<i class="fa fa-exchange"></i>
|
||||||
{{ 'Invert'|trans }}
|
{{ 'Invert'|trans }}
|
||||||
|
@ -60,12 +60,12 @@
|
|||||||
<a class="sc-button bt-show btn btn-show" target="_blank" href="{{ path('chill_person_view', { person_id : duplicatePerson.id }) }}"></a>
|
<a class="sc-button bt-show btn btn-show" target="_blank" href="{{ path('chill_person_view', { person_id : duplicatePerson.id }) }}"></a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="sc-button bt-orange btn btn-action" href="{{ path('chill_person_duplicate_confirm', { person1_id : person.id, person2_id : duplicatePerson.id }) }}">
|
<a class="sc-button bt-orange btn btn-action" href="{{ path('chill_person_duplicate_confirm', { personIdTo: person.id, personIdFrom: duplicatePerson.id }) }}">
|
||||||
<i class="fa fa-cog fa-fw"></i>{{ 'Merge'|trans }}</a>
|
<i class="fa fa-cog fa-fw"></i>{{ 'Merge'|trans }}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="sc-button btn btn-misc" title="{{ 'Switch to truefalse'|trans }}"
|
<a class="sc-button btn btn-misc" title="{{ 'Switch to truefalse'|trans }}"
|
||||||
href="{{ path('chill_person_duplicate_not_duplicate', {person1_id : person.id, person2_id : duplicatePerson.id}) }}">
|
href="{{ chill_path_add_return_path('chill_person_duplicate_not_duplicate', {person1_id : person.id, person2_id : duplicatePerson.id}) }}">
|
||||||
{{ 'Switch to truefalse'|trans }}
|
{{ 'Switch to truefalse'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -128,7 +128,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="sc-button btn btn-misc" title="{{ 'Switch to duplicate'|trans }}"
|
<a class="sc-button btn btn-misc" title="{{ 'Switch to duplicate'|trans }}"
|
||||||
href="{{ path('chill_person_remove_duplicate_not_duplicate', {person1_id : person.id, person2_id : notDuplicatePerson.id}) }}">
|
href="{{ chill_path_add_return_path('chill_person_remove_duplicate_not_duplicate', {person1_id : person.id, person2_id : notDuplicatePerson.id}) }}">
|
||||||
{{ 'Switch to duplicate'|trans }}
|
{{ 'Switch to duplicate'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user