From 6c1e840c97b35221e66035aa4e8ed6148a79f2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Gla=CC=88ser?= Date: Tue, 8 Sep 2026 19:28:36 +0200 Subject: [PATCH] Rollback failed charge creation --- modules/erp/lager/api/lot.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/erp/lager/api/lot.php b/modules/erp/lager/api/lot.php index 08cf1f2..fd4c552 100644 --- a/modules/erp/lager/api/lot.php +++ b/modules/erp/lager/api/lot.php @@ -112,6 +112,7 @@ try { $purchaseDate = trim((string) ($data['purchaseDate'] ?? '')); $receiptQty = isset($data['receiptQty']) && $data['receiptQty'] !== '' ? (float) $data['receiptQty'] : 0.0; $targetQty = isset($data['targetQty']) && $data['targetQty'] !== '' ? (float) $data['targetQty'] : null; + $pdo->beginTransaction(); if ($lotId > 0) { $lotStmt = $pdo->prepare( "SELECT id @@ -152,6 +153,7 @@ try { } refresh_lager_stock_lot_forecast_for_product($pdo, $productId); $forecast = get_lager_product_forecast($pdo, $productId); + $pdo->commit(); json_response(200, ['ok' => true, 'productId' => $productId, 'lot' => $preparedLot, 'balance' => get_stock_lot_balance($pdo, $lotId), 'availableQty' => get_lager_product_available_qty($pdo, $productId), 'forecast' => $forecast]); }