You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2009-10-21 17:04:00

gvargasdc
Member
Registered: 2009-10-21
Posts: 34

Inventory: Unique Serial numbers / No Error Message when DB Add fails

Hi,

I wanted to make the Serial Number field unique in the Computers inventory. I looked around and apparently there is no way to do this without OCSNG.

So, I went to the GLPI MySQL database and did:

ALTER TABLE glpi_computers ADD UNIQUE(serial);

That made the column unique in the database.

I went in to the web interface and tried to add a computer with a duplicate serial number. I clicked "Add" and this is what happen:

1. The item was obviously not created because MySQL did not let it happen.
2. Even though the add operation was not successful, there was no error message to let me know that something failed.
3. Even though the add operation was not successful, the GLPI logs, nevertheless, marked the operation as sucessful.

So I partially got what I wanted, but I was expecting a message saying the Database Add operation failed. I know I was tampering with the database and I created a non-foreseeable situation, but still I thing the DB Add error should has been catch and feedback provided to the user. I was expecting a message on the top: "Could not add item" in the same manner you get a feedback message saying "Item Add Successfully" when adding a computer works.

I was wondering if there is any other kind of error while writing to the database (imagine a connection error to the database server), would an error message be displayed to the user, and a failed operation logged? My guess is not.

To any developer out there, could this error catching/reporting be implemented on next version?

After that, maybe you can add a global option that will set the serial number as unique if you wanted to? Perhaps switching between the above MySQL command and "ALTER TABLE glpi_computers DROP index serial;"

Thanks.

Guillermo.
GLPI Version: 0.72.21


Glpi: 10.0.1

Offline

#2 2009-10-21 17:22:34

bwm367
Member
From: Maine, United States
Registered: 2009-01-06
Posts: 217
Website

Re: Inventory: Unique Serial numbers / No Error Message when DB Add fails

I don't know if making the serial number unique would be inherently necessary, since there are already ways to check for duplicates based on the serial number fields. Maybe the rationale is to allow duplicates to be entered, as to not cause errors, and allow the user to correct it themselves.

It would be a nice feature to have GLPI alert you when trying to add a PC that the name, MAC address, Serial number or any other fields you flag were already being used, however.


My Configuration: GLPI .72.3 running on XAMPP from a VMware Virtual Machine (Windows XP). PHP 5.2, Apache 2.2.3...

Offline

#3 2009-10-21 17:38:37

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: Inventory: Unique Serial numbers / No Error Message when DB Add fails

And by experience, and can say than serial is NOT unique.

(manufacturer + model + serial should be unique)

+


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#4 2009-10-23 07:45:59

netix
Member
Registered: 2009-10-16
Posts: 8

Re: Inventory: Unique Serial numbers / No Error Message when DB Add fails

remi wrote:

And by experience, and can say than serial is NOT unique.

(manufacturer + model + serial should be unique)

+

not always
FUJITSU SIEMENS    Amilo A 7640    12345678   
FUJITSU SIEMENS    Amilo A 7640    12345678
FUJITSU SIEMENS    Amilo A 7640    12345678
etc ...

Offline

#5 2009-10-23 07:53:17

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: Inventory: Unique Serial numbers / No Error Message when DB Add fails

When I say "serial is NOT unique", I mean :

LENOVO - Thinkcentre E51 (8467A3G) - L3A4471
LENOVO - Thinkcentre A53 (9628W2R) - L3A4471
LENOVO - Thinkcentre E50 (8818D34) - L3A4471

In my example, this are really 3 distinct computers.

In your example Manufacturer AND model AND serial are equal.

+


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#6 2011-09-12 14:37:42

kriber
Member
From: Germany
Registered: 2010-12-10
Posts: 16

Re: Inventory: Unique Serial numbers / No Error Message when DB Add fails

Dear Remi,

I post here because it fits, although it is an old thread.

Serials are not unique, I agree, but I have a bunch of computers to add (via Data Injection) that already exist in GLPI but only with its serial no.
I would like to insert extra data to those computers, but using Data Injection adds a new instance of each computer.

my Options:
Allow lines creation : yes
Allow lines update : yes   
Allow creation of dropdowns :    yes
Allow update of existing fields : yes
plus, I tried both mandatory field: yes/no

I also read this http://www.glpi-project.org/forum/viewt … p?id=14233 - part 1 talks about mandatory fields, but I guess only for the import itself not the comparison of existing and importing data...

- How can I update existing computers?
- Which fields have to be identical to be regognized as an existing computer to be updated?

I am using Data Injection Version 1.7.2
(after the Import I would like to upgrade to glpi 0.80, but Data Injection is not available for 0.80 I still use the old version).

thanks a lot for any advice.


GLPI 0.80.5 | Ubuntu Server 10.04.1 lts | Apache 2.2.14 | PHP 5.3.2-1 | MySQL  5.1.41

Offline

#7 2011-10-11 10:48:38

kriber
Member
From: Germany
Registered: 2010-12-10
Posts: 16

Re: Inventory: Unique Serial numbers / No Error Message when DB Add fails

Hi again,

I just want to push this thread.

My question is: How can I import data with updating and(!) creating new asset, meaning, which field is set to be unique to recognize an existing asset to be updated.

thanks



EDIT:

I guess I found it:

- probably it is: "Port unicity criteria" (there it says something about "lfd. Nummer", what probably intends to mean Inventory Number, but because, the field above is about some 'network' configuration, I did not think of port as it was ment here... but some network port... sometimes it is hard to get the point, with all the different languages smile

thanks

Last edited by kriber (2011-10-11 14:34:34)


GLPI 0.80.5 | Ubuntu Server 10.04.1 lts | Apache 2.2.14 | PHP 5.3.2-1 | MySQL  5.1.41

Offline

Board footer

Powered by FluxBB