From 796233dd7d294f5ff7c6b2547c02b56c5a6533b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Sch=C3=BCttl=C3=B6ffel?=
 <schuettloeffel@zqs.uni-hannover.de>
Date: Thu, 11 May 2023 09:36:46 +0000
Subject: [PATCH] =?UTF-8?q?Resolve=20"Pers=C3=B6nliche=20Angaben:=20Text?=
 =?UTF-8?q?=20sollte=20konfigurierbar=20sein"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2582

Merge request studip/studip!1781
---
 app/views/settings/account/index.php          |  3 +-
 ..._add_personal_details_info_text_config.php | 44 +++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 db/migrations/5.4.4_add_personal_details_info_text_config.php

diff --git a/app/views/settings/account/index.php b/app/views/settings/account/index.php
index f4d7d565fbf..eaa2631a387 100644
--- a/app/views/settings/account/index.php
+++ b/app/views/settings/account/index.php
@@ -8,8 +8,7 @@ $genders = [
 ?>
 
 <? if ($user->auth_plugin !== 'standard'): ?>
-    <?= MessageBox::info(sprintf(_('Einige Ihrer persönlichen Daten werden nicht in Stud.IP verwaltet '
-                                   . 'und können daher hier nicht geändert werden.'))) ?>
+    <?= MessageBox::info(Config::get()->PERSONAL_DETAILS_INFO_TEXT) ?>
 <? endif; ?>
 
 <? if ($locked_info): ?>
diff --git a/db/migrations/5.4.4_add_personal_details_info_text_config.php b/db/migrations/5.4.4_add_personal_details_info_text_config.php
new file mode 100644
index 00000000000..0cf52d8fb2b
--- /dev/null
+++ b/db/migrations/5.4.4_add_personal_details_info_text_config.php
@@ -0,0 +1,44 @@
+<?php
+
+class AddPersonalDetailsInfoTextConfig extends Migration
+{
+    public function description()
+    {
+        return 'Adds the configuration PERSONAL_DETAILS_INFO_TEXT, if it doesn\'t exist yet. Also adds english translation.';
+    }
+
+    protected function up()
+    {
+        $db = DBManager::get();
+
+        $db->exec(
+            "INSERT IGNORE INTO `config`
+             (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`)
+             VALUES
+             (
+                 'PERSONAL_DETAILS_INFO_TEXT', 'Einige Ihrer persönlichen Daten werden nicht in Stud.IP verwaltet und können daher hier nicht geändert werden.',
+                 'i18n', 'global', 'global', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(),
+                 'Der Infotext der unter Profil->Persönliche Angaben->Grunddaten angezeigt wird, wenn man nicht die Standard-Auth nutzt.'
+             )"
+        );
+
+        $db->execute(
+            "INSERT IGNORE INTO `i18n`
+            (`object_id`, `table`, `field`, `lang`, `value`)
+            VALUES
+            (
+                MD5('PERSONAL_DETAILS_INFO_TEXT'), 'config', 'value', 'en_GB',
+                'Some of your personal data is not managed in Stud.IP and therefore cannot be changed here.'
+            )"
+        );
+    }
+
+    protected function down()
+    {
+        $db = DBManager::get();
+
+        $db->exec("DELETE FROM `config_values` WHERE `field` = 'PERSONAL_DETAILS_INFO_TEXT'");
+        $db->exec("DELETE FROM `config` WHERE `field` = 'PERSONAL_DETAILS_INFO_TEXT'");
+        $db->exec("DELETE FROM `i18n` WHERE `object_id` = MD5('PERSONAL_DETAILS_INFO_TEXT') AND `table` = 'config' AND `field` = 'value'");
+    }
+}
-- 
GitLab