From 769185cd82f980f4c8f0c9d8f671fa41840fe103 Mon Sep 17 00:00:00 2001 From: flfeders Date: Mon, 20 Jul 2026 19:35:07 +0200 Subject: [PATCH] Leeren individuellen Aufschlag normalisieren --- backend/src/routes/resources/main.ts | 7 +++++++ frontend/pages/createDocument/edit/[[id]].vue | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/backend/src/routes/resources/main.ts b/backend/src/routes/resources/main.ts index e72036b..419ab42 100644 --- a/backend/src/routes/resources/main.ts +++ b/backend/src/routes/resources/main.ts @@ -239,6 +239,13 @@ function isDateValue(value: any) { } function normalizeCreatedDocumentPayload(payload: Record) { + if (Object.prototype.hasOwnProperty.call(payload, "customSurchargePercentage")) { + const customSurchargePercentage = Number(payload.customSurchargePercentage) + payload.customSurchargePercentage = Number.isFinite(customSurchargePercentage) + ? customSurchargePercentage + : 0 + } + const numberRelationFields = [ "customer", "contact", diff --git a/frontend/pages/createDocument/edit/[[id]].vue b/frontend/pages/createDocument/edit/[[id]].vue index 54aface..85ff571 100644 --- a/frontend/pages/createDocument/edit/[[id]].vue +++ b/frontend/pages/createDocument/edit/[[id]].vue @@ -1701,6 +1701,7 @@ const saveSerialInvoice = async () => { const saveDocument = async (state, resetup = false) => { itemInfo.value.state = state + normalizeCustomSurchargePercentage() if (state !== "Entwurf") { console.log("???") @@ -1870,7 +1871,14 @@ const checkCompatibilityWithInputPrice = () => { }) } +const normalizeCustomSurchargePercentage = () => { + const percentage = Number(itemInfo.value.customSurchargePercentage) + itemInfo.value.customSurchargePercentage = Number.isFinite(percentage) ? percentage : 0 +} + const updateCustomSurcharge = () => { + normalizeCustomSurchargePercentage() + itemInfo.value.rows.forEach(row => { if (!["pagebreak", "title", "text"].includes(row.mode) && isImportedAdvanceInvoiceRow(row)) { row.price = Number(row.inputPrice || 0)