Added alias maps

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-04-16 07:47:42 -07:00
parent a831a34594
commit 5a1d03c1dc

View file

@ -116,8 +116,8 @@ class Importer extends Component
static $users = [
'employee_num' => 'Employee Number',
'first_name' => 'First Name',
'jobtitle' => 'Job Title',
'last_name' => 'Last Name',
'jobtitle' => 'Job Title',
'phone_number' => 'Phone Number',
'manager_first_name' => 'Manager First Name',
'manager_last_name' => 'Manager Last Name',
@ -126,7 +126,24 @@ class Importer extends Component
'city' => 'City',
'state' => 'State',
'country' => 'Country',
'vip' => 'VIP'
'zip' => 'Zip',
'vip' => 'VIP',
'remote' => 'Remote',
];
static $locations = [
'name' => 'Name',
'address' => 'Address',
'address2' => 'Address 2',
'city' => 'City',
'state' => 'State',
'country' => 'Country',
'zip' => 'Zip',
'currency' => 'Currency',
'ldap_ou' => 'LDAP OU',
'manager_username' => 'Manager Username',
'manager' => 'Manager',
'parent_location' => 'Parent Location',
];
//array of "real fieldnames" to a list of aliases for that field
@ -150,6 +167,11 @@ class Importer extends Component
'QTY',
'Quantity'
],
'zip' =>
[
'Postal Code',
'Post Code'
],
'min_amt' =>
[
'Min Amount',
@ -159,6 +181,31 @@ class Importer extends Component
[
'Next Audit',
],
'address2' =>
[
'Address 2',
'Address2',
],
'ldap_ou' =>
[
'LDAP OU',
'OU',
],
'parent_location' =>
[
'Parent',
'Parent Location',
],
'manager' =>
[
'Managed By',
'Manager Name',
'Manager Full Name',
],
'manager_username' =>
[
'Manager Username',
],
];
@ -181,6 +228,9 @@ class Importer extends Component
case 'user':
$results = self::$general + self::$users;
break;
case 'location':
$results = self::$general + self::$locations;
break;
default:
$results = self::$general;
}
@ -252,7 +302,6 @@ class Importer extends Component
$this->authorize('import');
$this->progress = -1; // '-1' means 'don't show the progressbar'
$this->progress_bar_class = 'progress-bar-warning';
\Log::debug("Hey, we are calling MOUNT (in the importer-file) !!!!!!!!"); //fcuk
$this->importTypes = [
'asset' => trans('general.assets'),
'accessory' => trans('general.accessories'),
@ -260,6 +309,7 @@ class Importer extends Component
'component' => trans('general.components'),
'license' => trans('general.licenses'),
'user' => trans('general.users'),
'location' => trans('general.locations'),
];
$this->columnOptions[''] = $this->getColumns(''); //blank mode? I don't know what this is supposed to mean
@ -273,8 +323,7 @@ class Importer extends Component
public function selectFile($id)
{
\Log::debug("TOGGLE EVENT FIRED!");
\Log::debug("The ID we are trying to find is AS FOLLOWS: ".$id);
$this->activeFile = Import::find($id);
$this->field_map = null;
foreach($this->activeFile->header_row as $element) {
@ -284,11 +333,9 @@ class Importer extends Component
$this->field_map[] = null; // re-inject the 'nulls' if a file was imported with some 'Do Not Import' settings
}
}
//$this->field_map = $this->activeFile->field_map ? array_values($this->activeFile->field_map) : []; // this is wrong
$this->file_id = $id;
$this->import_errors = null;
$this->statusText = null;
\Log::debug("The import type we are about to try and load up is gonna be this: ".$this->activeFile->import_type);
}