Skip to content

Commit

Permalink
Merge pull request #12205 from Godmartinz/sc19675_add_remote_to_importer
Browse files Browse the repository at this point in the history
Adds remote field to the user importer
  • Loading branch information
snipe committed Dec 14, 2022
2 parents fabefa6 + d0d0058 commit d13a237
Show file tree
Hide file tree
Showing 4 changed files with 14,298 additions and 14,294 deletions.
2 changes: 2 additions & 0 deletions app/Importer/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ abstract class Importer
'manager_first_name' => 'manager first name',
'manager_last_name' => 'manager last name',
'min_amt' => 'minimum quantity',
'remote' => 'remote',
];
/**
* Map of item fields->csv names
Expand Down Expand Up @@ -288,6 +289,7 @@ protected function createOrFetchUser($row)
'department_id' => '',
'username' => $this->findCsvMatch($row, 'username'),
'activated' => $this->fetchHumanBoolean($this->findCsvMatch($row, 'activated')),
'remote' => $this->fetchHumanBoolean(($this->findCsvMatch($row, 'remote'))),
];

// Maybe we're lucky and the user already exists.
Expand Down
1 change: 1 addition & 0 deletions app/Importer/UserImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function createUserIfNotExists(array $row)
$this->item['employee_num'] = $this->findCsvMatch($row, 'employee_num');
$this->item['department_id'] = $this->createOrFetchDepartment($this->findCsvMatch($row, 'department'));
$this->item['manager_id'] = $this->fetchManager($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name'));
$this->item['remote'] =($this->fetchHumanBoolean($this->findCsvMatch($row, 'remote')) ==1 ) ? '1' : 0;

$user_department = $this->findCsvMatch($row, 'department');
if ($this->shouldUpdateField($user_department)) {
Expand Down
Loading

0 comments on commit d13a237

Please sign in to comment.