diff --git a/db/migrations/5.1.54_fix_single_date_logging.php b/db/migrations/5.1.54_fix_single_date_logging.php new file mode 100644 index 0000000000000000000000000000000000000000..d35c20ae5efa45c8625802c5026967425913fc59 --- /dev/null +++ b/db/migrations/5.1.54_fix_single_date_logging.php @@ -0,0 +1,24 @@ +<?php + +final class FixSingleDateLogging extends Migration +{ + public function description() + { + return 'Fix broken SingleDate-Logging'; + } + + public function up() + { + DBManager::get()->exec("UPDATE `log_actions` SET `info_template`= '%user hat in %sem(%affected) den Einzeltermin %singledate(%coaffected) geändert.' WHERE `name` = 'SINGLEDATE_CHANGE_TIME'"); + DBManager::get()->exec("UPDATE `log_actions` SET `info_template`= '%user hat in %sem(%affected) den Einzeltermin %singledate(%coaffected) hinzugefügt' WHERE `name` = 'SEM_ADD_SINGLEDATE'"); + + DBManager::get()->exec(" + UPDATE `log_events` + SET `dbg_info` = `info`, `info` = `coaffected_range_id`, `coaffected_range_id` = null + WHERE `action_id` IN ( + SELECT `action_id` FROM `log_actions` WHERE `name` IN ('SINGLEDATE_CHANGE_TIME', 'SEM_ADD_SINGLEDATE') + ) + "); + } + +} diff --git a/lib/models/CourseDate.class.php b/lib/models/CourseDate.class.php index 21ef00ea6d1adaba9555d8421ef02ca78806b6cc..ac0c8c384fa8b6dbd388c268fec9543e815698b8 100644 --- a/lib/models/CourseDate.class.php +++ b/lib/models/CourseDate.class.php @@ -387,12 +387,12 @@ class CourseDate extends SimpleORMap implements PrivacyObject, Event protected function cbStudipLog($type) { if (!$this->metadate_id) { - if ($type == 'after_create') { - StudipLog::log('SEM_ADD_SINGLEDATE', $this->range_id, $this->getFullName()); + if ($type === 'after_create') { + StudipLog::log('SEM_ADD_SINGLEDATE', $this->range_id, $this->id, $this->getFullName()); } - if ($type == 'before_store' && !$this->isNew() && ($this->isFieldDirty('date') || $this->isFieldDirty('end_time'))) { + if ($type === 'before_store' && !$this->isNew() && ($this->isFieldDirty('date') || $this->isFieldDirty('end_time'))) { $old_entry = self::build($this->content_db); - StudipLog::log('SINGLEDATE_CHANGE_TIME', $this->range_id, $this->getFullName(), $old_entry->getFullName() . ' -> ' . $this->getFullName()); + StudipLog::log('SINGLEDATE_CHANGE_TIME', $this->range_id, $this->id, $old_entry->getFullName() . ' -> ' . $this->getFullName()); } } } diff --git a/lib/models/LogEvent.php b/lib/models/LogEvent.php index 8be1f74b8407dbb9889ca3458a5932ada4fe3ff3..782157a5841046033c4e3f23184dfe0e1b93a573 100644 --- a/lib/models/LogEvent.php +++ b/lib/models/LogEvent.php @@ -111,6 +111,7 @@ class LogEvent extends SimpleORMap implements PrivacyObject '/%user\(%coaffected\)/', '/%user/', '/%singledate\(%affected\)/', + '/%singledate\(%coaffected\)/', '/%semester\(%coaffected\)/', '/%plugin\(%coaffected\)/', '/%group\(%coaffected\)/', diff --git a/lib/raumzeit/SingleDate.class.php b/lib/raumzeit/SingleDate.class.php index f998092442591eee51d002c4eafbe2936038b644..82a89db6852cda2e10533efa4d99e01716aa412c 100644 --- a/lib/raumzeit/SingleDate.class.php +++ b/lib/raumzeit/SingleDate.class.php @@ -147,9 +147,9 @@ class SingleDate $after = $this->toString(); // logging if ($before) { - StudipLog::log("SINGLEDATE_CHANGE_TIME", $this->range_id, $before, $before . ' -> ' . $after); + StudipLog::log('SINGLEDATE_CHANGE_TIME', $this->range_id, $this->id, $before . ' -> ' . $after); } else { - StudipLog::log("SEM_ADD_SINGLEDATE", $this->range_id, $after); + StudipLog::log('SEM_ADD_SINGLEDATE', $this->range_id, $this->id, $after); } return true;