Skip to content

Commit

Permalink
Importer name/full name fixes. (#5072)
Browse files Browse the repository at this point in the history
Fix a bug where "name" was used ambigously and mapping "item name" to
"name" would confuse the importer into thinking it should also be a user
name.  Now we default to "full name" for the users name, and "item name"
for the item name.  These are still both configurable through the custom
mapping.

Also update sample csvs and remove an outdated sample.
  • Loading branch information
mnemonicly authored and snipe committed Feb 22, 2018
1 parent 006b2b1 commit 5a84863
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 115 deletions.
4 changes: 2 additions & 2 deletions app/Importer/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract class Importer
'supplier' => 'supplier',
'termination_date' => 'termination date',
'warranty_months' => 'warranty',
'name' => 'name',
'full_name' => 'full name',
'email' => 'email',
'username' => 'username'
];
Expand Down Expand Up @@ -231,7 +231,7 @@ protected function logError($item, $field)
*/
protected function createOrFetchUser($row)
{
$user_name = $this->findCsvMatch($row, "name");
$user_name = $this->findCsvMatch($row, "full_name");
$user_email = $this->findCsvMatch($row, "email");
$user_username = $this->findCsvMatch($row, "username");
$first_name = '';
Expand Down
52 changes: 26 additions & 26 deletions public/js/build/all.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/build/vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/build/vue.js.map

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions public/js/dist/all.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"/js/build/vue.js": "/js/build/vue.js?id=25049a0c0eb736e1c883",
"/js/build/vue.js": "/js/build/vue.js?id=1de38b37fbbd0382cab3",
"/css/AdminLTE.css": "/css/AdminLTE.css?id=b8be19a285eaf44eec37",
"/css/app.css": "/css/app.css?id=407edb63cc6b6dc62405",
"/css/overrides.css": "/css/overrides.css?id=c289c71c08df753ebc45",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=6b79d08f1decca72957c",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=cc8a76b6d73986f89391",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map?id=99f5a5a03c4155cf69f6",
"/css/app.css.map": "/css/app.css.map?id=bdbe05e6ecd70ccfac72",
"/css/overrides.css.map": "/css/overrides.css.map?id=898c91d4a425b01b589b",
"/css/dist/all.css": "/css/dist/all.css?id=5fdad90c2d445e4a1a2c",
"/js/dist/all.js": "/js/dist/all.js?id=6e959b16034ab00e3007",
"/js/dist/all.js": "/js/dist/all.js?id=6769a7c5085ca8147451",
"/css/build/all.css": "/css/build/all.css?id=5fdad90c2d445e4a1a2c",
"/js/build/all.js": "/js/build/all.js?id=6e959b16034ab00e3007"
"/js/build/all.js": "/js/build/all.js?id=6769a7c5085ca8147451"
}
51 changes: 0 additions & 51 deletions public/sample.csv

This file was deleted.

2 changes: 1 addition & 1 deletion resources/assets/js/components/importer/importer-file.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ tr {
{id: 'asset_model', text: 'Model Name' },
{id: 'image', text: 'Image Filename' },
{id: 'model_number', text: 'Model Number' },
{id: 'name', text: 'Full Name' },
{id: 'full_name', text: 'Full Name' },
{id: 'status', text: 'Status' },
{id: 'warranty_months', text: 'Warranty Months' },
],
Expand Down
2 changes: 1 addition & 1 deletion sample_csvs/MOCK_ASSETS.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Name,Email,Username,item Name,Category,Model name,Manufacturer,Model Number,Serial,Asset Tag,Location,Notes,Purchase Date,Purchase Cost,Company,Status,Warranty,Supplier
Full Name,Email,Username,item Name,Category,Model name,Manufacturer,Model Number,Serial,Asset Tag,Location,Notes,Purchase Date,Purchase Cost,Company,Status,Warranty,Supplier
Bonnie Nelson,[email protected],bnelson0,eget nunc donec quis,quam,massa id,Linkbridge,6377018600094472,27aa8378-b0f4-4289-84a4-405da95c6147,970882174-8,Daping,"Curabitur in libero ut massa volutpat convallis. Morbi odio odio, elementum eu, interdum eu, tincidunt in, leo. Maecenas pulvinar lobortis est.",2016-04-05,133289.59,Alpha,Undeployable,14,Blogspan
Judith Ferguson,[email protected],jferguson1,mi in porttitor,justo,congue diam id,Flipstorm,5.02043359569189E+018,4bc7fc90-5a97-412f-8eed-77ecacc643fc,544574073-0,Cirangga Kidul,,2016-03-08,763.46,,Undeployable,12,Oyope
Mildred Gibson,[email protected],mgibson2,morbi quis tortor id,nunc nisl duis,convallis tortor risus,Lajo,374622546776765,2837ab20-8f0d-4935-8a52-226392f2b1b0,710141467-2,Shekou,In congue. Etiam justo. Etiam pretium iaculis justo.,2015-08-09,233.57,Konklab,Lost,,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testDefaultImportAssetWithCustomFields()
{
$this->signIn();
$csv = <<<'EOT'
Name,Email,Username,item Name,Category,Model name,Manufacturer,Model Number,Serial,Asset Tag,Location,Notes,Purchase Date,Purchase Cost,Company,Status,Warranty,Supplier,Weight
Full Name,Email,Username,item Name,Category,Model name,Manufacturer,Model Number,Serial,Asset Tag,Location,Notes,Purchase Date,Purchase Cost,Company,Status,Warranty,Supplier,Weight
Bonnie Nelson,[email protected],bnelson0,eget nunc donec quis,quam,massa id,Linkbridge,6377018600094472,27aa8378-b0f4-4289-84a4-405da95c6147,970882174-8,Daping,"Curabitur in libero ut massa volutpat convallis. Morbi odio odio, elementum eu, interdum eu, tincidunt in, leo. Maecenas pulvinar lobortis est.",2016-04-05,133289.59,Alpha,Undeployable,14,Blogspan,35
EOT;

Expand Down Expand Up @@ -210,7 +210,7 @@ public function testCustomMappingImport()
{
$this->signIn();
$csv = <<<'EOT'
Name,Email,Username,object name,Cat,Model name,Manufacturer,Model Number,Serial,Asset,Loc,Some Notes,Purchase Date,Purchase Cost,comp,Status,Warranty,Supplier
Full Name,Email,Username,object name,Cat,Model name,Manufacturer,Model Number,Serial,Asset,Loc,Some Notes,Purchase Date,Purchase Cost,comp,Status,Warranty,Supplier
Bonnie Nelson,[email protected],bnelson0,eget nunc donec quis,quam,massa id,Linkbridge,6377018600094472,27aa8378-b0f4-4289-84a4-405da95c6147,970882174-8,Daping,"Curabitur in libero ut massa volutpat convallis. Morbi odio odio, elementum eu, interdum eu, tincidunt in, leo. Maecenas pulvinar lobortis est.",2016-04-05,133289.59,Alpha,Undeployable,14,Blogspan
EOT;

Expand Down

0 comments on commit 5a84863

Please sign in to comment.