When a user applies a signature in a workflow, the signer is the futureDestUser of the next step

See:
- Vendee/accent-suivi-developpement#1252
- https://champs-libres.openproject.com/wp/768
- OP#768
This commit is contained in:
2024-10-24 15:49:59 +02:00
parent 97729de66d
commit bf85e9bb71
2 changed files with 42 additions and 4 deletions

View File

@@ -97,16 +97,20 @@ class SignatureStepStateChanger
return;
}
$previousUser = $this->getPreviousSender($signature->getStep());
if ('person' === $signature->getSignerKind()) {
$futureUser = $this->getPreviousSender($signature->getStep());
} else {
$futureUser = $signature->getSigner();
}
if (null === $previousUser) {
if (null === $futureUser) {
$this->logger->info(self::LOG_PREFIX.'No previous user, will not apply a transition', ['signatureId' => $signature->getId()]);
return;
}
$transitionDto = new WorkflowTransitionContextDTO($entityWorkflow);
$transitionDto->futureDestUsers[] = $previousUser;
$transitionDto->futureDestUsers[] = $futureUser;
$workflow->apply($entityWorkflow, $transition, [
'context' => $transitionDto,