Include Fax, HomePhone in matching and compatibility checks
- Fax and HomePhone are now checked for compatibility (filled on one side, empty on other = different contacts) - Fax number can serve as a strong match together with Company - Prevents fax-only contacts from being missed or mismatched Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0eadb2274e
commit
9007e2a9b5
|
|
@ -56,9 +56,11 @@ namespace StarfaceOutlookSync.Services
|
||||||
// Leere Firma vs. gefuellte Firma = verschiedene Kontakte
|
// Leere Firma vs. gefuellte Firma = verschiedene Kontakte
|
||||||
if (!FieldsCompatible(a.Company, b.Company)) return false;
|
if (!FieldsCompatible(a.Company, b.Company)) return false;
|
||||||
|
|
||||||
// Telefon: wenn auf einer Seite vorhanden, muss sie gleich sein
|
// Telefon/Fax: wenn auf einer Seite vorhanden, muss es gleich sein
|
||||||
if (!PhoneFieldsCompatible(a.PhoneWork, b.PhoneWork)) return false;
|
if (!PhoneFieldsCompatible(a.PhoneWork, b.PhoneWork)) return false;
|
||||||
if (!PhoneFieldsCompatible(a.PhoneMobile, b.PhoneMobile)) return false;
|
if (!PhoneFieldsCompatible(a.PhoneMobile, b.PhoneMobile)) return false;
|
||||||
|
if (!PhoneFieldsCompatible(a.PhoneHome, b.PhoneHome)) return false;
|
||||||
|
if (!PhoneFieldsCompatible(a.Fax, b.Fax)) return false;
|
||||||
|
|
||||||
// Mindestens ein starkes Match muss vorhanden sein
|
// Mindestens ein starkes Match muss vorhanden sein
|
||||||
bool emailMatch = !string.IsNullOrEmpty(a.Email) && !string.IsNullOrEmpty(b.Email)
|
bool emailMatch = !string.IsNullOrEmpty(a.Email) && !string.IsNullOrEmpty(b.Email)
|
||||||
|
|
@ -67,10 +69,15 @@ namespace StarfaceOutlookSync.Services
|
||||||
&& a.FirstName.Equals(b.FirstName, StringComparison.OrdinalIgnoreCase)
|
&& a.FirstName.Equals(b.FirstName, StringComparison.OrdinalIgnoreCase)
|
||||||
&& a.LastName.Equals(b.LastName, StringComparison.OrdinalIgnoreCase)
|
&& a.LastName.Equals(b.LastName, StringComparison.OrdinalIgnoreCase)
|
||||||
&& (!string.IsNullOrEmpty(a.FirstName) || !string.IsNullOrEmpty(a.LastName));
|
&& (!string.IsNullOrEmpty(a.FirstName) || !string.IsNullOrEmpty(a.LastName));
|
||||||
bool phoneMatch = !string.IsNullOrEmpty(a.PhoneWork) && !string.IsNullOrEmpty(b.PhoneWork)
|
bool phoneMatch = (!string.IsNullOrEmpty(a.PhoneWork) && !string.IsNullOrEmpty(b.PhoneWork)
|
||||||
&& NormalizePhone(a.PhoneWork) == NormalizePhone(b.PhoneWork);
|
&& NormalizePhone(a.PhoneWork) == NormalizePhone(b.PhoneWork))
|
||||||
|
|| (!string.IsNullOrEmpty(a.Fax) && !string.IsNullOrEmpty(b.Fax)
|
||||||
|
&& NormalizePhone(a.Fax) == NormalizePhone(b.Fax));
|
||||||
|
bool companyMatch = !string.IsNullOrEmpty(a.Company) && !string.IsNullOrEmpty(b.Company)
|
||||||
|
&& a.Company.Equals(b.Company, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
return emailMatch || nameMatch || phoneMatch;
|
// Email oder Name reicht. Telefon/Fax nur mit Firma zusammen.
|
||||||
|
return emailMatch || nameMatch || (phoneMatch && companyMatch) || (companyMatch && phoneMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue