Fix: Anrede per Du/Sie wird nicht gespeichert
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 <select> Fixes: - Frontend: submitData enthält jetzt useInformalAddress (String oder Boolean → sauberes Boolean) - Frontend: beim reset() wird Boolean zu 'true'/'false' konvertiert für <select> - 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) <noreply@anthropic.com>
This commit is contained in:
parent
2879bd64d6
commit
b78afce43c
|
|
@ -88,6 +88,9 @@ export async function updateCustomer(req: Request, res: Response): Promise<void>
|
||||||
salutation: 'Anrede', firstName: 'Vorname', lastName: 'Nachname', email: 'E-Mail',
|
salutation: 'Anrede', firstName: 'Vorname', lastName: 'Nachname', email: 'E-Mail',
|
||||||
phone: 'Telefon', mobile: 'Mobil', birthDate: 'Geburtsdatum', birthPlace: 'Geburtsort',
|
phone: 'Telefon', mobile: 'Mobil', birthDate: 'Geburtsdatum', birthPlace: 'Geburtsort',
|
||||||
companyName: 'Firma', type: 'Typ', taxNumber: 'Steuernummer', notes: 'Notizen',
|
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)) {
|
for (const [key, value] of Object.entries(data)) {
|
||||||
// Technische/interne Felder überspringen
|
// Technische/interne Felder überspringen
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ export async function updateCustomer(
|
||||||
data: {
|
data: {
|
||||||
type?: CustomerType;
|
type?: CustomerType;
|
||||||
salutation?: string;
|
salutation?: string;
|
||||||
|
useInformalAddress?: boolean;
|
||||||
firstName?: string;
|
firstName?: string;
|
||||||
lastName?: string;
|
lastName?: string;
|
||||||
companyName?: string;
|
companyName?: string;
|
||||||
|
|
@ -148,6 +149,8 @@ export async function updateCustomer(
|
||||||
businessRegistration?: string;
|
businessRegistration?: string;
|
||||||
commercialRegister?: string;
|
commercialRegister?: string;
|
||||||
notes?: string;
|
notes?: string;
|
||||||
|
autoBirthdayGreeting?: boolean;
|
||||||
|
autoBirthdayChannel?: string | null;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
return prisma.customer.update({
|
return prisma.customer.update({
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ export default function CustomerForm() {
|
||||||
if (data.foundingDate) {
|
if (data.foundingDate) {
|
||||||
data.foundingDate = data.foundingDate.split('T')[0] as any;
|
data.foundingDate = data.foundingDate.split('T')[0] as any;
|
||||||
}
|
}
|
||||||
|
// Boolean → String für <select>-Wert ('true'/'false')
|
||||||
|
(data as any).useInformalAddress = data.useInformalAddress === true ? 'true' : 'false';
|
||||||
reset(data);
|
reset(data);
|
||||||
}
|
}
|
||||||
}, [customer, reset]);
|
}, [customer, reset]);
|
||||||
|
|
@ -65,6 +67,9 @@ export default function CustomerForm() {
|
||||||
const submitData: any = {
|
const submitData: any = {
|
||||||
type: data.type,
|
type: data.type,
|
||||||
salutation: data.salutation || '',
|
salutation: data.salutation || '',
|
||||||
|
useInformalAddress:
|
||||||
|
data.useInformalAddress === true ||
|
||||||
|
(data.useInformalAddress as any) === 'true',
|
||||||
firstName: data.firstName,
|
firstName: data.firstName,
|
||||||
lastName: data.lastName,
|
lastName: data.lastName,
|
||||||
companyName: data.companyName || '',
|
companyName: data.companyName || '',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue