u
This commit is contained in:
@@ -82,18 +82,18 @@ export default function adjust(provider) {
|
||||
if (rawWhId == null) {
|
||||
throw new Error(`Warehouse required${itemLabel} (${sku})`);
|
||||
}
|
||||
const warehouseId = Number(rawWhId);
|
||||
if (!Number.isInteger(warehouseId) || warehouseId <= 0) {
|
||||
if (typeof rawWhId !== 'number' || !Number.isInteger(rawWhId) || rawWhId <= 0) {
|
||||
throw new Error(`Warehouse must be a positive integer${itemLabel} (${sku})`);
|
||||
}
|
||||
const warehouseId = rawWhId;
|
||||
|
||||
if (line.amount == null) {
|
||||
throw new Error(`Amount required${itemLabel} (${sku})`);
|
||||
}
|
||||
const amount = Number(line.amount);
|
||||
if (!Number.isFinite(amount) || amount === 0) {
|
||||
if (typeof line.amount !== 'number' || !Number.isFinite(line.amount) || line.amount === 0) {
|
||||
throw new Error(`Invalid amount${itemLabel} (${sku}): must be non-zero number`);
|
||||
}
|
||||
const amount = line.amount;
|
||||
|
||||
const text = (line.text ?? line.transactionText ?? line.transaction_text ?? defaultText)?.trim?.() ||
|
||||
(amount > 0 ? `Manual stock addition (+${amount})` : `Manual stock removal (${amount})`);
|
||||
|
||||
Reference in New Issue
Block a user