From eaea702454a2e528f53d18c60f1a6aafd4575d20 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 15 Mar 2023 10:14:25 +0100 Subject: [PATCH] FIX add initial user as suggestion and fix error when there are no suggestions --- src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php | 1 + src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php | 1 + src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php | 1 + .../Form/Type/PickThirdpartyDynamicType.php | 1 + 4 files changed, 4 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index 99aba07fd..e4683f24b 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -354,6 +354,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface public function getUsersInvolved(): array { $usersInvolved = []; + $usersInvolved[spl_object_hash($this->getCreatedBy())] = $this->getCreatedBy(); foreach ($this->steps as $step) { foreach ($step->getDestUser() as $u) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php index c48650f8e..f6c2b7f4a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php @@ -50,6 +50,7 @@ class PickUserDynamicType extends AbstractType $view->vars['multiple'] = $options['multiple']; $view->vars['types'] = ['user']; $view->vars['uniqid'] = uniqid('pick_user_dyn'); + $view->vars['suggested'] = []; foreach ($options['suggested'] as $user) { $view->vars['suggested'][] = $this->normalizer->normalize($user, 'json', ['groups' => 'read']); diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php index e8b83a416..76891a74d 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php @@ -49,6 +49,7 @@ class PickPersonDynamicType extends AbstractType $view->vars['multiple'] = $options['multiple']; $view->vars['types'] = ['person']; $view->vars['uniqid'] = uniqid('pick_user_dyn'); + $view->vars['suggested'] = []; foreach ($options['suggested'] as $person) { $view->vars['suggested'][] = $this->normalizer->normalize($person, 'json', ['groups' => 'read']); diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php index 1c3984b69..eb9e7e5ea 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php @@ -49,6 +49,7 @@ class PickThirdpartyDynamicType extends AbstractType $view->vars['multiple'] = $options['multiple']; $view->vars['types'] = ['thirdparty']; $view->vars['uniqid'] = uniqid('pick_user_dyn'); + $view->vars['suggested'] = []; foreach ($options['suggested'] as $tp) { $view->vars['suggested'][] = $this->normalizer->normalize($tp, 'json', ['groups' => 'read']);