Upload via GUI (396 Dateien)

This commit is contained in:
2026-11-04 07:56:02 +00:00
parent fad8536292
commit 3a408cd8dc
3 changed files with 56 additions and 1 deletions
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../../../includes/mail_fetch_manual.php';
/**
* E-Mail-Abruf von Hand starten (wie der Knopf in der Ticketliste der Weboberfläche). POST ohne Inhalt.
* Antwort: ok (ohne Fehler), level (success|info|error), message (fertiger Text), processed, newTickets, replies, errors.
*/
api_require_method('POST');
$staff = api_require_staff();
$pdo = get_db();
$r = mail_fetch_manual($pdo);
audit_log((int) $staff['id'], 'E-Mail-Abruf von Hand gestartet über die App (' . $r['processed'] . ' E-Mail(s))');
api_json([
'ok' => $r['ok'],
'level' => $r['level'],
'message' => $r['message'],
'processed' => $r['processed'],
'newTickets' => $r['new_tickets'],
'replies' => $r['replies'],
'errors' => $r['errors'],
'available' => mail_fetch_available($pdo),
]);
+4 -1
View File
@@ -40,8 +40,9 @@ $threadStmt = $pdo->prepare(
ORDER BY tt.created_at ASC, tt.id ASC'
);
$threadStmt->execute([$ticket['id']]);
// Eingebettete Bilder einer Mail (Logos, Fotos im Text) gehören zur Darstellung der Nachricht und sind keine Anhänge
$attachmentStmt = $pdo->prepare(
'SELECT id, original_name, filesize FROM ticket_attachments WHERE thread_id = ? ORDER BY id'
'SELECT id, original_name, filesize FROM ticket_attachments WHERE thread_id = ?' . (ticket_mail_html_ready($pdo) ? ' AND COALESCE(is_inline, 0) = 0' : '') . ' ORDER BY id'
);
$commentStmt = $pdo->prepare(
'SELECT tc.id, tc.message, tc.created_at, s.id AS staff_id, s.name AS staff_name
@@ -88,6 +89,8 @@ if ($ticket['source'] === 'chat' && $ticket['status'] !== 'closed') {
}
}
ticket_ack($pdo, (int) $ticket['id'], (int) $staff['id']); // gesehen: verschwindet aus dem Zähler der Apps
$summary = api_ticket_summary($ticket);
$summary['source'] = $ticket['source'];
$summary['firstResponseDueAt'] = $ticket['first_response_due_at'];
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../../../includes/mail_reload.php';
/**
* Lädt Anhänge, eingebettete Bilder und die Formatierung der Original-E-Mail eines Tickets nach (wie der Knopf im Ticket der
* Weboberfläche). POST {"number": "260101-0001"}.
*/
api_require_method('POST');
$staff = api_require_staff();
$body = api_request_body();
$number = trim((string) ($body['number'] ?? ''));
if ($number === '') api_error(422, 'TICKET_NUMBER_REQUIRED', 'Eine Ticketnummer ist erforderlich.');
$pdo = get_db();
$ticket = api_find_ticket($pdo, $staff, $number);
api_require_permission($staff, 'reply_ticket', (int) $ticket['department_id']);
if ($ticket['source'] !== 'email') api_error(422, 'EMAIL_TICKET_REQUIRED', 'Nur E-Mail-Tickets haben eine Original-E-Mail.');
$r = reload_ticket_mail_attachments($pdo, $ticket, (int) $staff['id']);
if ($r['error']) api_error(422, 'MAIL_RELOAD_FAILED', $r['error']);
api_json([
'added' => $r['added'],
'inlineImages' => $r['inline'],
'formatting' => $r['html'] > 0,
'skipped' => $r['skipped'],
'alreadyThere' => $r['existing'],
'failed' => $r['failed'],
]);