Manage shared stock across entities¶
When trying to link a computer coming from the inventory system with one already present, GLPI looks for a computer in the target entity.
The computer may be in stock but in another entity. So the default behavior needs to be improved.
Link process improvements¶
When linking a computer, look for a computer in GLPI in the target entity, and in another entity defined in the entity's form. So
The shared stock entity is a new field in glpi_entitydatas. It's inherit from a parent entity (same as inquiry for example).
Add field in glpi_entitydatas : entities_id_stock int (11) not null default '-1'
Values : -1 means not using shared stock, > 1 entities_id in which to look for computer
In OcsServer::importComputer() just before going into the import or link rules engine, get the shared stock entity is there's one configured, and add to to the engine parameters.
The link request will look for a computer in the target entity AND in the shared entity.
If a computer in the shared entity stock, it'll be transfered in the target entity before being linked.