Upload via GUI (267 Dateien)
This commit is contained in:
@@ -90,4 +90,24 @@ $summary['permissions'] = [];
|
||||
foreach (['reply_ticket', 'post_note', 'close_ticket', 'assign_ticket', 'transfer_ticket', 'delete_ticket'] as $__perm) {
|
||||
$summary['permissions'][$__perm] = has_permission($staff, $__perm, (int) $ticket['department_id']);
|
||||
}
|
||||
// Signaturen zur Auswahl beim Antworten (eigene / Abteilung / keine) als Klartext mit Hinweis auf Bilder
|
||||
$sigOptions = reply_signature_options($pdo, $staff, (int) $ticket['department_id']);
|
||||
$sigEntry = fn(string $html) => ['available' => $html !== '', 'text' => api_plain_text($html), 'html' => $html, 'hasImage' => stripos($html, '<img') !== false, 'imageUrl' => api_first_image_url($html)];
|
||||
$summary['replySignatures'] = [
|
||||
'default' => $sigOptions['default'],
|
||||
'own' => $sigEntry($sigOptions['own']),
|
||||
'department' => $sigEntry($sigOptions['dept']) + ['name' => $sigOptions['deptName']],
|
||||
];
|
||||
// Zusatzfelder des Tickets (vom Kunden im Formular ausgefüllt), in der Reihenfolge des Formulars
|
||||
$cfStmt = $pdo->prepare(
|
||||
'SELECT cf.label, cf.field_type, v.value FROM ticket_field_values v
|
||||
JOIN custom_fields cf ON cf.id = v.custom_field_id
|
||||
WHERE v.ticket_id = ? ORDER BY cf.sort_order, cf.label'
|
||||
);
|
||||
$cfStmt->execute([(int) $ticket['id']]);
|
||||
$summary['customFields'] = array_map(fn($r) => [
|
||||
'label' => (string) $r['label'],
|
||||
'type' => (string) $r['field_type'],
|
||||
'value' => $r['field_type'] === 'checkbox' ? ($r['value'] ? 'Ja' : 'Nein') : (string) $r['value'],
|
||||
], $cfStmt->fetchAll());
|
||||
api_json(['ticket' => $summary]);
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/common.php';
|
||||
|
||||
api_require_method('POST');
|
||||
$staff = api_require_staff();
|
||||
$body = api_request_body();
|
||||
$number = trim((string) ($body['number'] ?? ''));
|
||||
$type = (string) ($body['type'] ?? '');
|
||||
$message = (string) ($body['message'] ?? '');
|
||||
$setStatus = isset($body['setStatus']) ? (string) $body['setStatus'] : null;
|
||||
if ($number === '') {
|
||||
api_error(422, 'TICKET_NUMBER_REQUIRED', 'Eine Ticketnummer ist erforderlich.');
|
||||
}
|
||||
$pdo = get_db();
|
||||
$ticket = api_find_ticket($pdo, $staff, $number);
|
||||
$threadId = api_add_ticket_message($pdo, $staff, $ticket, $type, $message, $setStatus);
|
||||
api_json(['threadId' => $threadId], 201);
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/common.php';
|
||||
|
||||
api_require_method('POST');
|
||||
$staff = api_require_staff();
|
||||
$body = api_request_body();
|
||||
$number = trim((string) ($body['number'] ?? ''));
|
||||
$type = (string) ($body['type'] ?? '');
|
||||
$message = (string) ($body['message'] ?? '');
|
||||
$setStatus = isset($body['setStatus']) ? (string) $body['setStatus'] : null;
|
||||
// Optional: welche Signatur angehängt wird (own = eigene, dept = Abteilung, none = keine); ohne Angabe eigene, ersatzweise Abteilung
|
||||
$signatureChoice = isset($body['signature']) && in_array($body['signature'], ['own', 'dept', 'none'], true) ? (string) $body['signature'] : null;
|
||||
if ($number === '') {
|
||||
api_error(422, 'TICKET_NUMBER_REQUIRED', 'Eine Ticketnummer ist erforderlich.');
|
||||
}
|
||||
$pdo = get_db();
|
||||
$ticket = api_find_ticket($pdo, $staff, $number);
|
||||
$threadId = api_add_ticket_message($pdo, $staff, $ticket, $type, $message, $setStatus, $signatureChoice);
|
||||
api_json(['threadId' => $threadId], 201);
|
||||
|
||||
@@ -19,7 +19,7 @@ $pdo = get_db();
|
||||
|
||||
const RULE_FIELDS = ['subject' => 'Betreff', 'message' => 'Nachricht', 'requester_email' => 'Absender-E-Mail', 'requester_name' => 'Absender-Name', 'source' => 'Kanal (web/email)'];
|
||||
const RULE_OPERATORS = ['contains' => 'enthält', 'not_contains' => 'enthält nicht', 'equals' => 'ist genau', 'starts_with' => 'beginnt mit', 'ends_with' => 'endet mit'];
|
||||
const RULE_ACTIONS = ['set_department' => 'Abteilung setzen', 'set_priority' => 'Priorität setzen', 'set_help_topic' => 'Hilfe-Thema setzen', 'assign_staff' => 'Mitarbeiter zuweisen', 'add_tag' => 'Tag hinzufügen', 'auto_reply' => 'Auto-Antwort senden', 'reject' => 'Ticket verwerfen (z.B. Spam)'];
|
||||
const RULE_ACTIONS = ['set_department' => 'Abteilung setzen', 'set_priority' => 'Priorität setzen', 'set_help_topic' => 'Hilfe-Thema setzen', 'assign_staff' => 'Mitarbeiter zuweisen', 'add_tag' => 'Tag hinzufügen', 'auto_reply' => 'Auto-Antwort senden', 'close' => 'Ticket schließen', 'reject' => 'Ticket verwerfen (z.B. Spam)'];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$departments = departments_for_select($pdo, array_map('intval', $pdo->query("SELECT action_value FROM ticket_rule_actions WHERE action_type = 'set_department'")->fetchAll(PDO::FETCH_COLUMN)));
|
||||
@@ -54,7 +54,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
'assign_staff' => $staffById[$value] ?? null,
|
||||
'auto_reply' => $cannedById[$value] ?? null,
|
||||
'add_tag' => $value,
|
||||
'reject' => null,
|
||||
'reject', 'close' => null,
|
||||
default => null,
|
||||
};
|
||||
$actionsOut[] = ['type' => $type, 'value' => $value, 'valueLabel' => $label];
|
||||
@@ -138,8 +138,9 @@ if ($action === 'save') {
|
||||
foreach ($rawActions as $a) {
|
||||
$type = (string) ($a['type'] ?? '');
|
||||
if (!isset(RULE_ACTIONS[$type])) continue;
|
||||
$value = $type === 'reject' ? '1' : trim((string) ($a['value'] ?? ''));
|
||||
if ($type !== 'reject' && $value === '') continue;
|
||||
$noValue = in_array($type, ['reject', 'close'], true);
|
||||
$value = $noValue ? '1' : trim((string) ($a['value'] ?? ''));
|
||||
if (!$noValue && $value === '') continue;
|
||||
$actionsToSave[] = ['type' => $type, 'value' => $value];
|
||||
}
|
||||
if (!$actionsToSave) api_error(422, 'ACTIONS_REQUIRED', 'Bitte mindestens eine Aktion festlegen.');
|
||||
|
||||
Reference in New Issue
Block a user