diff --git a/db/migrations/5.1.39_remove_resources_enable_expert_schedule_view_configuration.php b/db/migrations/5.1.39_remove_resources_enable_expert_schedule_view_configuration.php new file mode 100644 index 0000000000000000000000000000000000000000..5c852b25b4f1d8ca7e7fd73e8021613b469126d5 --- /dev/null +++ b/db/migrations/5.1.39_remove_resources_enable_expert_schedule_view_configuration.php @@ -0,0 +1,35 @@ +<?php +/** + * @see https://gitlab.studip.de/studip/studip/-/issues/1985 + */ +final class RemoveResourcesEnableExpertScheduleViewConfiguration extends Migration +{ + public function description() + { + return 'Removes the configuration RESOURCES_ENABLE_EXPERT_SCHEDULE_VIEW ' + . 'as well as RESOURCES_ALLOW_SEMASSI_SKIP_REQUEST'; + } + + protected function up() + { + $query = "DELETE `config`, `config_values` + FROM `config` + LEFT JOIN `config_values` USING (`field`) + WHERE `field` IN ( + 'RESOURCES_ENABLE_EXPERT_SCHEDULE_VIEW', + 'RESOURCES_ALLOW_SEMASSI_SKIP_REQUEST' + )"; + DBManager::get()->exec($query); + } + + protected function down() + { + $query = "INSERT INTO `config` (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`) + VALUES ('RESOURCES_ENABLE_EXPERT_SCHEDULE_VIEW', '0', 'boolean', 'global', 'resources', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 'Enables the expert view of the course schedules')"; + DBManager::get()->exec($query); + + $query = "INSERT INTO `config` (`field`, `value`,`type`, `range`, `section`, `mkdate`, `chdate`, `description`) + VALUES ('RESOURCES_ALLOW_SEMASSI_SKIP_REQUEST', '1', 'boolean', 'global', 'resources', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 'Schaltet das Pflicht, eine Raumanfrage beim Anlegen einer Veranstaltung machen zu müssen, ein oder aus')"; + DBManager::get()->exec($query); + } +} diff --git a/lib/models/CourseDate.class.php b/lib/models/CourseDate.class.php index 7acbb15149f656c9c1b0ad650d9802895ee53315..bcfe5c743a765ac1f7b42dc5fd54be004b5cf7ae 100644 --- a/lib/models/CourseDate.class.php +++ b/lib/models/CourseDate.class.php @@ -405,12 +405,7 @@ class CourseDate extends SimpleORMap implements PrivacyObject { $warnings = []; if (count($this->topics) > 0) { - if (Config::get()->RESOURCES_ENABLE_EXPERT_SCHEDULE_VIEW) { - $warnings[] = _('Diesem Termin ist im Ablaufplan ein Thema zugeordnet.') . "\n" - . _('Titel und Beschreibung des Themas bleiben erhalten und können in der Expertenansicht des Ablaufplans einem anderen Termin wieder zugeordnet werden.'); - } else { - $warnings[] = _('Diesem Termin ist ein Thema zugeordnet.'); - } + $warnings[] = _('Diesem Termin ist ein Thema zugeordnet.'); } if (Config::get()->RESOURCES_ENABLE && $this->getRoom()) { diff --git a/lib/raumzeit/CycleDataDB.class.php b/lib/raumzeit/CycleDataDB.class.php index 020919c047d1e32f39c19f3fc1f24b67262fd7c7..eb586b419292b4fb8fe4b7bc8c3ca9ddd3165a10 100644 --- a/lib/raumzeit/CycleDataDB.class.php +++ b/lib/raumzeit/CycleDataDB.class.php @@ -130,11 +130,10 @@ class CycleDataDB * * @param string $metadate_id * @param int $timestamp - * @param boolean $keepIssues * * @return int number of deleted singledates */ - public static function deleteNewerSingleDates($metadate_id, $timestamp, $keepIssues = false) + public static function deleteNewerSingleDates($metadate_id, $timestamp) { $count = 0; @@ -145,7 +144,7 @@ class CycleDataDB $statement->execute([$metadate_id, $timestamp]); while ($termin_id = $statement->fetchColumn()) { $termin = new SingleDate($termin_id); - $termin->delete($keepIssues); + $termin->delete(); unset($termin); $count += 1; diff --git a/lib/raumzeit/MetaDate.class.php b/lib/raumzeit/MetaDate.class.php index 38a3a3d8afa44d94b73f4a39462cd25b7e83538a..7e6fbbd2d0b70af3858d20db331750ab2547f232 100644 --- a/lib/raumzeit/MetaDate.class.php +++ b/lib/raumzeit/MetaDate.class.php @@ -279,7 +279,7 @@ class MetaDate $singledate_count++; } // remove all SingleDates in the future for this CycleData - $count = CycleDataDB::deleteNewerSingleDates($data['cycle_id'], time(), true); + $count = CycleDataDB::deleteNewerSingleDates($data['cycle_id'], time()); // create new SingleDates $this->createSingleDates(['metadate_id' => $cycle->getMetaDateId(), 'startAfterTimeStamp' => time() diff --git a/lib/raumzeit/SingleDate.class.php b/lib/raumzeit/SingleDate.class.php index 289187fd58d8a4eda6d8ff448532718eb4e5f5a1..6740731e1be158925cbed5a743ab82ac323386b7 100644 --- a/lib/raumzeit/SingleDate.class.php +++ b/lib/raumzeit/SingleDate.class.php @@ -270,31 +270,28 @@ class SingleDate return $this->metadate_id; } + /** + * @deprecated + */ function killIssue() { - // We delete the issue, cause there is no chance anybody can get to it without the expert view - if (!Config::get()->RESOURCES_ENABLE_EXPERT_SCHEDULE_VIEW) { - if ($issue_ids = $this->getIssueIDs()) { - foreach ($issue_ids as $issue_id) { - // delete this issue - unset($this->issues[$issue_id]); - $issue = new Issue(['issue_id' => $issue_id]); - $issue->delete(); - } + $issue_ids = $this->getIssueIDs(); + if (count($issue_ids) > 0) { + CourseTopic::deleteBySQL("issue_id IN (?)", $issue_ids); + + foreach ($issue_ids as $issue_id) { + unset($this->issues[$issue_id]); } } } - function delete($keepIssues = false) + function delete() { $cache = StudipCacheFactory::getCache(); $cache->expire('course/undecorated_data/' . $this->range_id); $this->chdate = time(); $this->killAssign(); - if (!$keepIssues) { - $this->killIssue(); - } return SingleDateDB::deleteSingleDate($this->termin_id, $this->ex_termin); }