New report system and views

This commit is contained in:
Simon Pocrnjič
2026-01-02 12:32:20 +01:00
parent 9fc5b54b8a
commit 703b52ff59
67 changed files with 8255 additions and 2794 deletions
+8 -17
View File
@@ -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;