Added support for Streamdeck Pedal and updated UI to better fit the Packed UI style

This commit is contained in:
2026-02-27 22:47:08 +01:00
committed by erik
parent 5a70f775f1
commit 93faae5cc8
1463 changed files with 306917 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
require_once __DIR__ . '/../src/config.php';
require_once __DIR__ . '/../src/auth.php';
require_once __DIR__ . '/../src/db.php';
require_once __DIR__ . '/../src/invoice_functions.php';
require_once __DIR__ . '/../src/pdf_functions.php';
require_login();
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if (!$id) {
header('Location: ' . url_for('invoices.php'));
exit;
}
$pdo = get_db();
$stmt = $pdo->prepare("SELECT m.*, i.invoice_number FROM mahnungen m JOIN invoices i ON i.id = m.invoice_id WHERE m.id = :id");
$stmt->execute([':id' => $id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$row) {
header('Location: ' . url_for('invoices.php'));
exit;
}
// PDF vorhanden?
if (empty($row['pdf_path'])) {
archive_mahnung_pdf($id);
// Neu laden
$stmt->execute([':id' => $id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
}
$fullPath = __DIR__ . '/' . ($row['pdf_path'] ?? '');
if (!file_exists($fullPath)) {
http_response_code(404);
echo 'PDF nicht gefunden.';
exit;
}
$safe_name = 'MAHNUNG-' . preg_replace('/[^A-Za-z0-9\-]/', '_', $row['invoice_number']) . '-L' . $row['level'] . '.pdf';
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $safe_name . '"');
header('Content-Length: ' . filesize($fullPath));
readfile($fullPath);
exit;