snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Importer changing the category of assets already in the database

Open Arsenal10108 opened this issue 8 years ago • 20 comments

Please confirm you have done the following before posting your bug report:

Describe the bug I have created Custom Categories for our Chromebook inventory (Cart Chromebooks, 1:1 Chromebooks, Loaner Chromebooks etc) When I upload CSV file of assets of the same model but different category it changed all the of the assets of that model to the category of the last import. I don't know if it matters but this seemed to happen after I Imported a CSV of Assets with mixed Category's and only seems to change the assets of the same model. Leaves the other Models (same Category) alone.

To Reproduce Upload CSV of assets with category of "Cart Chromebooks" - Everything looks good Go to upload a CSV with a category of "Loaner Chromebooks" and it changes all of the Cart Chromebooks (of the same model i may add) to that category. (doesn't matter if I check or un-check the update existing values)

Expected behavior The imports would not modify existing assets categories if they are not on the CSV file.

Screenshots no really applicable?

Server (please complete the following information):

  • Snipe-IT Version - 4.4.2
  • OS: [e.g. Ubuntu, CentOS] Ubuntu 16.04 LTS
  • Web Server: [e.g. Apache, IIS] Apache
  • PHP Version - 7.0.30-0ubuntu0.16.04.1

Desktop (please complete the following information):

  • OS: [e.g. iOS] WIndows 10
  • Browser [e.g. chrome, safari] Chrome and firefox (tried both)
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Error Messages

  • WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
  • If a stacktrace is provided in the error, include that too.
  • Any errors that appear in your browser's error console.
  • Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo.
  • Include any additional information you can find in storage/logs and your webserver's logs.

Additional context

  • Is this a fresh install or an upgrade? Fresh
  • What OS and web server you're running Snipe-IT on Ubuntu 16.04 LTS and Apache 7
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) Composer
  • Include what you've done so far in the installation, and if you got any error messages along the way. Nope Install was good
  • Indicate whether or not you've manually edited any data directly in the database Have not.

Add any other context about the problem here.

Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.

Arsenal10108 avatar Jul 16 '18 16:07 Arsenal10108

Can you share the header of your CSV, please ensure you omit any private details. I am looking at a similar issue where the models are also being changed; however, I am not able to reproduce it.

EarlRamirez avatar Jul 17 '18 03:07 EarlRamirez

@Arsenal10108, I was able to reproduce this using the below sample.

Original import sample Company,Item Name,MAC Address,Model Name,IP Address,Servicing Location,Model Number,Serial Number,Manufacture,Category,Location,Status,Asset Tag Company1,AP001,d8:b1:90:cd:03:1c,Cisco 3700E Access Points,1.1.1.1,Default Location,AIR-CAP3702E-A-K9,FTX1924S0PQ,Cisco,Access Point,Production,Deployed,sam0000347

As expected everything went well. image

Same details with the exception of the Category, this time the category is Cisco Access Point Company,Item Name,MAC Address,Model Name,IP Address,Servicing Location,Model Number,Serial Number,Manufacture,Category,Location,Status,Asset Tag Company1,AP008,d8:b1:90:dd:03:cc,Cisco 3700E Access Points,2.2.2.2,Default Location,AIR-CAP3702E-A-K9,FTX1924S0PQ,Cisco,Cisco Access Point,Production,Deployed,sam0009000

The Category changes as image

Coming to think about it, it makes sense because categories are unique so this behaviour is expected, check out the code below

public $rules = array( 'user_id' => 'numeric|nullable', 'name' => 'required|min:1|max:255|unique_undeleted', 'require_acceptance' => 'boolean', 'use_default_eula' => 'boolean', 'category_type' => 'required|in:asset,accessory,consumable,component,license', );

EarlRamirez avatar Jul 17 '18 07:07 EarlRamirez

