Ermoegliche Bearbeitung offener Chargen

This commit is contained in:
gitea_admin committed 2026-09-06 14:14:40 +02:00
1 parent 60e94c7560
commit 0e7c5e51d5
2 files changed
+34 -6

No files matched your search

+16 -1
View File
@@ -71,7 +71,22 @@ try {
if ($lotNumber === '') {
throw new InvalidArgumentException('Naurua-Chargennummer fehlt');
}
$lotId = get_or_create_open_lot($pdo, $productId);
$lotId = (int) ($data['lotId'] ?? 0);
if ($lotId > 0) {
$lotStmt = $pdo->prepare(
"SELECT id
FROM stock_lot
WHERE id = :lot_id
AND product_id = :product_id
AND status = 'open'"
);
$lotStmt->execute([':lot_id' => $lotId, ':product_id' => $productId]);
if ($lotStmt->fetchColumn() === false) {
throw new InvalidArgumentException('Offene Charge nicht gefunden');
}
} else {
$lotId = get_or_create_open_lot($pdo, $productId);
}
$manufacturerPartyId = $data['manufacturerPartyId'] ?? null;
$manufacturerPartyId = $manufacturerPartyId === null || $manufacturerPartyId === '' ? null : (int) $manufacturerPartyId;
$receiptQty = isset($data['receiptQty']) && $data['receiptQty'] !== '' ? (float) $data['receiptQty'] : 0.0;