Upload via GUI (340 Dateien)

This commit is contained in:
2026-10-26 21:19:25 +00:00
parent 12699f0918
commit 2452849c74
7 changed files with 42 additions and 12 deletions
@@ -29,6 +29,12 @@ if (array_key_exists('status', $body) && $body['status'] !== $ticket['status'])
api_error(422, 'INVALID_STATUS', 'Der Status ist ungültig.');
}
api_require_permission($staff, in_array($status, ['resolved', 'closed'], true) ? 'close_ticket' : 'reply_ticket', (int) $ticket['department_id']);
if (in_array($status, ['resolved', 'closed'], true)) {
$resolutionCode = trim((string) ($body['resolutionCode'] ?? ''));
if (!isset(ticket_resolution_reasons()[$resolutionCode])) api_error(422, 'RESOLUTION_CODE_REQUIRED', 'Bitte wählen Sie einen Abschlussgrund.');
$updates[] = 'resolution_code = ?'; $params[] = $resolutionCode;
$updates[] = 'resolution_note = ?'; $params[] = trim((string) ($body['resolutionNote'] ?? ''));
}
$updates[] = 'status = ?';
$params[] = $status;
if ($status === 'resolved' && empty($ticket['resolved_at'])) {
@@ -90,6 +96,7 @@ $params[] = $now;
$params[] = $ticket['id'];
$pdo->prepare('UPDATE tickets SET ' . implode(', ', $updates) . ' WHERE id = ?')->execute($params);
if (array_key_exists('status', $body) && $body['status'] !== $ticket['status']) {
ticket_sla_status_transition($pdo, (int) $ticket['id'], (string) $ticket['status'], (string) $body['status'], (int) $staff['id']);
[$label] = status_label((string) $body['status']);
log_activity($pdo, (int) $ticket['id'], (int) $staff['id'], 'Status geändert: ' . $label . ' (Mobile App)');
}