Keep lot drawer open after creation

This commit is contained in:
gitea_admin committed 2026-09-08 15:08:27 +02:00
1 parent a9fa9955d2
commit f8f011f96c
3 files changed
+32 -4

No files matched your search

+1
View File
@@ -122,6 +122,7 @@ try {
$lotNumber === ''
);
sync_open_lot_activation_selection($pdo, $productId);
$preparedLot['next_active'] = is_open_lot_selected_for_activation($pdo, $lotId);
refresh_lager_stock_lot_forecast_for_product($pdo, $productId);
$forecast = get_lager_product_forecast($pdo, $productId);
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]);
+12
View File
@@ -490,6 +490,18 @@ function is_qualified_open_lot(PDO $pdo, int $lotId): bool
return (bool) $stmt->fetchColumn();
}
function is_open_lot_selected_for_activation(PDO $pdo, int $lotId): bool
{
$stmt = $pdo->prepare(
"SELECT next_active
FROM stock_lot
WHERE id = :lot_id
AND status = 'open'"
);
$stmt->execute([':lot_id' => $lotId]);
return (bool) $stmt->fetchColumn();
}
function sync_open_lot_activation_selection(PDO $pdo, int $productId): void
{
$lockStmt = $pdo->prepare(