Add suggested persons and third parties in form

Integrated suggested persons and third parties into the WorkflowStepType form. This enhancement auto-populates suggestion fields for better user experience. It ensures that the suggestion data for persons and third parties is readily available in the form configuration.
This commit is contained in:
Julien Fastré 2024-10-23 01:10:39 +02:00
parent 261bc88b5e
commit 19eb6f7ebb
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -46,6 +46,8 @@ class WorkflowStepType extends AbstractType
$place = $workflow->getMarking($entityWorkflow); $place = $workflow->getMarking($entityWorkflow);
$placeMetadata = $workflow->getMetadataStore()->getPlaceMetadata(array_keys($place->getPlaces())[0]); $placeMetadata = $workflow->getMetadataStore()->getPlaceMetadata(array_keys($place->getPlaces())[0]);
$suggestedUsers = $this->entityWorkflowManager->getSuggestedUsers($entityWorkflow); $suggestedUsers = $this->entityWorkflowManager->getSuggestedUsers($entityWorkflow);
$suggestedThirdParties = $this->entityWorkflowManager->getSuggestedThirdParties($entityWorkflow);
$suggestedPersons = $this->entityWorkflowManager->getSuggestedPersons($entityWorkflow);
if (null === $options['entity_workflow']) { if (null === $options['entity_workflow']) {
throw new \LogicException('if transition is true, entity_workflow should be defined'); throw new \LogicException('if transition is true, entity_workflow should be defined');
@ -155,6 +157,7 @@ class WorkflowStepType extends AbstractType
'label' => 'workflow.signature_zone.person signatures', 'label' => 'workflow.signature_zone.person signatures',
'multiple' => true, 'multiple' => true,
'empty_data' => '[]', 'empty_data' => '[]',
'suggested' => $suggestedPersons,
]) ])
->add('futureUserSignature', PickUserDynamicType::class, [ ->add('futureUserSignature', PickUserDynamicType::class, [
'label' => 'workflow.signature_zone.user signature', 'label' => 'workflow.signature_zone.user signature',
@ -196,6 +199,7 @@ class WorkflowStepType extends AbstractType
'help' => 'workflow.transition_destinee_third_party_help', 'help' => 'workflow.transition_destinee_third_party_help',
'multiple' => true, 'multiple' => true,
'empty_data' => [], 'empty_data' => [],
'suggested' => $suggestedThirdParties,
]); ]);
$builder $builder