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:
@@ -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));
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user