From 26c5ce6b3a3ff3ba3551821da62bd7d7edbccb27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Thu, 5 May 2022 12:05:29 +0200
Subject: [PATCH] =?UTF-8?q?Correction=20d'une=20petite=20erreur=20d'affich?=
 =?UTF-8?q?age=20Protection=20pour=20=C3=A9viter=20la=20migration=20dspuis?=
 =?UTF-8?q?=20une=20version=20<17?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 admin/actions/maj-public-links.php | 3 +++
 admin/migration/v18Divers.php      | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 admin/actions/maj-public-links.php

diff --git a/admin/actions/maj-public-links.php b/admin/actions/maj-public-links.php
new file mode 100644
index 0000000000..eae3813af8
--- /dev/null
+++ b/admin/actions/maj-public-links.php
@@ -0,0 +1,3 @@
+<?php
+
+// à supprimer pour la v19
\ No newline at end of file
diff --git a/admin/migration/v18Divers.php b/admin/migration/v18Divers.php
index db17f57a84..0b87d6d7cd 100644
--- a/admin/migration/v18Divers.php
+++ b/admin/migration/v18Divers.php
@@ -26,6 +26,11 @@ class v18Divers extends AbstractMigration
         $bdd = $this->manager->getBdd();
         $c   = $this->manager->getOseAdmin()->getConsole();
 
+        // test pour savoir si on est bien en V17 minimum
+        if (!$this->manager->hasColumn('INTERVENANT', 'EXPORT_DATE')) {
+            $c->printDie('Attention : vous devez d\'abord mettre à jour en version 17.3 AVANT de mettre à jour en version 18');
+        }
+
         try {
             $c->msg('Coupure forcée de la synchronisation sur la table INTERVENANT');
             $bdd->exec("UPDATE IMPORT_TABLES SET SYNC_ENABLED = 0 WHERE TABLE_NAME = 'INTERVENANT'");
@@ -36,7 +41,7 @@ class v18Divers extends AbstractMigration
         $this->sauvegardes();
 
         try {
-            $c->msg('Suppression de la contrainte TYPE_INTERVENANT_CODE_UN en prévision de sa recréation');
+            $c->msg('Suppression des affectations de recherche ayant des structures invalides');
             $bdd->exec("DELETE FROM AFFECTATION_RECHERCHE WHERE structure_id NOT IN (SELECT ID FROM STRUCTURE)");
         } catch (\Exception $e) {
             // rien à faire : la contrainte a déjà du être supprimée
-- 
GitLab