This commit is contained in:
Simon Pocrnjič 2025-12-17 22:17:00 +01:00
parent 94ad0c0772
commit 5ddca35389

View File

@ -3120,8 +3120,8 @@ private function upsertAddress(int $personId, array $addrData, $mappings): array
} }
// If identical address already exists anywhere, skip to avoid constraint violation // If identical address already exists anywhere, skip to avoid constraint violation
$existingAny = PersonAddress::where('address', $addressLine)->first(); $existingAny = PersonAddress::where('address', $addressLine)->first();
if ($existingAny && $existingAny->person_id !== $personId) { if ($existingAny) {
return ['action' => 'skipped', 'message' => 'Address already exists for another person']; return ['action' => 'skipped', 'message' => 'Address already exists in database'];
} }
// Default country SLO if not provided // Default country SLO if not provided
if (! isset($addrData['country']) || $addrData['country'] === null || $addrData['country'] === '') { if (! isset($addrData['country']) || $addrData['country'] === null || $addrData['country'] === '') {