From 66308dbc88525f06cb4fb7923b354bcd5e558e42 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Wed, 12 Oct 2022 12:42:46 +0000 Subject: [PATCH] change default value of configuration MY_INSTITUTES_DEFAULT to all, fixes #1656 Closes #1656 Merge request studip/studip!1067 --- app/controllers/admin/courses.php | 4 ---- ...iguration_my_institutes_default_to_all.php | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 db/migrations/5.1.35_set_configuration_my_institutes_default_to_all.php diff --git a/app/controllers/admin/courses.php b/app/controllers/admin/courses.php index 711494a4ed0..e832628003e 100644 --- a/app/controllers/admin/courses.php +++ b/app/controllers/admin/courses.php @@ -291,10 +291,6 @@ class Admin_CoursesController extends AuthenticatedController PageLayout::postError(_('Sie wurden noch keiner Einrichtung zugeordnet')); } - if (!$GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT) { - $GLOBALS['user']->cfg->store('MY_INSTITUTES_DEFAULT', $this->insts[0]['Institut_id']); - } - // Semester selection if ($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE) { $this->semester = Semester::find($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE); diff --git a/db/migrations/5.1.35_set_configuration_my_institutes_default_to_all.php b/db/migrations/5.1.35_set_configuration_my_institutes_default_to_all.php new file mode 100644 index 00000000000..d0a9ba4297e --- /dev/null +++ b/db/migrations/5.1.35_set_configuration_my_institutes_default_to_all.php @@ -0,0 +1,24 @@ +<?php + +/** + * @author Jan-Hendrik Willms <tleilax+studip@gmail.com> + * @license GPL2 or any later version + * + * @see https://develop.studip.de/trac/ticket/7058 + * @see https://gitlab.studip.de/studip/studip/-/issues/1656 + */ +final class SetConfigurationMyInstitutesDefaultToAll extends Migration +{ + public function description() + { + return 'Changes the default value of configuration MY_INSTITUTES_DEFAULT to "all"'; + } + + protected function up() + { + $query = "UPDATE `config` + SET `value` = 'all' + WHERE `field` = 'MY_INSTITUTES_DEFAULT'"; + DBManager::get()->exec($query); + } +} -- GitLab