Skip to content
Snippets Groups Projects
Commit c2225295 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

remove RESOURCES_ENABLE_EXPERT_SCHEDULE_VIEW for good, fixes #1985

Closes #1985

Merge request studip/studip!1288
parent b8809912
No related branches found
No related tags found
No related merge requests found
<?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);
}
}
......@@ -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()) {
......
......@@ -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;
......
......@@ -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()
......
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment