Skip to content
Snippets Groups Projects
Commit 43e85a9a authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

fixes #2735

Closes #2735

Merge request studip/studip!2670
parent fdbb6001
No related branches found
No related tags found
No related merge requests found
<?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')
)
");
}
}
...@@ -387,12 +387,12 @@ class CourseDate extends SimpleORMap implements PrivacyObject, Event ...@@ -387,12 +387,12 @@ class CourseDate extends SimpleORMap implements PrivacyObject, Event
protected function cbStudipLog($type) protected function cbStudipLog($type)
{ {
if (!$this->metadate_id) { if (!$this->metadate_id) {
if ($type == 'after_create') { if ($type === 'after_create') {
StudipLog::log('SEM_ADD_SINGLEDATE', $this->range_id, $this->getFullname()); 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); $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());
} }
} }
} }
......
...@@ -111,6 +111,7 @@ class LogEvent extends SimpleORMap implements PrivacyObject ...@@ -111,6 +111,7 @@ class LogEvent extends SimpleORMap implements PrivacyObject
'/%user\(%coaffected\)/', '/%user\(%coaffected\)/',
'/%user/', '/%user/',
'/%singledate\(%affected\)/', '/%singledate\(%affected\)/',
'/%singledate\(%coaffected\)/',
'/%semester\(%coaffected\)/', '/%semester\(%coaffected\)/',
'/%plugin\(%coaffected\)/', '/%plugin\(%coaffected\)/',
'/%group\(%coaffected\)/', '/%group\(%coaffected\)/',
......
...@@ -147,9 +147,9 @@ class SingleDate ...@@ -147,9 +147,9 @@ class SingleDate
$after = $this->toString(); $after = $this->toString();
// logging // logging
if ($before) { 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 { } else {
StudipLog::log("SEM_ADD_SINGLEDATE", $this->range_id, $after); StudipLog::log('SEM_ADD_SINGLEDATE', $this->range_id, $this->id, $after);
} }
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment