From bd76fddd9df661770d26b19455cb6317e4dfb403 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arne=20Schr=C3=B6der=2C=20M=2E=20A=2E?=
 <schroeder@data-quest.de>
Date: Tue, 5 Nov 2024 16:48:56 +0000
Subject: [PATCH] Resolve "ILIAS-Schnittstelle: Kategorien werden nicht
 angelegt"

Closes #4443

Merge request studip/studip!3229
---
 lib/ilias_interface/ConnectedIlias.php | 12 ++++++++++--
 lib/ilias_interface/IliasSoap.php      | 11 ++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/lib/ilias_interface/ConnectedIlias.php b/lib/ilias_interface/ConnectedIlias.php
index 48eabb7d49a..94c6ad81413 100644
--- a/lib/ilias_interface/ConnectedIlias.php
+++ b/lib/ilias_interface/ConnectedIlias.php
@@ -451,7 +451,11 @@ class ConnectedIlias
         $this->soap_client->setCachingStatus(false);
         $this->soap_client->clearCache();
         if ($delete_user->isConnected() && $delete_user->id && $this->soap_client->lookupUser($delete_user->login)) {
-            $deleted = $this->soap_client->deleteUser($delete_user->id);
+            if (!empty($this->ilias_config['delete_ilias_users'])) {
+                $deleted = $this->soap_client->deleteUser($delete_user->id);
+            } else {
+                $deleted = true;
+            }
             if ($deleted) {
                 $query = "DELETE FROM auth_extern WHERE studip_user_id = ? AND external_user_system_type = ?";
                 $statement = DBManager::get()->prepare($query);
@@ -486,7 +490,11 @@ class ConnectedIlias
 
         $this->soap_client->setCachingStatus(false);
         $this->soap_client->clearCache();
-        $deleted = $this->soap_client->deleteObject($crs_id);
+        if (!empty($this->ilias_config['delete_ilias_courses'])) {
+            $deleted = $this->soap_client->deleteObject($crs_id);
+        } else {
+            $deleted = true;
+        }
         if ($deleted) {
             IliasObjectConnections::DeleteAllConnections($course->id, $this->index);
             return true;
diff --git a/lib/ilias_interface/IliasSoap.php b/lib/ilias_interface/IliasSoap.php
index 645170c647c..7bef42f448d 100644
--- a/lib/ilias_interface/IliasSoap.php
+++ b/lib/ilias_interface/IliasSoap.php
@@ -504,13 +504,10 @@ class IliasSoap extends StudipSoapClient
 
         $xml = "<!DOCTYPE Objects SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_object_0_1.dtd\">
 <Objects>
-  <Object type=\"$type\" obj_id=\"\" >
-    <Title>
-    $title
-    </Title>
-    <Description>
-    $description
-    </Description>
+  <Object type=\"$type\" obj_id=\"\" offline=\"\" >
+    <Title>$title</Title>
+    <Description>$description</Description>
+    <ImportId></ImportId>
   </Object>
 </Objects>";
 
-- 
GitLab