UnicityCriteriaOld

  • Dropdown "Unicity Activation"
    • None : state for disable unicity.
    • Global : state for unicity field
      • If the field is marked as global, it means that the value must be unique, whatever the entity and the value cannot be overridden in a subentity.
      • So, a subentity local administrator can't change the state of unicity for this field.
    • Local : state for unicity field
      • If the field is marked as local, then his value can be overridden in a subentity.
      • So, a subentity local administrator can change the state of unicity for this field.
  • Possible case for dropdown "Unicity" of object (only underline values) :
MAPPING name serial otherserial domain mac ip
name name name+serial name+otherserial name+domain name+mac name+ip
serial X serial serial+otherserial serial+domain serial+mac serial+ip
otherserial X X otherserial otherserial+domain otherserial+mac otherserial+ip
domain X X X domain domain+mac domain+ip
mac X X X X mac mac+ip
ip X X X X X ip

MoYo : Why using only 1 or 2 datas to be unique ? may I do not understand.
- If it is the couple of values which must be unique why just only a couple ?
- If the 2 items of the couple are independent why a dropdown for that ?
- Maybe the 2 may be possible but how do that ? not using a dropdown. Maybe a complex mix of both ideas ?
Yeti : Ok, my proposal was made to start a discussion about that.
- I wanted to "list" all of possible couple of unicity for each inventory object. But yes, you are right, I have forgotten that a user can select more than two values for define its criteria.
- So, user can put its criteria in this possible interface (if he have chosen Local), see bellow.
- And for completeness, we could execute getSearchOptions of each inventory object to build the values allowed to be put in the fields HTML ?

Walid : how to check ip + mac address for example when an object is created (without networkport)... It seems to me quite impossible to check several criterias on several objects at the same time !

Unicity of inventory objects
X Computers Monitors Software Networks Devices Printers Cartridges Consumables Phone
Entity A serial+ip otherserial HTML <input type=text> HTML <input type=text> ... ... ... ... ...
Entity B name+mac name+serial ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ...

remi: FQDN (name + domain) ? immo_number ? IP ?
yeti : good idea, adding in the list is done.

Implementation

Files to edit
  • CLASS
    • inc/config.class.php
  • LANGS
    • locales/fr_FR.php
    • locales/en_GB.php
      • MoYo : en_GB dictionanry is translated in the online translation application. So not interesting to be updated.
Methods
  • ADD new section configuration in Config::showFormInventory function for showing new parameters of unicity.
Langs
  • $LANG['unicity'][0]="Unicity of inventory objects" / "Unicité des objets d'inventaire";
Interface
  • The dropdown activation : None / Global / Local
  • IF Global is selected : show the multidimensional array for selecting the criteria who's define unicity for each inventory object.
  • IF Local is selected : show the multidimensional array for selecting the criteria who's define unicity for each inventory object in particular entity or sub-entity.

BDD

CREATE TABLE  `glpi_field_unicities` (
                `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                `itemtype` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT  '',
                `entities_id` INT( 11 ) NOT NULL DEFAULT  '0',
                `field` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT  '',
                `is_global` TINYINT( 1 ) NOT NULL DEFAULT  '0'
                ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT =  'Stores field unicity criterias';