From 37f09e4faf5a075fb51e26b9ea9849d87199cc1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chilliet@fusiondirectory.org>
Date: Thu, 5 Nov 2020 16:01:02 +0100
Subject: [PATCH] :ambulance: fix(setup) Fix problems in setup

Checks, LDAP base and admin creation were broken

issue #6122
---
 setup/class_setupStepLdap.inc    | 16 ++++++++++------
 setup/class_setupStepMigrate.inc |  5 +++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/setup/class_setupStepLdap.inc b/setup/class_setupStepLdap.inc
index 80a05c685..f08c07acc 100644
--- a/setup/class_setupStepLdap.inc
+++ b/setup/class_setupStepLdap.inc
@@ -26,7 +26,10 @@ class setupStepLdap extends setupStep
   var $connect_id = FALSE;
   var $bind_id    = FALSE;
 
-  static function getAttributesInfo()
+  private $lastBase       = '';
+  private $lastConnection = '';
+
+  static function getAttributesInfo ()
   {
     return array(
       'connection' => array(
@@ -128,17 +131,18 @@ class setupStepLdap extends setupStep
         'base', TRUE
       );
     }
+    $this->lastConnection = $this->connection;
+    $this->lastBase       = $this->base;
   }
 
   function save_object()
   {
-    $base       = $this->base;
-    $connection = $this->connection;
     parent::save_object();
-    $this->connection = preg_replace("/\/$/", "", $this->connection);
-    if (($this->base != $base) || ($this->connection != $connection)) {
+    $this->connection = preg_replace('/\/$/', '', $this->connection);
+    if (($this->base != $this->lastBase) || ($this->connection != $this->lastConnection)) {
       $this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) + 1);
-      if ($this->connection != $connection) {
+      $this->lastBase       = $this->base;
+      if ($this->connection != $this->lastConnection) {
         $this->update_base_choices();
       }
     }
diff --git a/setup/class_setupStepMigrate.inc b/setup/class_setupStepMigrate.inc
index d15e505a3..ecffb51fb 100644
--- a/setup/class_setupStepMigrate.inc
+++ b/setup/class_setupStepMigrate.inc
@@ -104,6 +104,11 @@ class StepMigrateDialog extends GenericDialog
   {
     return FALSE;
   }
+
+  public function getInfos ()
+  {
+    return $this->infos;
+  }
 }
 
 class StepMigrateCheck
-- 
GitLab