This commit is contained in:
seb
2026-10-21 03:31:55 +02:00
parent 63f4c3a0e4
commit e4e4d2dcf0
21 changed files with 243 additions and 193 deletions

View File

@@ -538,6 +538,7 @@ export async function executeCompanyExport({
'"net"',
'"taxrate"',
'"sort"',
'"shippable"',
];
const manifestCsvRows = [manifestCsvHeaders.join(';')];
@@ -588,6 +589,7 @@ export async function executeCompanyExport({
formatCsvField(formatGermanFloat(line.net ?? 0)),
formatCsvField(formatGermanFloat(line.taxrate ?? 19)),
formatCsvField(line.sort ?? 0),
formatCsvField(line.shippable !== false ? '1' : '0'),
].join(';'));
}
}

View File

@@ -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 {