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

Auto-Increment Asset ID - Broken in 3.6.3

Open VanillaNinjaD opened this issue 9 years ago • 9 comments

Expected Behavior (or desired behavior if a feature request)

I expect that when creating a new Asset, my "Asset Name" will be populated with the same number as the "ID" field for that Asset. This is the way Snipe-IT used to work.


Actual Behavior

Since commit - https://github.com/snipe/snipe-it/commit/a8839e0ef412babcd930da1e27c0bd9fed3f4f9d (which I understand fixed Auto Incrementing for many people)

It has my installation generating Asset IDs that are not compatible with my current inventory. Checking the commit I can see that it is generating the next integer from the "Asset ID" column where it used to increment from the "ID" column.

We use alphanumeric "Asset IDs" and this has broken Auto-Increment for us. I have since reverted to using the "ID" column to increment but I do not prefer to have a non-standard configuration. I'd like to discuss reverting this change or making the column that Auto-Increments an option.

I can provide more detailed explanation with screenshots if needed

Thank you so much for all of your hard work.

VanillaNinjaD avatar Jan 17 '17 22:01 VanillaNinjaD

Can you give me some examples of asset tags as they used to generate, and how they do now? Using the ID doesn't really make sense, which is why we switched it. If you turn on incrementing after you already have some assets with different tags, all of the increments are off, so we can't revert the change.

snipe avatar Jan 17 '17 22:01 snipe

As a holdover from our previous inventory solution, we used the incrementing feature in a very basic manner.

We take the incremented number and place the shorthand of its "Location" before it, this becomes the machine's hostname as well as its "Asset Tag". We use the "Asset Name" field more freely, using it for either a friendly name "Steve's Computer" or whatever the situation requires

So machine number 1995, purchased by the Grants Management department becomes

GRANTS1995 and it gets added to Active Directory as such.

2017-01-17 17_00_06-all assets __ inventory manager

same example, narrowed to just computers

2017-01-17 17_08_40-all assets __ inventory manager

Now when a new asset is created and the Asset ID increments off the "Asset Tag" column I get the suggestion of 757. Since as you can see, when sorted by "Asset Tag" it considers WELCOME756 to be my "Largest" item when in fact I have 2000 assets.

2017-01-17 17_01_52-all assets __ inventory manager

You can see incrementing from "Asset Tag" suggests 757 2017-01-17 16_57_17-create asset __ inventory manager

While incrementing from "ID" suggests the (proper for my situation) 2001 2017-01-17 16_58_59-create asset __ inventory manager

VanillaNinjaD avatar Jan 17 '17 23:01 VanillaNinjaD

I also have this problem.

My assets where taking numbers from 0. Now they are taking an upwards of 10000 for some reason. This happened as soon as i updated to 3.6.3.

image

abaalkh avatar Jan 18 '17 06:01 abaalkh

I have a similar problem. We use ISB + a 5 digit number, e.g. ISB10211 was the last one. Now when I create a new asset it increments the 5 digit number as well as adding another 1 to the beginning.

For example, ISB10211 -> ISB110212 -> ISB1110213 -> ISB1110214 etc.

kylevitale avatar Feb 06 '17 15:02 kylevitale

@snipe Is there any update on this? I'm forced to write down which number i last used! Will it be fixed in v4?

Thanks.

abaalkh avatar Mar 07 '17 12:03 abaalkh

I'm having issues with this as well. I have it with the prefix of HAI-01 and it is stuck at HAI-01002 even though I have assets beyond this.

ryanesizemore avatar Apr 06 '17 21:04 ryanesizemore

I'm pretty sure many of these problems are due to inconsistent asset tag lengths in the database. We're basically asking MySQL to select MAX on a string that is non-numeric, and for MySQL, that means that WT9 is going to be higher than WT100 (and so on).

I think what we need to do is something like: select ifnull(max(CONVERT(asset_tag ,SIGNED INTEGER)),0) from asset_tag where asset_tag REGEXP '^[0-9]+$' in the incrementing method in the Asset model, but I haven't had time to work on this yet.

snipe avatar May 10 '17 10:05 snipe

What I'm trying to do is get HAI-01XXX to count up. Right now it is stuck at HAI-01002 and won't count up from there.

-- Ryan Sizemore | IS Support | Haivision O | 1.847.362.6800 x7200 M | 1.224.500.1568* S* | [email protected] http://www.haivision.com

On Wed, May 10, 2017 at 5:29 AM, snipe [email protected] wrote:

I'm pretty sure many of these problems are due to inconsistent asset tag lengths in the database. We're basically asking MySQL to select MAX on a string that is non-numeric, and for MySQL, that means that WT9 is going to be higher than WT100 (and so on).

I think what we need to do is something like: select ifnull(max(CONVERT(asset_tag ,SIGNED INTEGER)),0) from asset_tag where asset_tag REGEXP '^[0-9]+$' in the incrementing method in the Asset model, but I haven't had time to work on this yet.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/snipe/snipe-it/issues/3203#issuecomment-300442000, or mute the thread https://github.com/notifications/unsubscribe-auth/AYev3dy4BIv-ahmnoraEnvArlKfF2uo7ks5r4ZGWgaJpZM4LmQTK .

ryanesizemore avatar May 10 '17 14:05 ryanesizemore

This should be fixed in the upcoming v4

snipe avatar Jun 16 '17 03:06 snipe