mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Implement logic to put workflow on hold and resume it
This commit is contained in:
parent
9475a708c3
commit
42471269db
@ -19,11 +19,13 @@ use Chill\MainBundle\Form\WorkflowStepType;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepSignatureRepository;
|
||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepHoldRepository;
|
||||
use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter;
|
||||
use Chill\MainBundle\Security\ChillSecurity;
|
||||
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
||||
use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\NonUniqueResultException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Clock\ClockInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
@ -52,6 +54,7 @@ class WorkflowController extends AbstractController
|
||||
private readonly ChillSecurity $security,
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
|
||||
private readonly ClockInterface $clock,
|
||||
private readonly EntityWorkflowStepHoldRepository $entityWorkflowStepHoldRepository,
|
||||
private readonly EntityWorkflowStepSignatureRepository $entityWorkflowStepSignatureRepository,
|
||||
) {}
|
||||
|
||||
@ -283,6 +286,9 @@ class WorkflowController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NonUniqueResultException
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/{id}/show', name: 'chill_main_workflow_show')]
|
||||
public function show(EntityWorkflow $entityWorkflow, Request $request): Response
|
||||
{
|
||||
@ -292,6 +298,7 @@ class WorkflowController extends AbstractController
|
||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
||||
$errors = [];
|
||||
$signatures = $entityWorkflow->getCurrentStep()->getSignatures();
|
||||
$holdOnStepByUser = $this->entityWorkflowStepHoldRepository->findOneByStepAndUser($entityWorkflow->getCurrentStep(), $this->security->getUser());
|
||||
|
||||
if (\count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
||||
// possible transition
|
||||
@ -354,6 +361,7 @@ class WorkflowController extends AbstractController
|
||||
'entity_workflow' => $entityWorkflow,
|
||||
'transition_form_errors' => $errors,
|
||||
'signatures' => $signatures,
|
||||
'holdOnStepByUser' => $holdOnStepByUser,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -64,14 +64,21 @@
|
||||
<section class="step my-4">{% include '@ChillMain/Workflow/_comment.html.twig' %}</section> #}
|
||||
<section class="step my-4">{% include '@ChillMain/Workflow/_history.html.twig' %}</section>
|
||||
|
||||
{# useful ?
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a class="btn btn-cancel" href="{{ path('chill_main_workflow_list_dest') }}">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% if holdOnStepByUser|length > 0 %}
|
||||
<li>
|
||||
<a class="btn btn-misc" href="{{ path('chill_main_workflow_remove_hold', {'holdId': holdOnStepByUser.id}) }}"><i class="fa fa-hourglass"></i>
|
||||
{{ 'workflow.Remove hold'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
<a class="btn btn-misc" href="{{ path('chill_main_workflow_on_hold', {'id': entity_workflow.id}) }}"><i class="fa fa-hourglass"></i>
|
||||
{{ 'workflow.Put on hold'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
#}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -527,6 +527,8 @@ workflow:
|
||||
Access link copied: Lien d'accès copié
|
||||
This link grant any user to apply a transition: Le lien d'accès suivant permet d'appliquer une transition
|
||||
The workflow may be accssed through this link: Une transition peut être appliquée sur ce workflow grâce au lien d'accès suivant
|
||||
Put on hold: Mettre en attente
|
||||
Remove hold: Enlever la mise en attente
|
||||
|
||||
signature_zone:
|
||||
title: Appliquer les signatures électroniques
|
||||
|
Loading…
x
Reference in New Issue
Block a user