Upload via GUI (290 Dateien)
This commit is contained in:
@@ -121,4 +121,9 @@ $summary['customFields'] = array_map(fn($r) => [
|
||||
'type' => (string) $r['field_type'],
|
||||
'value' => $r['field_type'] === 'checkbox' ? ($r['value'] ? 'Ja' : 'Nein') : (string) $r['value'],
|
||||
], $cfStmt->fetchAll());
|
||||
try {
|
||||
$summary['similar'] = ticket_similar($pdo, $ticket, staff_department_ids($staff));
|
||||
} catch (Throwable $e) {
|
||||
$summary['similar'] = ['articles' => [], 'tickets' => []];
|
||||
}
|
||||
api_json(['ticket' => $summary]);
|
||||
|
||||
@@ -11,7 +11,8 @@ if ($number === '') {
|
||||
}
|
||||
$pdo = get_db();
|
||||
$ticket = api_find_ticket($pdo, $staff, $number);
|
||||
if ($ticket['source'] !== 'chat') {
|
||||
// Wiedervorlage und Beobachten sind unabhängig von der Bearbeitungssperre
|
||||
if ($ticket['source'] !== 'chat' && (array_key_exists('status', $body) || array_key_exists('assignedStaffId', $body))) {
|
||||
$lockedByName = ticket_locked_by_other($ticket, (int) $staff['id'], $pdo);
|
||||
if ($lockedByName) {
|
||||
api_error(409, 'TICKET_LOCKED', "Dieses Ticket wird gerade von \"$lockedByName\" bearbeitet.");
|
||||
@@ -63,8 +64,26 @@ if (array_key_exists('assignedStaffId', $body)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Wiedervorlage ("snoozeUntil": Datum/Uhrzeit oder null zum Aufheben) und Beobachten ("following": true/false)
|
||||
if (array_key_exists('snoozeUntil', $body)) {
|
||||
if ($body['snoozeUntil'] === null || $body['snoozeUntil'] === '') {
|
||||
ticket_snooze_clear($pdo, (int) $ticket['id'], (int) $staff['id'], 'Wiedervorlage aufgehoben (Mobile App)');
|
||||
} else {
|
||||
$until = date('Y-m-d H:i:s', (int) strtotime((string) $body['snoozeUntil']));
|
||||
$untilTs = strtotime($until);
|
||||
if ($untilTs <= time() + 30 || $untilTs > time() + 366 * 86400) {
|
||||
api_error(422, 'INVALID_SNOOZE', 'Die Wiedervorlage muss in der Zukunft liegen (höchstens 1 Jahr).');
|
||||
}
|
||||
ticket_snooze_set($pdo, (int) $ticket['id'], (int) $staff['id'], $until);
|
||||
}
|
||||
}
|
||||
if (array_key_exists('following', $body)) {
|
||||
if (!empty($body['following'])) ticket_follow($pdo, (int) $ticket['id'], (int) $staff['id']);
|
||||
else ticket_unfollow($pdo, (int) $ticket['id'], (int) $staff['id']);
|
||||
}
|
||||
|
||||
if (!$updates) {
|
||||
api_json(['ticket' => api_ticket_summary($ticket)]);
|
||||
api_json(['ticket' => api_ticket_summary(api_find_ticket($pdo, $staff, $number))]);
|
||||
}
|
||||
$updates[] = 'updated_at = ?';
|
||||
$params[] = $now;
|
||||
|
||||
@@ -15,6 +15,13 @@ if ($departmentFilter !== '') {
|
||||
array_push($params, ...$departmentParams);
|
||||
}
|
||||
|
||||
// Wiedervorlage: ausgeblendet, außer mit ?snoozed=1 (dann nur diese)
|
||||
$where[] = !empty($_GET['snoozed']) ? (ticket_snooze_available() ? "t.snoozed_until > '" . db_now() . "'" : '1=0') : ticket_not_snoozed_sql('t');
|
||||
// Beobachtet: nur Tickets, die der angemeldete Mitarbeiter beobachtet (?following=1)
|
||||
if (!empty($_GET['following'])) {
|
||||
$where[] = 't.id IN (SELECT ticket_id FROM ticket_followers WHERE staff_id = ?)';
|
||||
$params[] = (int) $staff['id'];
|
||||
}
|
||||
$statuses = array_values(array_filter(
|
||||
array_map('trim', explode(',', (string) ($_GET['status'] ?? 'open,pending,answered,on_hold'))),
|
||||
fn(string $status) => in_array($status, MOBILE_API_STATUSES, true)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/common.php';
|
||||
require_once __DIR__ . '/../../../includes/web_handoff.php';
|
||||
|
||||
api_require_method('GET', 'POST');
|
||||
$staff = api_require_staff();
|
||||
$pdo = get_db();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// Welche Seiten der Weboberfläche darf dieser Mitarbeiter über die App öffnen?
|
||||
api_json(['pages' => web_handoff_pages($staff)]);
|
||||
}
|
||||
|
||||
$body = api_request_body();
|
||||
$path = trim((string) ($body['path'] ?? ''));
|
||||
$url = $path !== '' ? web_handoff_create($pdo, $staff, $path) : null;
|
||||
if ($url === null) {
|
||||
api_error(403, 'PAGE_NOT_ALLOWED', 'Diese Seite darf nicht geöffnet werden.');
|
||||
}
|
||||
api_json(['url' => $url]);
|
||||
Reference in New Issue
Block a user