How does the plugin works¶This plugin allows you to add new inventory objects type, integrated into GLPI framework.
- entity and sub-entities management
- helpdesk integration
- CSV file injection plugin integration
- order management plugin integration
- inventory number generation plugin
Once the archive uncompressed and the genericobject directory move to <glpi root>/plugins, you just have to go the the "Configuration -> Plugins" page, in order to install and active it.
New object type creation¶
To use a new inventory object, his type must be created first. To do it, it's necessary to create the new type by clicking on the + button form the plugin configuration form.
- It's mandatory to fill a new : it must be lowercase, and must be composed of letters only
- An internal type number is generated by the plugin
- The type's label is, by default, the same as the name
- Once the type defined, it must be activated in order to be used
Type's label modification¶It's possible to modify the label of an object type by adding a new language file in the plugin's tree.
The file must be like this :
- for english : <glpi root>/plugins/genericobject/objects/<type's name>/<type's name>.en_GB.php
It must contain, at least :
<?php $LANG['genericobject']['<type's name>'] = '<type's label>'; ?>
Once the plugin's type created, it's now time to define how it'll behave. The new type will be managed the same way as the core's types (computer, monitor, network devices, etc)The Behaviour tab allows you to define :
- Entities : allows the type to be attached to one entity
- Sub-entites : allows the type to be recursive
- Helpdesk : allows an object of this type to be used in helpdesk (visible in 'My devices' and 'All devices')
- Trash : use GLPI's trash functionnality
- Notes : use GLPI's note functionnality
- History : allow history for this type
- Templates : allows template management
- Documents : allows documents to be attached to an object of this type
- Loans : allows objects to be loaned
- network connections : allow ports to be used and management for this type
- direct connections : allows this type to be connected to a computer
- CSV file injection plugin : allows this type to be available for use in the plugin
- item's uninstallation plugin : allows this type to be uninstalled
- order management plugin : allow this type to be ordered inside the order management plugin
- inventory number generation plugin : allow inventory number field to be management by this plugin
Fields¶Now we can add new fields to the type. To do it, you need to go to the Fields tab.
The plugin comes with several ready to use fields :
- serial number
- inventory number
- item's user
- Creation date
- Expiration date
- Visible in Helpdesk
- Technician in charge of the hardware
- Contact number
- direct connections : location, user, group and state
- network connection : location
- inventory number generation plugin : inventory number
Helpdesk integration¶You can use an object in the helpdesk, but it's necessary to pay attention to the following instructions :
- in Behaviour tab : use helpdesk must be set to Yes
- if the User field is defined, it allows item to be visible in the 'My Items' list (as item whose owner is the user)
- if the Group field is defined, it allows item to be visible in the 'My Items' list too (as item belonging to a group in which the user belongs too)
- if Helpdesk visible field is set and if the value is set to No in the object, then the object won't be visible at all in the helpdesk
Add new fields¶
It's possible to add news fields but they'll be available for use for all the object's types.
Right now, it's possible to add new fields by adding a new file in the plugin's tree.
The file must be <glpi root>/plugins/genericobject/fields/constants/<type'name>.php and contains the new fields definitions.
The following example demonstrates the declaration of the new field called 'color' :
$GENERICOBJECT_AVAILABLE_FIELDS['color']['name']=$LANG['genericobject']['<type's name>']; $GENERICOBJECT_AVAILABLE_FIELDS['color']['field']='color'; $GENERICOBJECT_AVAILABLE_FIELDS['color']['input_type']='text';
Note : the language variable must be defined in the language file (see explaination above).
This next example adds a new field called 'name'. The 'datatype' directive will display a link to direct access to the object's form.
$GENERICOBJECT_AVAILABLE_FIELDS['name']['name']=$LANG['genericobject']['<type's name>']; $GENERICOBJECT_AVAILABLE_FIELDS['name']['field']='name'; $GENERICOBJECT_AVAILABLE_FIELDS['name']['input_type']='text'; $GENERICOBJECT_AVAILABLE_FIELDS['name']['datatype']='itemlink';
The following code adds a new field called category whose type if dropdown. It'll also create a new, separate table,in order to store the dropdown's values :
$GENERICOBJECT_AVAILABLE_FIELDS['category']['name']=$LANG['common']; $GENERICOBJECT_AVAILABLE_FIELDS['category']['field']='name'; $GENERICOBJECT_AVAILABLE_FIELDS['category']['linkfield']='category'; $GENERICOBJECT_AVAILABLE_FIELDS['category']['input_type']='dropdown'; $GENERICOBJECT_AVAILABLE_FIELDS['category']['dropdown_type']='type_specific';
Rights¶You can define access rights for each object's type, for each profile. Available options are :
- right on the type : no access / read / write
- right to associate this type of object to tickets : yes / non
Once activated, the new type is ready to be used. It's available for users in the 'Plugins -> Objects management' menu.