u
This commit is contained in:
@@ -261,6 +261,14 @@ export async function importOrders({
|
||||
const rebate = parseGermanFloat(it.rebate ?? it.fRabatt, 0);
|
||||
const comment = cleanValue(it.comment ?? it.cHinweis) || null;
|
||||
|
||||
let shippable = true;
|
||||
if (it.shippable !== undefined && it.shippable !== null && String(it.shippable).trim() !== '') {
|
||||
const s = String(it.shippable).trim().toLowerCase();
|
||||
shippable = s !== '0' && s !== 'false';
|
||||
} else if (/^(summe glätten|shippingcost|versandkosten)$/i.test(name.trim())) {
|
||||
shippable = false;
|
||||
}
|
||||
|
||||
return {
|
||||
sku,
|
||||
name,
|
||||
@@ -269,6 +277,7 @@ export async function importOrders({
|
||||
taxrate,
|
||||
rebate,
|
||||
comment,
|
||||
shippable,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -355,9 +364,15 @@ export async function importOrders({
|
||||
const isShipped = String(m.shipped ?? '').trim() === '1';
|
||||
|
||||
if (isShipped || shippingType) {
|
||||
const shippableLines = lines
|
||||
.filter((l) => l.sku)
|
||||
.map((l) => ({ sku: l.sku, amount: l.amount }));
|
||||
const orderLines = createdOrder?.lines || lines;
|
||||
const shippableLines = orderLines
|
||||
.filter((l) => l.shippable !== false)
|
||||
.map((l) => {
|
||||
if (l.sku) return { sku: l.sku, amount: l.amount };
|
||||
if (l.id) return { orderLineId: l.id, amount: l.amount };
|
||||
return null;
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
if (shippableLines.length > 0) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user