test
This commit is contained in:
parent
2140181a76
commit
94ad0c0772
|
|
@ -3118,9 +3118,10 @@ private function upsertAddress(int $personId, array $addrData, $mappings): array
|
|||
if (mb_strlen($addressLine) < 3) {
|
||||
return ['action' => 'skipped', 'message' => 'Invalid address value'];
|
||||
}
|
||||
// Allow letters (incl. diacritics), numbers, and common separators
|
||||
if (! preg_match('/^[\\p{L}0-9\\s\\.,\\-\\/\\#\\\'"\\(\\)&]+$/u', $addressLine)) {
|
||||
return ['action' => 'skipped', 'message' => 'Invalid address value'];
|
||||
// If identical address already exists anywhere, skip to avoid constraint violation
|
||||
$existingAny = PersonAddress::where('address', $addressLine)->first();
|
||||
if ($existingAny && $existingAny->person_id !== $personId) {
|
||||
return ['action' => 'skipped', 'message' => 'Address already exists for another person'];
|
||||
}
|
||||
// Default country SLO if not provided
|
||||
if (! isset($addrData['country']) || $addrData['country'] === null || $addrData['country'] === '') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user