This slow internet is killing me :(, you can use labels for this scenario, cart and loaner label should suffice

EarlRamirez avatar Jul 17 '18 08:07 EarlRamirez

Thanks for the reply Earl, Wouldn't the two category names be unique in this instance? other than they have the same ending. Where would I go for the label settings? I cant find anything other than the obvious printable labels under admin settings but I don't think that's what your talking about. Are the labels something I could put on my Import?

Arsenal10108 avatar Jul 17 '18 11:07 Arsenal10108

This is a result of the fact that in the importer we treat asset model names as unique currently, even though they do not need to be. Need to think about what the unique constraints are on an asset model (model name+number+category(+manufacturer?)) And enforce that somewhere, and then adapt the importer to match.

image

mnemonicly avatar Jul 17 '18 11:07 mnemonicly

Hmmm that makes total sense now. Explains why it only changed everything that was the same model.

Arsenal10108 avatar Jul 17 '18 11:07 Arsenal10108

@Arsenal10108 was referring to status labels and yes! It can be imported or you can create a cart and loaner location, which can also be imported, at my organisation we I use status labels which also appears on the dashboard under Asset by Status

EarlRamirez avatar Jul 17 '18 18:07 EarlRamirez

@dmeltzer thanks for the correction :)

EarlRamirez avatar Jul 17 '18 18:07 EarlRamirez

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

stale[bot] avatar Sep 15 '18 19:09 stale[bot]

yes

On Sat, Sep 15, 2018, 15:44 stale[bot] [email protected] wrote:

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/snipe/snipe-it/issues/5855#issuecomment-421623693, or mute the thread https://github.com/notifications/unsubscribe-auth/ADoH_KPzhIgfOWbPBZKU6i6grQZUmoAOks5ubViYgaJpZM4VRbbB .

mnemonicly avatar Sep 16 '18 01:09 mnemonicly

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

stale[bot] avatar Sep 16 '18 01:09 stale[bot]

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

stale[bot] avatar Nov 15 '18 01:11 stale[bot]

This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.

stale[bot] avatar Nov 22 '18 02:11 stale[bot]

still relevant

samuel-sabik avatar Nov 22 '18 10:11 samuel-sabik

I am having the same issue, when I import assets with a category it affects assets that are not in my import csv.

G13312 avatar Feb 28 '20 15:02 G13312

This is NOT fixed. It just happened to me today. Version 5.3.6 build 6567 (master).

amlamarra avatar Mar 24 '22 13:03 amlamarra

How would you want this to work? As it is now, Asset Models live in a category. They can't live in two categories (in relational DB parlance, an Asset Model "Belongs To" a Category). You'd have to make a separate, similar model that lives in the second category I'd guess? That would be a lot of duplication and very easy to mess up though.

I wonder if your use case might be better-suited with custom statuslabels? E.g. model is "Samsung Chromebook 12345" category is "Chromebook", Statuslabel can be "Cart," "1:1," "Loaner"?

uberbrady avatar Mar 24 '22 14:03 uberbrady

Ok, I didn't know that the category was tied to the model. I figured we could use the categories how we see fit. For instance, I wanted to have 2 different categories for our servers, a Hypervisor and a Bare Metal category. But there may several servers of the same model with different categories. I suppose I could use a custom statuslabel. Or maybe the Notes field.

amlamarra avatar Mar 24 '22 14:03 amlamarra

Depends kinda on what you're trying to do; but having multiple "Deployable" statuses is perfectly OK.

uberbrady avatar Mar 24 '22 15:03 uberbrady

TIL the Model Name is the name of the Asset Model in Snipe-IT and not necessarily the name that the manufacturer gave to the Asset. Also it seems like the Asset Model in Snipe-IT depends on the values in both the Model Name and the Model No. fields.

We have, for example, MacBook Pros that we deploy in different ways for which we want different EULAs. The EULA is part of the Category, so we created different Categories for the different EULAs and thought we could assign MacBook Pros with the same Model Name and Number to different Categories depending on how they were being deployed.

From this thread it seems like we will need to create different Model Name and Number combinations for the different deployment scenarios in order to assign different Categories which we need for the different EULAs

So it seems like the Category is rather useless and should really have been incorporated into the Asset Model. It only gives the ability to add a EULA.

michaelfahy avatar Aug 24 '23 18:08 michaelfahy