Upload via GUI (396 Dateien)
This commit is contained in:
@@ -44,6 +44,35 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
redirect('/staff/customer_profile.php?email=' . urlencode($guestEmail));
|
||||
}
|
||||
|
||||
if ($action === 'gdpr_export' || $action === 'gdpr_erase') {
|
||||
if ($staff['role'] !== 'admin' || !gdpr_tools_enabled()) {
|
||||
flash('error', 'Die Datenschutz-Werkzeuge sind nicht verfügbar (nur Administratoren, in den Einstellungen einzuschalten).');
|
||||
redirect($isGuest ? '/staff/customer_profile.php?email=' . urlencode($guestEmail) : '/staff/customer_profile.php?id=' . $userId);
|
||||
}
|
||||
$ref = $isGuest ? ['email' => $guestEmail] : ['user_id' => $userId];
|
||||
if ($action === 'gdpr_export') {
|
||||
$data = gdpr_customer_export($pdo, $ref);
|
||||
audit_log($staff['id'], 'Kundendaten exportiert (' . ($isGuest ? 'Gast ' . $guestEmail : 'Kunde #' . $userId) . ')');
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="kundendaten-' . ($isGuest ? 'gast' : $userId) . '-' . date('Ymd') . '.json"');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
exit;
|
||||
}
|
||||
if (trim((string) ($_POST['confirm_email'] ?? '')) !== (string) $customer['email']) {
|
||||
flash('error', 'Zur Bestätigung muss die E-Mail-Adresse des Kunden genau eingegeben werden.');
|
||||
redirect($isGuest ? '/staff/customer_profile.php?email=' . urlencode($guestEmail) : '/staff/customer_profile.php?id=' . $userId);
|
||||
}
|
||||
$res = gdpr_customer_erase($pdo, $ref, !empty($_POST['force']));
|
||||
if ($res['error']) {
|
||||
flash('error', $res['error']);
|
||||
redirect($isGuest ? '/staff/customer_profile.php?email=' . urlencode($guestEmail) : '/staff/customer_profile.php?id=' . $userId);
|
||||
}
|
||||
audit_log($staff['id'], 'Kundendaten gelöscht (' . ($isGuest ? 'Gast' : 'Kunde #' . $userId) . '): ' . $res['tickets'] . ' Ticket(s) anonymisiert, ' . $res['messages'] . ' Nachricht(en) und ' . $res['files'] . ' Datei(en) entfernt');
|
||||
flash('success', 'Kundendaten gelöscht: ' . $res['tickets'] . ' Ticket(s) anonymisiert, ' . $res['messages'] . ' Nachricht(en) und ' . $res['files'] . ' Datei(en) entfernt.');
|
||||
redirect('/staff/customers.php');
|
||||
}
|
||||
|
||||
if ($action === 'add_note') {
|
||||
$note = trim($_POST['note'] ?? '');
|
||||
if ($note !== '') {
|
||||
@@ -219,6 +248,27 @@ require __DIR__ . '/_header.php';
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($staff['role'] === 'admin' && gdpr_tools_enabled()): ?>
|
||||
<div class="card" style="padding:16px 18px;margin-top:16px">
|
||||
<div style="font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:8px">Datenschutz (DSGVO)</div>
|
||||
<form method="post" style="margin-bottom:12px">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="action" value="gdpr_export">
|
||||
<button type="submit" class="btn secondary" style="width:100%;justify-content:center">Alle Daten exportieren (JSON)</button>
|
||||
<p class="muted" style="font-size:.76rem;margin-top:6px">Auskunft: Stammdaten, alle Tickets mit Nachrichten und Anhangsnamen, Notizen. Die Datei bitte vor der Weitergabe prüfen.</p>
|
||||
</form>
|
||||
<form method="post" onsubmit="return confirm('Alle personenbezogenen Daten dieses Kunden unwiderruflich löschen?')">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="action" value="gdpr_erase">
|
||||
<label style="font-size:.78rem" for="gdpr_confirm">Zur Bestätigung die E-Mail-Adresse eingeben</label>
|
||||
<input type="text" id="gdpr_confirm" name="confirm_email" autocomplete="off" placeholder="<?= e($customer['email']) ?>" required>
|
||||
<label style="display:flex;align-items:center;gap:8px;font-weight:400;font-size:.8rem;margin-top:8px"><input type="checkbox" name="force" value="1" style="width:auto"> Auch bei noch offenen Tickets löschen</label>
|
||||
<button type="submit" class="btn" style="width:100%;justify-content:center;margin-top:10px;background:var(--danger,#dc2626)">Kundendaten löschen</button>
|
||||
<p class="muted" style="font-size:.76rem;margin-top:6px">Tickets bleiben als anonymisierte Einträge (Nummer, Betreff, Status, Zeiten). Nachrichten und Dateien des Kunden, Notizen und das Konto werden entfernt.</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user