Bestellungen-Drawer mit Artikeln und Chargen erweitern

This commit is contained in:
gitea_admin committed 2026-09-06 10:27:54 +02:00
1 parent e43b5d34e0
commit 575650a7f0
3 files changed
+197 -40

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../../../modules/shared/db.php';
require_once __DIR__ . '/../../../modules/shared/auth/service.php';
require_once __DIR__ . '/../../../modules/erp/bestellungen/service.php';
header('Content-Type: application/json; charset=utf-8');
$env = expand_env_values(parse_env_file(__DIR__ . '/../../../.env'));
$pdo = connect_database($env);
auth_bootstrap_session();
if (auth_current_user($pdo) === null) {
http_response_code(401);
echo json_encode(['ok' => false, 'error' => 'Unauthorized']);
exit;
}
$orderId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
if (!is_int($orderId) || $orderId <= 0) {
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'Invalid order id']);
exit;
}
$detail = get_sales_order_detail($pdo, $orderId);
if ($detail === null) {
http_response_code(404);
echo json_encode(['ok' => false, 'error' => 'Order not found']);
exit;
}
echo json_encode(['ok' => true, 'order' => $detail], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);