$resolution) $errors[] = 'Die Reaktionszeit darf nicht länger als die Lösungszeit sein.'; if (!preg_match('/^#[0-9a-fA-F]{6}$/', $color)) $errors[] = 'Bitte eine gültige Farbe im Format #RRGGBB angeben.'; $dup = $pdo->prepare('SELECT COUNT(*) FROM priorities WHERE LOWER(name) = LOWER(?) AND id <> ?'); $dup->execute([$name, $id]); if ($dup->fetchColumn() > 0) $errors[] = 'Eine Priorität mit diesem Namen existiert bereits.'; if (!$errors) { if ($action === 'create') { $pdo->prepare('INSERT INTO priorities (name, color, response_hours, resolution_hours, sort_order, notes, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?)') ->execute([$name, $color, $response, $resolution, $sort, $notes ?: null, db_now(), db_now()]); audit_log($staff['id'], "Priorität erstellt: {$name}"); flash('success', 'Priorität erstellt.'); } else { $pdo->prepare('UPDATE priorities SET name=?, color=?, response_hours=?, resolution_hours=?, sort_order=?, notes=?, updated_at=? WHERE id=?') ->execute([$name, $color, $response, $resolution, $sort, $notes ?: null, db_now(), $id]); audit_log($staff['id'], "Priorität aktualisiert: {$name}"); flash('success', 'Änderungen gespeichert.'); } redirect('/staff/priorities.php'); } } if ($action === 'delete') { $id = (int) $_POST['id']; $stmt = $pdo->prepare('SELECT COUNT(*) FROM tickets WHERE priority_id = ?'); $stmt->execute([$id]); if ((int) $stmt->fetchColumn() > 0) { flash('error', 'Diese Priorität wird noch von Tickets verwendet und kann nicht gelöscht werden.'); } else { $pdo->prepare('DELETE FROM priorities WHERE id = ?')->execute([$id]); audit_log($staff['id'], "Priorität gelöscht: #{$id}"); flash('success', 'Priorität gelöscht.'); } redirect('/staff/priorities.php'); } } $isNew = isset($_GET['new']); $editId = (int) ($_GET['edit'] ?? 0); $showForm = $isNew || $editId || ($errors && in_array($_POST['action'] ?? '', ['create', 'update'], true)); $priorities = $pdo->query('SELECT p.*, (SELECT COUNT(*) FROM tickets t WHERE t.priority_id = p.id) AS ticket_count FROM priorities p ORDER BY p.sort_order')->fetchAll(); $editPrio = null; if ($editId) { $stmt = $pdo->prepare('SELECT * FROM priorities WHERE id = ?'); $stmt->execute([$editId]); $editPrio = $stmt->fetch() ?: null; } $hours = fn(int $h) => $h >= 24 && $h % 24 === 0 ? ($h / 24) . ' Tag' . ($h / 24 === 1 ? '' : 'e') : $h . ' Std'; $pageTitle = 'Prioritäten / SLA'; $activePage = 'priorities'; require __DIR__ . '/_header.php'; ?>
Reaktions- und Lösungszeit ab Ticketerstellung bzw. Prioritätsänderung. Mit aktivierten Geschäftszeiten zählen nur die dort eingetragenen Öffnungszeiten.
| Priorität | Reaktion | Lösung | Tickets | Erstellt | Zuletzt aktualisiert | |
|---|---|---|---|---|---|---|
| = e($p['name']) ?> | = e($hours((int) $p['response_hours'])) ?> | = e($hours((int) $p['resolution_hours'])) ?> | = (int) $p['ticket_count'] ?> | = e(ui_date($p['created_at'] ?? null)) ?> | = e(ui_date($p['updated_at'] ?? null)) ?> | Bearbeiten · |