Skip to content
Snippets Groups Projects
Commit c9244d1a authored by David Siegfried's avatar David Siegfried
Browse files

fixes #2735

Closes #2735

Merge request studip/studip!2670
parent 3624e453
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
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());
}
}
}
......
......@@ -111,6 +111,7 @@ class LogEvent extends SimpleORMap implements PrivacyObject
'/%user\(%coaffected\)/',
'/%user/',
'/%singledate\(%affected\)/',
'/%singledate\(%coaffected\)/',
'/%semester\(%coaffected\)/',
'/%plugin\(%coaffected\)/',
'/%group\(%coaffected\)/',
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment