diff --git a/app/Abstracts/Import.php b/app/Abstracts/Import.php index c02e7ed84..653cda224 100644 --- a/app/Abstracts/Import.php +++ b/app/Abstracts/Import.php @@ -39,7 +39,12 @@ abstract class Import implements HasLocalePreference, ShouldQueue, SkipsEmptyRow public function map($row): array { $row['company_id'] = company_id(); - $row['created_by'] = $this->user->id; + + // created_by is equal to the owner id. Therefore, the value in export is owner email. + if (isset($row['created_by'])) { + $row['created_by'] = User::where('email', $row['created_by'])->first()?->id ?? $this->user->id; + } + $row['created_from'] = $this->getSourcePrefix() . 'import'; // Make enabled field integer