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 = [ static $users = [
'employee_num' => 'Employee Number', 'employee_num' => 'Employee Number',
'first_name' => 'First Name', 'first_name' => 'First Name',
'jobtitle' => 'Job Title',
'last_name' => 'Last Name', 'last_name' => 'Last Name',
'jobtitle' => 'Job Title',
'phone_number' => 'Phone Number', 'phone_number' => 'Phone Number',
'manager_first_name' => 'Manager First Name', 'manager_first_name' => 'Manager First Name',
'manager_last_name' => 'Manager Last Name', 'manager_last_name' => 'Manager Last Name',
@ -126,7 +126,24 @@ class Importer extends Component
'city' => 'City', 'city' => 'City',
'state' => 'State', 'state' => 'State',
'country' => 'Country', '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 //array of "real fieldnames" to a list of aliases for that field
@ -150,6 +167,11 @@ class Importer extends Component
'QTY', 'QTY',
'Quantity' 'Quantity'
], ],
'zip' =>
[
'Postal Code',
'Post Code'
],
'min_amt' => 'min_amt' =>
[ [
'Min Amount', 'Min Amount',
@ -159,6 +181,31 @@ class Importer extends Component
[ [
'Next Audit', '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': case 'user':
$results = self::$general + self::$users; $results = self::$general + self::$users;
break; break;
case 'location':
$results = self::$general + self::$locations;
break;
default: default:
$results = self::$general; $results = self::$general;
} }
@ -252,7 +302,6 @@ class Importer extends Component
$this->authorize('import'); $this->authorize('import');
$this->progress = -1; // '-1' means 'don't show the progressbar' $this->progress = -1; // '-1' means 'don't show the progressbar'
$this->progress_bar_class = 'progress-bar-warning'; $this->progress_bar_class = 'progress-bar-warning';
\Log::debug("Hey, we are calling MOUNT (in the importer-file) !!!!!!!!"); //fcuk
$this->importTypes = [ $this->importTypes = [
'asset' => trans('general.assets'), 'asset' => trans('general.assets'),
'accessory' => trans('general.accessories'), 'accessory' => trans('general.accessories'),
@ -260,6 +309,7 @@ class Importer extends Component
'component' => trans('general.components'), 'component' => trans('general.components'),
'license' => trans('general.licenses'), 'license' => trans('general.licenses'),
'user' => trans('general.users'), 'user' => trans('general.users'),
'location' => trans('general.locations'),
]; ];
$this->columnOptions[''] = $this->getColumns(''); //blank mode? I don't know what this is supposed to mean $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) 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->activeFile = Import::find($id);
$this->field_map = null; $this->field_map = null;
foreach($this->activeFile->header_row as $element) { 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[] = 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->file_id = $id;
$this->import_errors = null; $this->import_errors = null;
$this->statusText = 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);
} }