Skip to content

Commit

Permalink
Merge pull request #3088 from CihanSenturk/fix-import-created-by-issue
Browse files Browse the repository at this point in the history
Fixed import created_by issue
  • Loading branch information
cuneytsenturk committed Nov 3, 2023
2 parents a9d313e + 0fa3bf4 commit f440e9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions app/Abstracts/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public function map($row): array
$row['company_id'] = company_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'] = $this->getCreatedById($row);
}
$row['created_by'] = $this->getCreatedById($row);

$row['created_from'] = $this->getSourcePrefix() . 'import';

Expand Down
4 changes: 4 additions & 0 deletions app/Traits/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public function getCurrencyCode($row)

public function getCreatedById($row)
{
if (empty($row['created_by'])) {
return $this->user->id;
}

$user = user_model_class()::where('email', $row['created_by'])->first();

if (! empty($user)) {
Expand Down

0 comments on commit f440e9e

Please sign in to comment.