diff options
| -rw-r--r-- | db/migrations/5.1.54_fix_single_date_logging.php | 24 | ||||
| -rw-r--r-- | lib/models/CourseDate.class.php | 8 | ||||
| -rw-r--r-- | lib/models/LogEvent.php | 1 | ||||
| -rw-r--r-- | lib/raumzeit/SingleDate.class.php | 4 |
4 files changed, 31 insertions, 6 deletions
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 0000000..d35c20a --- /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 21ef00e..ac0c8c3 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 8be1f74..782157a 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 f998092..82a89db 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; |
