Module tasks + knowledgecenter_update aus Kundenprojekt übernehmen (bereinigt)
Beide Module wurden aus einem anderen Kundenprojekt kopiert und bereinigt: Knowledgecenter: - Bild-Cache (1.985 Dateien) geleert, Ordnerstruktur mit .gitkeep behalten - Files-Gallery-Lizenzschlüssel entfernt (config.php) - Kundenspezifische Kategorien gelöscht: Teil I/II/III QM-Struktur, nummerierte QM-Kapitel, Gremien (Präsidium/Finanzausschuss/Landesausschuss), Sitzungsservice-Serie, Protokoll-Abteilungen, Testeinträge - 56 generische Kategorien bleiben (Downloads, Onboarding, Personalthemen …) Tasks: - Alle Betriebsdaten gelöscht (114 Tasks, 914 Submissions, 579 Assignments) - Task-Definitionen und Verlinkungen geleert - Kategoriestruktur bleibt (Allgemein, IT, Personal, Buchhaltung …) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
58
module/tasks/repo/TaskChangeLogRepository.php
Normal file
58
module/tasks/repo/TaskChangeLogRepository.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
class TaskChangeLogRepository
|
||||
{
|
||||
public function create(
|
||||
int $taskId,
|
||||
string $action,
|
||||
int $changedBy,
|
||||
?array $beforeSnapshot,
|
||||
?array $afterSnapshot,
|
||||
?array $diff
|
||||
): int {
|
||||
return TaskCertDb::insert(
|
||||
'INSERT INTO task_change_log (
|
||||
task_id,
|
||||
action,
|
||||
changed_by,
|
||||
before_json,
|
||||
after_json,
|
||||
diff_json
|
||||
) VALUES (?, ?, ?, ?, ?, ?)',
|
||||
'isisss',
|
||||
[
|
||||
$taskId,
|
||||
$action,
|
||||
$changedBy,
|
||||
$this->encodeJsonOrNull($beforeSnapshot),
|
||||
$this->encodeJsonOrNull($afterSnapshot),
|
||||
$this->encodeJsonOrNull($diff),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function listByTask(int $taskId, int $limit = 100): array
|
||||
{
|
||||
$limit = max(1, min(1000, $limit));
|
||||
|
||||
return TaskCertDb::fetchAll(
|
||||
'SELECT *
|
||||
FROM task_change_log
|
||||
WHERE task_id = ?
|
||||
ORDER BY id DESC
|
||||
LIMIT ' . $limit,
|
||||
'i',
|
||||
[$taskId]
|
||||
);
|
||||
}
|
||||
|
||||
private function encodeJsonOrNull(?array $value): ?string
|
||||
{
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user