u
This commit is contained in:
@@ -116,6 +116,7 @@ export async function fetchDeliveryLedgerSummary(deliveryId, { deliveryApi = def
|
||||
* @param {Object} params
|
||||
* @param {Object} params.delivery - The delivery object (used for transaction memo and fallback)
|
||||
* @param {Array<{ manifestarticleId?: number, id?: number, amount: number, sku?: string }>} params.linesToBook
|
||||
* @param {number|string} params.warehouseId - Mandatory warehouse ID
|
||||
* @param {Object} [params.ledgerApi]
|
||||
* @param {string} [params.transactionText]
|
||||
* @returns {Promise<Array<Object>>}
|
||||
@@ -123,9 +124,15 @@ export async function fetchDeliveryLedgerSummary(deliveryId, { deliveryApi = def
|
||||
export async function bookDeliveryLines({
|
||||
delivery,
|
||||
linesToBook,
|
||||
warehouseId,
|
||||
ledgerApi = defaultLedgerApi,
|
||||
transactionText,
|
||||
}) {
|
||||
const numericWarehouseId = Number(warehouseId);
|
||||
if (!numericWarehouseId || numericWarehouseId <= 0) {
|
||||
throw new Error('Bitte wählen Sie ein Lager aus.');
|
||||
}
|
||||
|
||||
if (!Array.isArray(linesToBook) || linesToBook.length === 0) {
|
||||
return [];
|
||||
}
|
||||
@@ -147,6 +154,7 @@ export async function bookDeliveryLines({
|
||||
|
||||
const res = await ledgerApi.add({
|
||||
manifestarticle_id: manifestarticleId,
|
||||
warehouse_id: numericWarehouseId,
|
||||
transaction_type: 'DELIVERY',
|
||||
amount,
|
||||
transaction_text: memo,
|
||||
|
||||
Reference in New Issue
Block a user