aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/migrations/5.1.39_remove_resources_enable_expert_schedule_view_configuration.php35
-rw-r--r--lib/models/CourseDate.class.php7
-rw-r--r--lib/raumzeit/CycleDataDB.class.php5
-rw-r--r--lib/raumzeit/MetaDate.class.php2
-rw-r--r--lib/raumzeit/SingleDate.class.php23
5 files changed, 49 insertions, 23 deletions
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 0000000..5c852b2
--- /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 7acbb15..bcfe5c7 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 020919c..eb586b4 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 38a3a3d..7e6fbbd 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 289187f..6740731 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);
}