New report system and views
This commit is contained in:
@@ -73,30 +73,21 @@ public function process(Import $import, array $mapped, array $raw, array $contex
|
||||
];
|
||||
}
|
||||
|
||||
$existing = $this->resolve($mapped, $context);
|
||||
|
||||
// Check for duplicates if configured
|
||||
if ($this->getOption('deduplicate', true) && $existing) {
|
||||
// Update person_id if different
|
||||
if ($existing->person_id !== $personId) {
|
||||
$existing->person_id = $personId;
|
||||
$existing->save();
|
||||
|
||||
return [
|
||||
'action' => 'updated',
|
||||
'entity' => $existing,
|
||||
'applied_fields' => ['person_id'],
|
||||
];
|
||||
}
|
||||
// Check if this email already exists for THIS person
|
||||
$existing = Email::where('person_id', $personId)
|
||||
->where('value', strtolower(trim($email)))
|
||||
->first();
|
||||
|
||||
// If email already exists for this person, skip
|
||||
if ($existing) {
|
||||
return [
|
||||
'action' => 'skipped',
|
||||
'entity' => $existing,
|
||||
'message' => 'Email already exists',
|
||||
'message' => 'Email already exists for this person',
|
||||
];
|
||||
}
|
||||
|
||||
// Create new email
|
||||
// Create new email for this person
|
||||
$payload = $this->buildPayload($mapped, new Email);
|
||||
$payload['person_id'] = $personId;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user