From f6ca91a3d48f9d5e7c7d2eb9ef4db297f20a6ecf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Thu, 28 Apr 2022 16:57:18 +0200
Subject: [PATCH] Corrections diverses scripts migration

---
 admin/migration/v18Plafonds.php | 27 +++++++++++++++++++++------
 admin/migration/v18Statuts.php  |  1 +
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/admin/migration/v18Plafonds.php b/admin/migration/v18Plafonds.php
index 2bfa9690a0..2565386977 100644
--- a/admin/migration/v18Plafonds.php
+++ b/admin/migration/v18Plafonds.php
@@ -80,9 +80,24 @@ class v18Plafonds extends AbstractMigration
 
     protected function after()
     {
-        $this->migrationParamsStructure();
-        $this->migrationParamsReferentiel();
-        $this->migrationParamsStatut();
+        $c = $this->manager->getOseAdmin()->getConsole();
+        try {
+            $this->migrationParamsStructure();
+        } catch (\Exception $e) {
+            $c->println($e->getMessage(), $c::COLOR_RED);
+        }
+
+        try {
+            $this->migrationParamsReferentiel();
+        } catch (\Exception $e) {
+            $c->println($e->getMessage(), $c::COLOR_RED);
+        }
+
+        try {
+            $this->migrationParamsStatut();
+        } catch (\Exception $e) {
+            $c->println($e->getMessage(), $c::COLOR_RED);
+        }
     }
 
 
@@ -200,7 +215,7 @@ class v18Plafonds extends AbstractMigration
             $c->msg('Ajout du paramètre ' . ($current + 1) . ' sur ' . $count . ' ...', true);
             $bdd->getTable('PLAFOND_STRUCTURE')->insert($insert);
         }
-        $c->begin('Fin de la convertion des paramètres de plafonds pour les structures');
+        $c->end('Fin de la convertion des paramètres de plafonds pour les structures');
     }
 
 
@@ -306,7 +321,7 @@ class v18Plafonds extends AbstractMigration
             $c->msg('Ajout du paramètre ' . ($current + 1) . ' sur ' . $count . ' ...', true);
             $bdd->getTable('PLAFOND_REFERENTIEL')->insert($insert);
         }
-        $c->begin('Fin de la convertion des paramètres de plafonds pour les fonctions référentielles');
+        $c->end('Fin de la convertion des paramètres de plafonds pour les fonctions référentielles');
     }
 
 
@@ -518,6 +533,6 @@ class v18Plafonds extends AbstractMigration
             $c->msg('Ajout du paramètre ' . ($current + 1) . ' sur ' . $count . ' ...', true);
             $bdd->getTable('PLAFOND_STATUT')->insert($insert);
         }
-        $c->begin('Fin de la convertion des paramètres de plafonds pour les statuts');
+        $c->end('Fin de la convertion des paramètres de plafonds pour les statuts');
     }
 }
\ No newline at end of file
diff --git a/admin/migration/v18Statuts.php b/admin/migration/v18Statuts.php
index f4ad4750f9..14850e62a6 100644
--- a/admin/migration/v18Statuts.php
+++ b/admin/migration/v18Statuts.php
@@ -78,6 +78,7 @@ class v18Statuts extends AbstractMigration
 
         $ddl = $bdd->table()->get('TBL_WORKFLOW')['TBL_WORKFLOW'];
         if (!isset($ddl['columns']['STATUT_ID'])) {
+            $bdd->exec('DROP TABLE WF_DEP_BLOQUANTE');
             $bdd->exec('DROP TABLE TBL_WORKFLOW');
             $c->msg('Suppression de la table TBL_WORKFLOW, qui sera recréée au nouveau format');
         }
-- 
GitLab