mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Added first name and last name
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
3e4426c68c
commit
f355a6e9e1
|
@ -242,6 +242,8 @@ abstract class Importer
|
|||
|
||||
$user_array = [
|
||||
'full_name' => $this->findCsvMatch($row, 'full_name'),
|
||||
'first_name' => $this->findCsvMatch($row, 'first_name'),
|
||||
'last_name' => $this->findCsvMatch($row, 'last_name'),
|
||||
'email' => $this->findCsvMatch($row, 'email'),
|
||||
'manager_id'=> '',
|
||||
'department_id' => '',
|
||||
|
@ -250,7 +252,6 @@ abstract class Importer
|
|||
'remote' => $this->fetchHumanBoolean(($this->findCsvMatch($row, 'remote'))),
|
||||
];
|
||||
|
||||
|
||||
if ($type == 'manager') {
|
||||
$user_array['full_name'] = $this->findCsvMatch($row, 'manager');
|
||||
$user_array['username'] = $this->findCsvMatch($row, 'manager_username');
|
||||
|
@ -266,8 +267,9 @@ abstract class Importer
|
|||
|
||||
|
||||
// If the full name and username is empty, bail out--we need this to extract first name (at the very least)
|
||||
if ((empty($user_array['username'])) && (empty($user_array['full_name']))) {
|
||||
$this->log('Insufficient user data provided (Full name or username is required) - skipping user creation.');
|
||||
if ((empty($user_array['username'])) && (empty($user_array['full_name'])) && (empty($user_array['first_name']))) {
|
||||
$this->log('Insufficient user data provided (Full name, first name or username is required) - skipping user creation.');
|
||||
\Log::debug('User array: ');
|
||||
\Log::debug(print_r($user_array, true));
|
||||
\Log::debug(print_r($row, true));
|
||||
return false;
|
||||
|
@ -279,10 +281,12 @@ abstract class Importer
|
|||
$user_array['email'] = User::generateEmailFromFullName($user_array['full_name']);
|
||||
}
|
||||
|
||||
if (empty($user_array['first_name'])) {
|
||||
// Get some fields for first name and last name based off of full name
|
||||
$user_formatted_array = User::generateFormattedNameFromFullName($user_array['full_name'], Setting::getSettings()->username_format);
|
||||
$user_array['first_name'] = $user_formatted_array['first_name'];
|
||||
$user_array['last_name'] = $user_formatted_array['last_name'];
|
||||
}
|
||||
|
||||
if (empty($user_array['username'])) {
|
||||
$user_array['username'] = $user_formatted_array['username'];
|
||||
|
|
Loading…
Reference in a new issue