diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php index 23238cd22..78f99e8a9 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdpartyDuplicateController.php @@ -31,7 +31,13 @@ class ThirdpartyDuplicateController extends AbstractController #[Route(path: '/{_locale}/3party/{thirdparty_id}/find-manually', name: 'chill_thirdparty_find_duplicate')] public function findManuallyDuplicateAction(ThirdParty $thirdparty, Request $request) { - $form = $this->createForm(ThirdpartyFindDuplicateType::class); + $suggested = []; + + if ('child' === $thirdparty->getKind()) { + $suggested = $thirdparty->getParent()->getChildren(); + } + + $form = $this->createForm(ThirdpartyFindDuplicateType::class, null, ['suggested' => $suggested]); $form->handleRequest($request); diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdpartyFindDuplicateType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdpartyFindDuplicateType.php index db1b99481..275b6d21c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdpartyFindDuplicateType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdpartyFindDuplicateType.php @@ -15,6 +15,7 @@ use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class ThirdpartyFindDuplicateType extends AbstractType { @@ -24,9 +25,17 @@ class ThirdpartyFindDuplicateType extends AbstractType ->add('thirdparty', PickThirdpartyDynamicType::class, [ 'label' => 'Find duplicate', 'mapped' => false, + 'suggested' => $options['suggested'], ]) ->add('direction', HiddenType::class, [ 'data' => 'starting', ]); } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'suggested' => [], + ]); + } } diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index a36ceda4e..427f2b9e3 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -39,6 +39,7 @@ class ThirdPartyRender implements ChillEntityRenderInterface 'showContacts' => $options['showContacts'] ?? false, 'showParent' => $options['showParent'] ?? true, 'isConfidential' => $options['isConfidential'] ?? false, + 'showFusion' => $options['showFusion'] ?? false, ]; return