Skip to content
Snippets Groups Projects
Commit e4433a9f authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Ajout methode qui renvoie une synthèse du process adaptée à l'affichage utilisateur

parent b772658e
Branches
Tags
No related merge requests found
Pipeline #30725 passed
...@@ -345,6 +345,39 @@ class ProcessService ...@@ -345,6 +345,39 @@ class ProcessService
} }
} }
/**
* Méthode qui renvoie une synthèse des infos process de signature pour affichage
*
* @param Process $process
* @return array
*/
public function getInfosProcess(Process $process): array
{
$infosProcess = [];
foreach ($process->getSteps() as $keyStep => $step) {
if ($step->getStatus() == Signature::STATUS_SIGNATURE_SIGNED ||
$step->getStatus() == Signature::STATUS_SIGNATURE_WAIT) {
$infosProcess[$keyStep] = $step->toArray();
if ($step->getStatus() == Signature::STATUS_SIGNATURE_SIGNED) {
$labelInfo = 'signé par ';
$recipient = current($infosProcess[$keyStep]['recipients']);
$dateSignature = new \DateTime($recipient['dateFinished']);
$labelInfo .= $recipient['fullname'] . ' le ' . $dateSignature->format('d/m/Y');
$infosProcess[$keyStep]['labelInfos'] = $labelInfo;
}
if ($step->getStatus() == Signature::STATUS_SIGNATURE_WAIT) {
$labelInfo = 'en attente de signature';
$infosProcess[$keyStep]['labelInfos'] = $labelInfo;
}
}
}
return $infosProcess;
}
/** /**
* @param Process $process * @param Process $process
* @param string $eventType * @param string $eventType
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment