Imported bulk asset - issues with existing device assignment
Expected Behavior (or desired behavior if a feature request)
Modify existing assets with new information. Import > Upload file Import type: Assets Update Existing Values?: Checked
Making changes to some Header fields, primarily "Company" and "Asset Name". Near 100% assets in the CSV did not have Company listed. Approx. 33% of the assets did not have an Asset Name (Item Name). All assets previously had Asset Tags.
Expected only these two fields to be updated from existing values (of blank).
Headers that were present in the new CSV that was uploaded and imported:
Company | Asset Name | Asset Tag | Model | Model No. | Category | Manufacturer | Serial
Headers that were modified from original:
Company | Asset Name
Actual Behavior
tl;dr - I believe that devices that were assigned to locations only (no users) during this process incorrectly and without prompt grabbed a user and attached themselves to a user.
Details: Everything appeared to work correctly. The import process worked as expected. All (two) fields that I modified were updated as expected on the existing assets. 100% good. No duplicate assets created.
However, a day later, upon further inspection I noticed some irregularities with one user. Looked into it more and noticed a few other users had similar issues. No ~~discernible patterns as to what assets were affected~~ or what users were affected. I do not see any correlations between devices that did not have Asset Names.
57 assets were assigned (that were previously assigned to locations) to 5 different users. Users have: 27, 17, 6, 4, and 3 extra assets now. These 5 users are not assigned to any locations.
I did discover while filling out this report that one thing is in common. Each user was only assigned assets from a single location. User was assigned ALL of the assets of that location that were exclusively assigned to that location. However, if an asset was assigned to a user and was in that location due to the users location, it was NOT modified. E.g., A teacher has a laptop and a phone assigned to them. Teacher is assigned to a Location. 30 devices are then assigned to that Location. Location shows 32 devices, 2 of which are its users, 30 of which are its own. I believe, but it's hard to verify, that the only devices that were suffered this effect were ones that were exclusively assigned to locations. Devices that were not assigned to anyone, marked pending, or already assigned to users were not affected.
When viewing asset properties, it still shows the original location it was checked out to. However, the status now shows deployed to a user.
Status: Deployed -> USER1 Location: Location1 Default Location: Location0
This is what the history of the assets look like. I sampled several of them and they follow this exact pattern.

The 5 users in question have no information included under History section. Users do show having those assets under in their list.
Please confirm you have done the following before posting your bug report:
- [ ] I have enabled debug mode
- [X] I have read checked the Common Issues page
Provide answers to these questions:
- Is this a fresh install or an upgrade? Upgrade (v4 fresh to a newer v4)
- Version of Snipe-IT you're running Version v4.1.6 - build 2994 (master)
- Version of PHP you're running 7.0.22-0ubuntu0.16.04.1
- Version of MySQL/MariaDB you're running 5.4.29
- What OS and web server you're running Snipe-IT on Ubuntu 16.04.1 Apache2
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) install.sh
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error n/a
- What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error Users page under assets / assets page / asset views
- If a stacktrace is provided in the error, include that too.
#0 /var/www/snipeit/app/Importer/ComponentImporter.php(42): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined prope...', '/var/www/snipei...', 42, Array)
#1 /var/www/snipeit/app/Importer/ComponentImporter.php(18): App\Importer\ComponentImporter->createComponentIfNotExists()
#2 /var/www/snipeit/app/Importer/Importer.php(125): App\Importer\ComponentImporter->handle(Array)
#3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(29): App\Importer\Importer->App\Importer\{closure}(Object(Illuminate\Database\MySqlConnection))
#4 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(324): Illuminate\Database\Connection->transaction(Object(Closure))
#5 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): Illuminate\Database\DatabaseManager->__call('transaction', Array)
#6 /var/www/snipeit/app/Importer/Importer.php(132): Illuminate\Support\Facades\Facade::__callStatic('transaction', Array)
#7 /var/www/snipeit/app/Http/Requests/ItemImportRequest.php(57): App\Importer\Importer->import()
#8 /var/www/snipeit/app/Http/Controllers/Api/ImportController.php(100): App\Http\Requests\ItemImportRequest->import(Object(App\Models\Import))
#9 [internal function]: App\Http\Controllers\Api\ImportController->process(Object(App\Http\Requests\ItemImportRequest), '3')
#10 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(55): call_user_func_array(Array, Array)
#11 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(44): Illuminate\Routing\Controller->callAction('process', Array)
#12 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\Api\ImportController), 'process')
#13 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): Illuminate\Routing\Route->runController()
#14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(574): Illuminate\Routing\Route->run()
#15 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#16 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#17 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')
#18 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#19 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#20 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(576): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#21 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(535): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#22 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(513): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#23 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#24 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#25 /var/www/snipeit/app/Http/Middleware/CheckForDebug.php(25): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#26 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\CheckForDebug->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#28 /var/www/snipeit/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#29 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /var/www/snipeit/app/Http/Middleware/CheckForSetup.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#32 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\CheckForSetup->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#34 /var/www/snipeit/app/Http/Middleware/NosniffGuard.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#35 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\NosniffGuard->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /var/www/snipeit/app/Http/Middleware/ContentSecurityPolicyHeader.php(18): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#38 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\ContentSecurityPolicyHeader->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#40 /var/www/snipeit/app/Http/Middleware/ReferrerPolicyHeader.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
"laravel.log" 19801L, 3384884C
TEST
- Any errors that appear in your browser's error console.
- Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo. Did not confirm
- Include any additional information you can find in
app/storage/logsand your webserver's logs. All logs pasted above. - Include what you've done so far in the installation, and if you got any error messages along the way. n/a
- Indicate whether or not you've manually edited any data directly in the database I have not
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
@dmeltzer can you take a look please?
When checking the asset in if I do not define the location, it will clear out the previous location as well (checking it "IN" from both the user and the original location.)
It will also show up in the history now for the user and the asset. I was hoping that since it never "existed" in the history that I could silently remove it, but that doesn't seem to be the case.
When checking the asset back in, but selecting the location it is in, it will successfully check it in from that user, and will then check it back out to the original location. This doesn't modify the default location. In the history, it will only show the "Checkin from" entry and does not include any history of the location. However it's not checked out to the location, just mentions it's located there (it's still setup to be checked out to a user). It also shows up on the users history as a checkin from.
Which brings me to a mini-question: What's the best way for me to delete out the history of these users without breaking other things? I know there's some taboo stuff, so I'm not going to mess with it unless I really, really need to. I'd prefer there not to be 27 entries in this user's history if there doesn't have to be.
Hello,
Is it possible for you to share a few lines of the original CSV and the edited CSV? I'm trying to reproduce locally, and while I think I understand what happened, I'm having trouble of seeing where/why it is in the code. I think that if you looked in the database you'd see that the id of the location things were assigned to matches the id of the user that things are assigned to now. If so, it should be fairly simple to remedy, but I'd prefer you confirm that first.
ORIGINAL via Export:

