mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 06:44:59 +00:00
Adjust logic for removing the hold on a workflow only by user who owns the hold and when a transition is applied on the workflow
This commit is contained in:
@@ -298,7 +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());
|
||||
$onHoldStep = $this->entityWorkflowStepHoldRepository->findByWorkflow($entityWorkflow);
|
||||
|
||||
if (\count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
||||
// possible transition
|
||||
@@ -343,6 +343,10 @@ class WorkflowController extends AbstractController
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
if ($onHoldStep) {
|
||||
$this->entityManager->remove($onHoldStep);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]);
|
||||
}
|
||||
|
||||
@@ -361,7 +365,7 @@ class WorkflowController extends AbstractController
|
||||
'entity_workflow' => $entityWorkflow,
|
||||
'transition_form_errors' => $errors,
|
||||
'signatures' => $signatures,
|
||||
'holdOnStepByUser' => $holdOnStepByUser,
|
||||
'onHoldStep' => $onHoldStep,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user