From 91e9b74d28f3493e8ca16126ae3138835b4964e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Wed, 23 Jun 2021 10:00:17 +0200
Subject: [PATCH] =?UTF-8?q?Correction=20bug=20:=20on=20ne=20sync=20plus=20?=
 =?UTF-8?q?un=20EP=20de=20force=20si=20c'est=20pour=20le=20d=C3=A9truire?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Controller/OffreFormation/ElementPedagogiqueController.php | 3 ++-
 .../src/Application/Service/ElementPedagogiqueService.php      | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php b/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php
index b8cb23742e..0cd71a3572 100755
--- a/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php
+++ b/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php
@@ -232,7 +232,8 @@ class ElementPedagogiqueController extends AbstractController
 
         $saisie = $this->params()->fromPost('vhes');
 
-        $tis = $element->getTypesInterventionPossibles();
+        $tis  = $element->getTypesInterventionPossibles();
+        $vhes = [];
         foreach ($tis as $typeIntervention) {
             if (!isset($existsVhes[$typeIntervention->getId()])) {
                 $vhe = $this->getServiceVolumeHoraireEns()->newEntity($element, $typeIntervention);
diff --git a/module/Application/src/Application/Service/ElementPedagogiqueService.php b/module/Application/src/Application/Service/ElementPedagogiqueService.php
index ac76d8783f..2c47310072 100755
--- a/module/Application/src/Application/Service/ElementPedagogiqueService.php
+++ b/module/Application/src/Application/Service/ElementPedagogiqueService.php
@@ -434,7 +434,7 @@ where rang = 1
             DECLARE
               element_id NUMERIC;
             BEGIN
-              unicaen_import.synchronisation('ELEMENT_PEDAGOGIQUE', 'WHERE code =''' || " . $c->quote($code) . " || ''' AND annee_id = ' || " . $annee . ");
+              unicaen_import.synchronisation('ELEMENT_PEDAGOGIQUE', 'WHERE code =''' || " . $c->quote($code) . " || ''' AND import_action <> ''delete'' AND annee_id = ' || " . $annee . ");
               BEGIN  
                 SELECT id INTO element_id FROM element_pedagogique ep WHERE code = " . $c->quote($code) . " AND ep.annee_id = " . $annee . " AND histo_destruction IS NULL;
             
-- 
GitLab