From 9007e2a9b5290c45081507bb92b19bc9cf3a5a48 Mon Sep 17 00:00:00 2001 From: duffyduck Date: Fri, 3 Apr 2026 18:52:41 +0200 Subject: [PATCH] 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) --- src/StarfaceOutlookSync/Services/SyncEngine.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/StarfaceOutlookSync/Services/SyncEngine.cs b/src/StarfaceOutlookSync/Services/SyncEngine.cs index 94b81a0e..7f49df3d 100644 --- a/src/StarfaceOutlookSync/Services/SyncEngine.cs +++ b/src/StarfaceOutlookSync/Services/SyncEngine.cs @@ -56,9 +56,11 @@ namespace StarfaceOutlookSync.Services // Leere Firma vs. gefuellte Firma = verschiedene Kontakte 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.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 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.LastName.Equals(b.LastName, StringComparison.OrdinalIgnoreCase) && (!string.IsNullOrEmpty(a.FirstName) || !string.IsNullOrEmpty(a.LastName)); - bool phoneMatch = !string.IsNullOrEmpty(a.PhoneWork) && !string.IsNullOrEmpty(b.PhoneWork) - && NormalizePhone(a.PhoneWork) == NormalizePhone(b.PhoneWork); + bool phoneMatch = (!string.IsNullOrEmpty(a.PhoneWork) && !string.IsNullOrEmpty(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); } ///