From 9040954a25fb8dcfcd156ddc763d2635ec06d4df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Fri, 18 Jun 2021 11:53:37 +0200
Subject: [PATCH] =?UTF-8?q?Meilleur=20rafraichissement=20de=20la=20feuille?=
 =?UTF-8?q?=20de=20route=20suite=20=C3=A0=20la=20completion=20des=20donn?=
 =?UTF-8?q?=C3=A9es=20personnelles?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 CHANGELOG.md                                       |  2 +-
 .../Controller/IntervenantDossierController.php    |  1 +
 .../src/Application/Service/WorkflowService.php    | 14 +++++++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 86bf0640e6..0abe87f879 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,7 +22,7 @@ Objectif : Connecteur Export OSE => Logiciel RH + import Actul+
 ## Correction de bug
 
 * Inversion d'affichage Fi et Fa dans administration > type de ressources (#38510)
-
+* Meilleur rafraichissement de la feuille de route suite à la completion des données personnelles
 
 
 
diff --git a/module/Application/src/Application/Controller/IntervenantDossierController.php b/module/Application/src/Application/Controller/IntervenantDossierController.php
index cedd2ff532..4ea3913ca9 100755
--- a/module/Application/src/Application/Controller/IntervenantDossierController.php
+++ b/module/Application/src/Application/Controller/IntervenantDossierController.php
@@ -319,6 +319,7 @@ class IntervenantDossierController extends AbstractController
     {
         $this->getServiceWorkflow()->calculerTableauxBord([
             'dossier',
+            'service_saisie',
             'piece_jointe_demande',
         ], $intervenant);
     }
diff --git a/module/Application/src/Application/Service/WorkflowService.php b/module/Application/src/Application/Service/WorkflowService.php
index 75b0442053..581bc457b5 100755
--- a/module/Application/src/Application/Service/WorkflowService.php
+++ b/module/Application/src/Application/Service/WorkflowService.php
@@ -242,7 +242,7 @@ class WorkflowService extends AbstractService
         $iid = $intervenant->getId();
         $sid = $structure ? $structure->getId() : 0;
 
-        if (!isset($this->feuillesDeRoute[$iid][$sid])) {
+        if (true || !isset($this->feuillesDeRoute[$iid][$sid])) {
             $wie = $this->getEtapes($intervenant, $structure);
 
             $this->feuillesDeRoute[$iid][$sid] = [];
@@ -382,6 +382,18 @@ class WorkflowService extends AbstractService
             }
         }
 
+        /* Mise à jour des entités */
+        if (array_key_exists($intervenant->getId(), $this->feuillesDeRoute)) {
+            foreach ($this->feuillesDeRoute[$intervenant->getId()] as $fdr) {
+                foreach ($fdr as $etp) {
+                    /** @var $etp WorkflowEtape */
+                    foreach ($etp->getEtapes() as $etape) {
+                        $this->getEntityManager()->refresh($etape);
+                    }
+                }
+            }
+        }
+
         return $errors;
     }
 
-- 
GitLab