Fix stock-out boot, transfer 500, Clear buttons and uncaught engine errors

Return JSON from any uncaught engine exception, stop the empty stock-out warehouse list aborting page boot, reject non-transfer rows in the transfer lookup, define the missing reset_input helper, and remove a stale unreferenced copy of confirm_order.php.
This commit is contained in:
Thanakorn
2026-09-18 20:21:34 +07:00
parent c60b705d98
commit 033846dece
8 changed files with 90 additions and 54 deletions
+20 -4
View File
@@ -17,11 +17,27 @@
$answer['output'] = $wh->getWarehouseList($type, $sku, $id);
}
if (empty($answer['output'])) {
if (!empty($answer['output'])) {
$answer['success'] = 1;
} elseif ($type === 'from' && !$id && $sku === '') {
// A source ("from") list is filtered to warehouses holding the chosen
// product, so it is empty until a product has been picked. That is the
// normal starting state of a stock-out form, not a failure. Reporting
// it as one showed "create your first warehouse" on every fresh
// stock-out, and the rejected request aborted the page's boot sequence
// before the barcode scanner was initialised.
$answer['success'] = 1;
} elseif ($type === 'from' && $sku !== '') {
$answer['success'] = 0;
$answer['message'] = $lot
? 'No approved stock of this product and lot is available in any warehouse.'
: 'No approved stock of this product is available in any warehouse.';
} else {
$answer['success'] = 0;
$answer['message'] = 'No warehouse found. Please go to <b>Inventory → Warehouse</b> to create your first warehouse before using this page.';
} else {
$answer['success'] = 1;
}
exit(json_encode($answer));
?>
?>