From b78afce43cd20e8a40ca6fa1830170af170e69ba Mon Sep 17 00:00:00 2001 From: duffyduck Date: Thu, 23 Apr 2026 13:10:03 +0200 Subject: [PATCH] Fix: Anrede per Du/Sie wird nicht gespeichert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Das useInformalAddress-Feld war: 1. Im Frontend-Submit-Handler nicht in submitData enthalten (wurde bei jedem Update rausgefiltert) 2. Im Service-Type nicht definiert (TypeScript-mäßig unbekannt) 3. Beim Laden im Edit-Mode: Boolean aus DB matchte nicht das String-value des - Backend: Service-Type erweitert um useInformalAddress, autoBirthdayGreeting, autoBirthdayChannel - Backend: Audit-Feldlabels für die neuen Felder Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/src/controllers/customer.controller.ts | 3 +++ backend/src/services/customer.service.ts | 3 +++ frontend/src/pages/customers/CustomerForm.tsx | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/backend/src/controllers/customer.controller.ts b/backend/src/controllers/customer.controller.ts index 6759e20b..4b435c6b 100644 --- a/backend/src/controllers/customer.controller.ts +++ b/backend/src/controllers/customer.controller.ts @@ -88,6 +88,9 @@ export async function updateCustomer(req: Request, res: Response): Promise salutation: 'Anrede', firstName: 'Vorname', lastName: 'Nachname', email: 'E-Mail', phone: 'Telefon', mobile: 'Mobil', birthDate: 'Geburtsdatum', birthPlace: 'Geburtsort', companyName: 'Firma', type: 'Typ', taxNumber: 'Steuernummer', notes: 'Notizen', + useInformalAddress: 'Anrede per', + autoBirthdayGreeting: 'Autom. Geburtstagsgruß', + autoBirthdayChannel: 'Kanal für Geburtstagsgruß', }; for (const [key, value] of Object.entries(data)) { // Technische/interne Felder überspringen diff --git a/backend/src/services/customer.service.ts b/backend/src/services/customer.service.ts index 32e9287a..755abf7b 100644 --- a/backend/src/services/customer.service.ts +++ b/backend/src/services/customer.service.ts @@ -136,6 +136,7 @@ export async function updateCustomer( data: { type?: CustomerType; salutation?: string; + useInformalAddress?: boolean; firstName?: string; lastName?: string; companyName?: string; @@ -148,6 +149,8 @@ export async function updateCustomer( businessRegistration?: string; commercialRegister?: string; notes?: string; + autoBirthdayGreeting?: boolean; + autoBirthdayChannel?: string | null; } ) { return prisma.customer.update({ diff --git a/frontend/src/pages/customers/CustomerForm.tsx b/frontend/src/pages/customers/CustomerForm.tsx index f0d15cf7..6f8b7254 100644 --- a/frontend/src/pages/customers/CustomerForm.tsx +++ b/frontend/src/pages/customers/CustomerForm.tsx @@ -39,6 +39,8 @@ export default function CustomerForm() { if (data.foundingDate) { data.foundingDate = data.foundingDate.split('T')[0] as any; } + // Boolean → String für