diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index 6bb3d7b79..0f776d809 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -117,6 +117,33 @@ final class ThirdPartyController extends CRUDController ); } + /** + * @param $action + * @param Request $request + * @param ThirdParty $entity + * @return Response|null + */ + protected function onPostFetchEntity($action, Request $request, $entity): ?Response + { + if ($action === 'view' && $entity->getParent() instanceof ThirdParty) { + $params = [ + 'id' => $entity->getParent()->getId() + ]; + + if ($request->query->has('returnPath')) { + $params['returnPath'] = $request->query->get('returnPath'); + } + + if ($request->query->has('returnLabel')) { + $params['returnLabel'] = $request->query->get('returnLabel'); + } + + return $this->redirectToRoute('chill_crud_3party_3party_view', $params); + } + + return null; + } + protected function onPostCheckACL($action, Request $request, $entity): ?Response { if ('edit' === $action || 'view' === $action) { diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig index 6b76b5cb0..4827ba19c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig @@ -23,15 +23,15 @@ {{ form_row(form.contactDataAnonymous) }} {% endif %} +{% if form.address is defined %} + {{ form_row(form.address) }} +{% endif %} + {% if form.activeChildren is defined %}

{{ 'Contacts'|trans }}

{{ form_widget(form.activeChildren) }} {% endif %} -{% if form.address is defined %} - {{ form_row(form.address) }} -{% endif %} - {{ form_row(form.comment) }} {% if form.centers is defined %}