From b9480c6c3ba7abbb63f47ac396036e43f8256b40 Mon Sep 17 00:00:00 2001
From: Antony Le Courtes <antony.lecourtes@unicaen.fr>
Date: Wed, 2 Oct 2024 16:46:12 +0200
Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20du=20champs=20lastupdate?=
 =?UTF-8?q?=20pour=20les=20process,=20utile=20pour=20savoir=20=C3=A0=20que?=
 =?UTF-8?q?lle=20date=20le=20process=20a=20=C3=A9t=C3=A9=20termin=C3=A9=20?=
 =?UTF-8?q?d=C3=A9finitivement.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/Service/ProcessService.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/Service/ProcessService.php b/src/Service/ProcessService.php
index 4655c70..5a8667b 100644
--- a/src/Service/ProcessService.php
+++ b/src/Service/ProcessService.php
@@ -267,6 +267,7 @@ class ProcessService
                 $process->setCurrentStep(1);
                 $processStep = $process->getStep();
                 $process->setStatus(Signature::STATUS_SIGNATURE_WAIT);
+                $process->setLastUpdate(new \DateTime());
                 $this->getObjectManager()->flush();
                 $this->getObjectManager()->refresh($process);
                 $this->getObjectManager()->refresh($processStep);
@@ -296,6 +297,7 @@ class ProcessService
 
                 if ($processStep->getStatus() == Signature::STATUS_SIGNATURE_REJECT) {
                     $process->setStatus(Signature::STATUS_SIGNATURE_REJECT);
+                    $process->setLastUpdate(new \DateTime());
                     /** @var SignatureRecipient $recipient */
                     foreach ($processStep->getSignature()->getRecipients() as $recipient) {
                         if ($recipient->getStatus() != Signature::STATUS_SIGNATURE_REJECT) {
@@ -316,6 +318,7 @@ class ProcessService
                     if ($currentStep == $totalSteps) {
                         // FIN du PROCESSUS
                         $process->setStatus(Signature::STATUS_SIGNATURE_SIGNED);
+                        $process->setLastUpdate(new \DateTime());
                         $this->getObjectManager()->flush();
                         $this->triggerProcessEvent($process, ProcessEvent::EVENT_TYPE_SIGNED);
                         return;
@@ -323,6 +326,7 @@ class ProcessService
                     else {
                         // PASSAGE à l'ETAPE SUIVANTE
                         $process->setCurrentStep($process->getCurrentStep() + 1);
+                        $process->setLastUpdate(new \DateTime());
                         $this->getObjectManager()->flush();
                         $this->trigger($process);
                     }
@@ -365,6 +369,10 @@ class ProcessService
                     $labelInfo     .= $recipient['fullname'] . ' le ' . $dateSignature->format('d/m/Y');
 
                     $infosProcess[$keyStep]['labelInfos'] = $labelInfo;
+                    $signature = $step->getSignature();
+                    $urlDocumentSigned = $this->getSignatureService()->getDocumentSignedSignature($signature);
+                    $infosProcess[$keyStep]['urlDocumentSigned'] = $urlDocumentSigned;
+
                 }
                 if ($step->getStatus() == Signature::STATUS_SIGNATURE_WAIT) {
                     $labelInfo                                           = 'en attente de signature';
-- 
GitLab