Kundendaten-Modal: nur Anbieter-Nummern, keine internen CRM-Nummern

Modal ist für Mails AN den Anbieter gedacht – interne CRM-Nummern
interessieren dort niemanden.

- formatCustomerBlock: customer.customerNumber (intern) raus,
  stattdessen contract.customerNumberAtProvider rein.
- formatContractBlock: interne contractNumber raus, restliche
  Anbieter-/Vertriebsplattform-Nummern bleiben.
- Previews ziehen ebenfalls auf customerNumberAtProvider /
  contractNumberAtProvider um, mit Hinweis-Text wenn keine
  Anbieter-Nummer hinterlegt ist.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 16:10:20 +02:00
parent ebaee024b6
commit a4895374b9
@@ -492,6 +492,11 @@ function fullName(
return parts.filter(Boolean).join(' ');
}
// User-Wunsch 2026-06-21: das Modal ist für Mails AN den Anbieter gedacht.
// Die interne CRM-Kundennummer / -Vertragsnummer interessiert dort
// niemanden relevant ist nur, was der Anbieter selbst vergeben hat
// (`customerNumberAtProvider`, `contractNumberAtProvider`). Wir blenden
// die internen Nummern komplett aus.
function formatCustomerBlock(
customer: NonNullable<Contract['customer']>,
contract: Contract,
@@ -499,7 +504,9 @@ function formatCustomerBlock(
): string {
const lines: string[] = ['Kundendaten:'];
lines.push(fullName(customer, contract.type));
if (customer.customerNumber) lines.push(`Kundennummer: ${customer.customerNumber}`);
if (contract.customerNumberAtProvider) {
lines.push(`Kundennummer beim Anbieter: ${contract.customerNumberAtProvider}`);
}
if (customer.birthDate) lines.push(`Geburtsdatum: ${formatDate(customer.birthDate)}`);
if (email) lines.push(`E-Mail: ${email}`);
if (customer.phone) lines.push(`Telefon: ${customer.phone}`);
@@ -510,7 +517,9 @@ function formatCustomerBlock(
function previewCustomer(customer: NonNullable<Contract['customer']>, contract: Contract): string {
return [
fullName(customer, contract.type),
customer.customerNumber ? `Kundennummer: ${customer.customerNumber}` : '',
contract.customerNumberAtProvider
? `Anbieter-Kdnr.: ${contract.customerNumberAtProvider}`
: '',
]
.filter(Boolean)
.join(' · ');
@@ -530,9 +539,12 @@ function previewAddress(addr: Address): string {
return `${addr.street} ${addr.houseNumber}, ${addr.postalCode} ${addr.city}`;
}
// Interne `contractNumber` raus (User-Wunsch 2026-06-21): für eine Mail
// an den Provider zählt nur die Vertragsnummer, die der Provider selbst
// vergeben hat. Vertriebsplattform-Nummern bleiben drin die nutzt der
// CRM-Mitarbeiter teilweise auch für die Plattform-Korrespondenz.
function formatContractBlock(c: Contract): string {
const lines: string[] = ['Vertragsdaten:'];
lines.push(`Vertragsnummer: ${c.contractNumber}`);
if (c.provider?.name) lines.push(`Anbieter: ${c.provider.name}`);
if (c.tariff?.name) lines.push(`Tarif: ${c.tariff.name}`);
if (c.customerNumberAtProvider) lines.push(`Kundennummer beim Anbieter: ${c.customerNumberAtProvider}`);
@@ -546,7 +558,12 @@ function formatContractBlock(c: Contract): string {
}
function previewContract(c: Contract): string {
const parts: string[] = [c.contractNumber];
const parts: string[] = [];
if (c.contractNumberAtProvider) {
parts.push(`Anbieter-Vtr.: ${c.contractNumberAtProvider}`);
} else if (c.provider?.name) {
parts.push('(keine Anbieter-Vertragsnummer hinterlegt)');
}
if (c.provider?.name) parts.push(c.provider.name);
if (c.tariff?.name) parts.push(c.tariff.name);
return parts.join(' · ');