fix(crm): link imported Ansprechpartner to CRM company via companyId

When importing contact persons from Lexware, if the parent company
is already in the CRM (detected via linkedMap), the companyId is now
passed to createContact so the contact is properly associated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas Reitz 2026-03-11 11:20:07 +01:00
parent 332a623d6f
commit 00f6b9842e

View file

@ -146,6 +146,7 @@ function ImportTab() {
const handleImportContactPerson = (
person: LexwareContactPersonEntry,
companyName: string,
companyId?: string,
) => {
const cpName =
[person.firstName, person.lastName].filter(Boolean).join(' ') ||
@ -156,6 +157,7 @@ function ImportTab() {
lastName: person.lastName || undefined,
email: person.emailAddress || undefined,
phone: person.phoneNumber || undefined,
companyId: companyId || undefined,
companyName: companyName || undefined,
type: 'PERSON',
},
@ -417,6 +419,7 @@ function ImportTab() {
handleImportContactPerson(
cp,
contact.company?.name ?? '',
linked?.type === 'company' ? linked.id : undefined,
)
}
title={`${cpName} als CRM-Kontakt importieren`}