From 0b7bb89ebc3d710d81542262da4b31b637e84275 Mon Sep 17 00:00:00 2001 From: duffyduck Date: Fri, 19 Jun 2026 13:49:04 +0200 Subject: [PATCH] Vertrag: Auftragsnummer Vertriebsplattform vor Kundennummer Contract.orderNumberAtSalesPlatform (VARCHAR(191) NULL) mit Migration 20260619100000_contract_order_number_at_sales_platform (IF NOT EXISTS). Form-Input, Detail-Zeile mit Copy-Button, Audit-Mapping, Renewal-Copy und XSS-Strip-Allowlist analog zu den bestehenden Sales-Platform-Feldern. Co-Authored-By: Claude Opus 4.7 --- .../migration.sql | 7 +++++++ backend/prisma/schema.prisma | 1 + backend/src/controllers/contract.controller.ts | 1 + backend/src/services/contract.service.ts | 2 ++ backend/src/utils/sanitize.ts | 1 + docs/todo.md | 14 ++++++++++++++ frontend/src/pages/contracts/ContractDetail.tsx | 9 +++++++++ frontend/src/pages/contracts/ContractForm.tsx | 3 +++ frontend/src/types/index.ts | 1 + 9 files changed, 39 insertions(+) create mode 100644 backend/prisma/migrations/20260619100000_contract_order_number_at_sales_platform/migration.sql diff --git a/backend/prisma/migrations/20260619100000_contract_order_number_at_sales_platform/migration.sql b/backend/prisma/migrations/20260619100000_contract_order_number_at_sales_platform/migration.sql new file mode 100644 index 00000000..d3d432d1 --- /dev/null +++ b/backend/prisma/migrations/20260619100000_contract_order_number_at_sales_platform/migration.sql @@ -0,0 +1,7 @@ +-- Zusätzliches optionales Feld unter "Anbieter & Tarif": Auftragsnummer bei +-- der Vertriebsplattform (vor der Kundennummer). Plattformen liefern beim +-- Abschluss oft eine eigene Auftrags-/Vorgangsnummer, die fürs Reklamations- +-- handling gebraucht wird. + +ALTER TABLE `Contract` + ADD COLUMN IF NOT EXISTS `orderNumberAtSalesPlatform` VARCHAR(191) NULL; diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index 10b65a12..bcaeb21e 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -693,6 +693,7 @@ model Contract { tariffName String? customerNumberAtProvider String? contractNumberAtProvider String? // Vertragsnummer beim Anbieter + orderNumberAtSalesPlatform String? // Auftragsnummer bei der Vertriebsplattform customerNumberAtSalesPlatform String? // Kundennummer bei der Vertriebsplattform contractNumberAtSalesPlatform String? // Vertragsnummer bei der Vertriebsplattform priceFirst12Months String? // Preis erste 12 Monate diff --git a/backend/src/controllers/contract.controller.ts b/backend/src/controllers/contract.controller.ts index b52d041b..0953d351 100644 --- a/backend/src/controllers/contract.controller.ts +++ b/backend/src/controllers/contract.controller.ts @@ -204,6 +204,7 @@ export async function updateContract(req: AuthRequest, res: Response): Promise )} + {c.orderNumberAtSalesPlatform && ( +
+
Auftragsnr. Vertriebsplattform
+
+ {c.orderNumberAtSalesPlatform} + +
+
+ )} {c.customerNumberAtSalesPlatform && (
Kundennr. Vertriebsplattform
diff --git a/frontend/src/pages/contracts/ContractForm.tsx b/frontend/src/pages/contracts/ContractForm.tsx index dce7cf33..c3a877f2 100644 --- a/frontend/src/pages/contracts/ContractForm.tsx +++ b/frontend/src/pages/contracts/ContractForm.tsx @@ -302,6 +302,7 @@ export default function ContractForm() { tariffName: c.tariffName || '', customerNumberAtProvider: c.customerNumberAtProvider || '', contractNumberAtProvider: c.contractNumberAtProvider || '', + orderNumberAtSalesPlatform: c.orderNumberAtSalesPlatform || '', customerNumberAtSalesPlatform: c.customerNumberAtSalesPlatform || '', contractNumberAtSalesPlatform: c.contractNumberAtSalesPlatform || '', priceFirst12Months: c.priceFirst12Months || '', @@ -558,6 +559,7 @@ export default function ContractForm() { tariffName: emptyToNull(data.tariffName), customerNumberAtProvider: emptyToNull(data.customerNumberAtProvider), contractNumberAtProvider: emptyToNull(data.contractNumberAtProvider), + orderNumberAtSalesPlatform: emptyToNull(data.orderNumberAtSalesPlatform), customerNumberAtSalesPlatform: emptyToNull(data.customerNumberAtSalesPlatform), contractNumberAtSalesPlatform: emptyToNull(data.contractNumberAtSalesPlatform), priceFirst12Months: emptyToNull(data.priceFirst12Months), @@ -956,6 +958,7 @@ export default function ContractForm() { /> + diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index d63aafb5..545cd8b6 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -454,6 +454,7 @@ export interface Contract { tariffName?: string; customerNumberAtProvider?: string; contractNumberAtProvider?: string; + orderNumberAtSalesPlatform?: string; customerNumberAtSalesPlatform?: string; contractNumberAtSalesPlatform?: string; priceFirst12Months?: string;