snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.12k stars 3.19k forks source link

Importer changing the category of assets already in the database #5855

Closed Arsenal10108 closed 5 years ago

Arsenal10108 commented 6 years ago

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):

Desktop (please complete the following information):

Smartphone (please complete the following information):

Error Messages

Additional context

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.

EarlRamirez commented 6 years ago

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 commented 6 years ago

@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( 'userid' => 'numeric|nullable', 'name' => 'required|min:1|max:255|uniqueundeleted', 'require_acceptance' => 'boolean', 'use_default_eula' => 'boolean', 'category_type' => 'required|in:asset,accessory,consumable,component,license', );

EarlRamirez commented 6 years ago

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

Arsenal10108 commented 6 years ago

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?

dmeltzer commented 6 years ago

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

Arsenal10108 commented 6 years ago

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

EarlRamirez commented 6 years ago

@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 commented 6 years ago

@dmeltzer thanks for the correction :)

stale[bot] commented 6 years ago

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!

dmeltzer commented 6 years ago

yes

On Sat, Sep 15, 2018, 15:44 stale[bot] notifications@github.com 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 .

stale[bot] commented 6 years ago

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] commented 6 years ago

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] commented 5 years ago

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.

samuel-sabik commented 5 years ago

still relevant

G13312 commented 4 years ago

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

amlamarra commented 2 years ago

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

uberbrady commented 2 years ago

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"?

amlamarra commented 2 years ago

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.

uberbrady commented 2 years ago

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

michaelfahy commented 1 year ago

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.