UPLOAD EDIT:

From the original, from devices that were effected:

As best as I can to replicate what I did. I exported the data from existing Snipe assets, which generated the first picture. Modified them (copy/paste along the columns for duplicate fields which was the Company column for sure) to create second picture. Some of the original (lines 468 to 616) did not have an "Asset Name", but did have an Asset tag. Otherwise had all fields covered from the exported file.
No blank fields upon review of the updated (2nd picture) import. Deleted out the Locations column from the original file as it was not needed and I incorrectly included it during the export process.
Matched headers and processed successfully.
CSV versions of docs above:
Original exported from Snipe
Company,"Asset Name","Asset Tag",Model,"Model No.",Category,Manufacturer,Serial,Location
,###05,###05,"Acer C710 Chromebook",C710-2847,Chromebook,Acer,######1601,
,###413,###413,"Acer C720 Chromebook",C720,Chromebook,Acer,######7600,
,###425,###425,"Acer C720 Chromebook",C720,Chromebook,Acer,######7600,
,###426,###426,"Acer C720 Chromebook",C720,Chromebook,Acer,######7600,
,###427,###427,"Acer C720 Chromebook",C720,Chromebook,Acer,######7600,
,###428,###428,"Acer C720 Chromebook",C720,Chromebook,Acer,######7600,
,###429,###429,"Acer C720 Chromebook",C720,Chromebook,Acer,######7600
Uploaded edit:
Company,Asset Name,Asset Tag,Model,Model No.,Category,Manufacturer,Serial
### School District,###005,###05,Acer C710 Chromebook,C710-2847,Chromebook,Acer,######1601
### School District,IT000413,IT000413,Acer C720 Chromebook,C720,Chromebook,Acer,######7600
### School District,IT000425,IT000425,Acer C720 Chromebook,C720,Chromebook,Acer,######7600
### School District,IT000426,IT000426,Acer C720 Chromebook,C720,Chromebook,Acer,######7600
### School District,IT000427,IT000427,Acer C720 Chromebook,C720,Chromebook,Acer,######7600
### School District,IT000428,IT000428,Acer C720 Chromebook,C720,Chromebook,Acer,######7600
### School District,IT000429,IT000429,Acer C720 Chromebook,C720,Chromebook,Acer,######7600
Original from export of assets that had the problem:
Company,"Asset Name","Asset Tag",Model,"Model No.",Category,Manufacturer,Serial,Location
<...>
####1011,####1011,"Dell Chromebook 11 (3120)",CRM3120-1667BLK,Chromebook,Dell,F1####,##S17
,####1012,####1012,"Dell Chromebook 11 (3120)",CRM3120-1667BLK,Chromebook,Dell,CF####,#S17
,####1013,####1013,"Dell Chromebook 11 (3120)",CRM3120-1667BLK,Chromebook,Dell,21####,#S17
,####1014,####1014,"Dell Chromebook 11 (3120)",CRM3120-1667BLK,Chromebook,Dell,7D####,#S17
,####1015,####1015,"Dell Chromebook 11 (3120)",CRM3120-1667BLK,Chromebook,Dell,G3####,#S17
Edit version that was uploaded, of assets that had problem:
Company,Asset Name,Asset Tag,Model,Model No.,Category,Manufacturer,Serial
<....>
#### School District,####1011,####1011,Dell Chromebook 11 (3120),CRM3120-1667BLK,Chromebook,Dell,F1####
#### School District,####1012,####1012,Dell Chromebook 11 (3120),CRM3120-1667BLK,Chromebook,Dell,CF####
#### School District,####1013,####1013,Dell Chromebook 11 (3120),CRM3120-1667BLK,Chromebook,Dell,21####
#### School District,####1014,####1014,Dell Chromebook 11 (3120),CRM3120-1667BLK,Chromebook,Dell,7D####
#### School District,####1015,####1015,Dell Chromebook 11 (3120),CRM3120-1667BLK,Chromebook,Dell,G3####
It may have been how I was 'checking in' the devices after this bug, but I've got at least 17 stuck in limbo.
Location0 = default Location1 = current
Status: Ready to Deploy
Checked Out To: Blank
Location: LOCATION1
Checkin/Checkout: Checkout but is pink instead red, as if marked "Pending" with same mousetip "status label that is undeployable..."
When viewing the same asset in the /edit page:
Status: Ready to Deploy (green checkmark)
Default Location: Location0
Changing it to Pending and back to Ready to Deploy does nothing. Clicking on the asset, and using the Actions dropdown, selecting "Checkin asset" will result in it saying " Error: That asset is already checked in."
Cannot check it out because it's checked out already, but can't check it in because it's already checked in. RIP
Database info on one of the limbo'd assets:
MariaDB [DBUSERNAME]> SELECT * FROM assets WHERE asset_tag = "ASSET204";
+-----+----------+-----------+----------+------------+---------------+---------------+--------------+-------------+-------+-------+---------+---------------------+---------------------+----------+------------+-----------+----------+-----------------+------------+-------------+-------------+-----------------+------------------------+----------+---------------------+------------------+------------+-----------------+-----------------+-------------+
| id | name | asset_tag | model_id | serial | purchase_date | purchase_cost | order_number | assigned_to | notes | image | user_id | created_at | updated_at | physical | deleted_at | status_id | archived | warranty_months | depreciate | supplier_id | requestable | rtd_location_id | _snipeit_mac_address_1 | accepted | last_checkout | expected_checkin | company_id | assigned_type | next_audit_date | location_id |
+-----+----------+-----------+----------+------------+---------------+---------------+--------------+-------------+-------+-------+---------+---------------------+---------------------+----------+------------+-----------+----------+-----------------+------------+-------------+-------------+-----------------+------------------------+----------+---------------------+------------------+------------+-----------------+-----------------+-------------+
| 878 | ASSET204 | ASSET204 | 16 | ####SN##### | NULL | NULL | | 152 | | NULL | NULL | 2017-12-13 11:54:10 | 2018-01-29 14:49:04 | 1 | NULL | 2 | 0 | 0 | NULL | NULL | 0 | 2 | NULL | NULL | 2017-12-15 09:26:49 | NULL | 1 | App\Models\User | NULL | 152 |
+-----+----------+-----------+----------+------------+---------------+---------------+--------------+-------------+-------+-------+---------+---------------------+---------------------+----------+------------+-----------+----------+-----------------+------------+-------------+-------------+-----------------+------------------------+----------+---------------------+------------------+------------+-----------------+-----------------+-------------+
1 row in set (0.00 sec)
Also, one thing I noticed "152" is listed in two sections. For reference, /users/152 is a deleted user. /location/152 is Location1. I see "152" in both the assigned_to column and the location_id column. In column rtd_location it does have the right default location. ("2" is the correct "Location0")
The deleted user has had nothing to do with this during the errors, only reason I mentioned it is because I was checking to see who user 152 and location 152 was.
Just curious: is there another flag that tells the assigned_to if that entry is either a user or a location for that number? How does it know 152 is a user or a location?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!
Bump
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!
Hi Team,
While i was trying to upload data into software licenses, the data is being loaded into assets, followed the guidelines from https://snipe-it.readme.io/docs/importing,
There is a Web GUI importer available in the **Import** section that will allow you to upload and process and import a **comma-delimited **CSV through the web interface. The importer may choke on larger imports, so if you have more than several hundred records to import, you may wish to use the comm...