Hi, 

Actually, if you want to do such things, I advice you to rename your object 
fields. In GLPI, it is more Items than objects. 

Several GLPI sql tables has those two fields (e.g. glpi_computers_items) : 

-items_id 
-itemtype 


This way ,you will be able to use common functions like getTableForItemtype, 
that returns you e.g. the table glpi_computers by giving "computers". 










Anthony HEBERT 
Responsable d'agence 
Tel. +33 (0) 666 895 118 
aheb...@teclib.com 

teclib SAS 
20 rue d'Agen 
68000 Colmar 
Tel : +33 (0)1 79 97 02 78 / Fax : +33 (0)1 72 70 31 18 
























----- Mail Original ----- 
De: "Guillaume Rousse" <guillomovi...@gmail.com> 
À: glpi-dev@gna.org 
Envoyé: Mercredi 29 Juin 2011 14:17:25 
Objet: [Glpi-dev] How to reference a GLPI object of arbitrary type ? 

Hello list. 

Our financial staff wants an exhaustive list of reasons about assets 
removed from inventory: lost, stolen, ceased to public domain through 
agreement X or Y, etc... Rather than messing with current status list, 
and making it 400% larger, just for 1% of assets, I'm trying to create a 
new very simple plugin, just to manage this additional piece of information. 

Basically, I need to manage a configurable list of additional status, 
and then to be able to affect this status of every type of GLPI objects 
(including the ones managed by generic object plugin). The first one 
should be easy, with a simple glpi_dropdown_plugin_extstatus_status 
table with two fields (ID, name). However, the second seems to be a 
little more difficult, given than every type of GLPI object is managed 
separatly, in a distinct table, without a unique ID. I'm supposing using 
a two-fields foreign key should works: 
- object_type 
- FK_object 
- FK_status 

'computer', 34, 1 -> computer 34 has status 1 
'network', 27, 2 -> network 27 has status 2 
etc... 

Is there any better solution ? I tried to find how financial 
informations (which are also available for every type of objects) were 
implemented, I couldn't find how. 
-- 
BOFH excuse #158: 

Defunct processes 

_______________________________________________ 
Glpi-dev mailing list 
Glpi-dev@gna.org 
https://mail.gna.org/listinfo/glpi-dev 
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to