mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 21:13:57 +00:00
Update the form to allow sending a workflow to an external destinee
OP#734 Modification du formulaire pour permettre l'envoi d'un workflow https://champs-libres.openproject.com/work_packages/734
This commit is contained in:
@@ -12,14 +12,17 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Form\Type\ChillCollectionType;
|
||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||
use Chill\MainBundle\Form\Type\PickUserGroupOrUserDynamicType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO;
|
||||
use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
|
||||
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
@@ -101,6 +104,7 @@ class WorkflowStepType extends AbstractType
|
||||
$toFinal = true;
|
||||
$isForward = 'neutral';
|
||||
$isSignature = [];
|
||||
$isSentExternal = false;
|
||||
|
||||
$metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition);
|
||||
|
||||
@@ -124,6 +128,8 @@ class WorkflowStepType extends AbstractType
|
||||
if (\array_key_exists('isSignature', $meta)) {
|
||||
$isSignature = $meta['isSignature'];
|
||||
}
|
||||
|
||||
$isSentExternal = $isSentExternal ? true : $meta['isSentExternal'] ?? false;
|
||||
}
|
||||
|
||||
return [
|
||||
@@ -131,6 +137,7 @@ class WorkflowStepType extends AbstractType
|
||||
'data-to-final' => $toFinal ? '1' : '0',
|
||||
'data-is-forward' => $isForward,
|
||||
'data-is-signature' => json_encode($isSignature),
|
||||
'data-is-sent-external' => $isSentExternal ? '1' : '0',
|
||||
];
|
||||
},
|
||||
])
|
||||
@@ -166,6 +173,24 @@ class WorkflowStepType extends AbstractType
|
||||
'suggested' => $options['suggested_users'],
|
||||
'empty_data' => '[]',
|
||||
'attr' => ['class' => 'future-cc-users'],
|
||||
])
|
||||
->add('futureDestineeEmails', ChillCollectionType::class, [
|
||||
'entry_type' => EmailType::class,
|
||||
'entry_options' => [
|
||||
'empty_data' => '',
|
||||
],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
'delete_empty' => static fn (?string $email) => '' === $email || null === $email,
|
||||
'button_add_label' => 'workflow.transition_destinee_add_emails',
|
||||
'button_remove_label' => 'workflow.transition_destinee_remove_emails',
|
||||
'help' => 'workflow.transition_destinee_emails_help',
|
||||
'label' => 'workflow.transition_destinee_emails_label',
|
||||
])
|
||||
->add('futureDestineeThirdParties', PickThirdpartyDynamicType::class, [
|
||||
'label' => 'workflow.transition_destinee_third_party',
|
||||
'help' => 'workflow.transition_destinee_third_party_help',
|
||||
'multiple' => true,
|
||||
]);
|
||||
|
||||
$builder
|
||||
|
Reference in New Issue
Block a user