Objeto genérico

Download

Sources

https://github.com/pluginsGLPI/genericobject/releases

https://github.com/pluginsGLPI/genericobject

Requirements (on-premise)

GLPI Version

Minimum PHP

Recommended

10.0.x

8.1

8.2

Nota

This plugin is available without a GLPI-Network subscription. It is also available in Cloud

Funcionalidades

Este plugin permite que você adicione novos tipos de objetos de inventário, integrados à estrutura GLPI.

Oferece suporte as seguintes funções do GLPI:

  • gerenciamento de entidades e subentidades;

  • pesquisa;

  • modelos;

  • histórico;

  • integração com o helpdesk;

  • Integração de plugin de injeção de arquivo CSV;

  • Integração de plugins de desinstalação de itens;

  • integração de plugins de gestão de pedidos.

Exemplos de uso

Objetivo: Gerenciar sua frota de automóveis como o resto de seus ativos de TI.

  • Crie um novo tipo de objeto de inventário carro.

  • Adicione os campos precisos para um carro, como: nome, número de série, número de inventário, tipo, modelo, cor, estado, etc.

  • Descrever o comportamento de um carro: visível na subentidade, manter o histórico, etc.

  • Ajuste os direitos nos carros.

  • Ative o objeto carros.

  • Organize a sua coleção de carros no GLPI.

Instalar o plugin

  • Descompacte o arquivo.

  • Mova o diretório genericobjeto para o diretório <GLPI_ROOT>/plugins

  • Navegue até a página *Configuração > Plugins

  • Instalar e ativar o plugin

Uso

Criar um novo tipo de objeto

Este é o primeiro passo.

  • Clique no botão * + * no formulário de configuração do plugin.

  • Criar um novo tipo de objeto de inventário:

    • Nome: obrigatório, minúsculo, e deve ser composto de letras apenas;

    • etiqueta: por padrão, o mesmo que o nome

  • Validar.

  • Ativar o novo tipo de item para usá-lo.

Exemplo: Criar um novo tipo de objeto de inventário carro.

Editar etiquetas

Para cada tipo, um arquivo de idioma está disponível em <GLPI_ROOT>/files/_plugins/genericobject/locales/itemtype/

O plugin cria:

  • um arquivo de idioma para o idioma atual

  • um arquivo de idioma para o idioma padrão do GLPI

Nota

Se os idiomas atuais e o padrão forem os mesmos, apenas um arquivo é criado.

Para alterar a etiqueta do itemtype, para o idioma inglês, edite o arquivo:

<?php
// <GLPI_ROOT>/files/_plugins/genericobject/locales/<itemtype>/<itemtype>.en_GB.php
$LANG['genericobject']['<itemtype>'][1] = "<type's label>";

You can also define labels globally in <GLPI_ROOT>/files/_plugins/genericobject/locales/fields.<lang>.php files:

<?php
// <GLPI_ROOT>/files/_plugins/genericobject/locales/<itemtype>/<itemtype>.en_GB.php
$LANG['genericobject']['fields']['<itemtype>'] = "<type's label>";

Comportamento de configuração

Exemplo: Descreva o comportamento de um carro: visível na subentidade, manter o histórico, etc.

O novo tipo vai ser gerenciado da mesma maneira que os tipos comuns do GLPI (computador, monitor, dispositivo de rede, etc.)

Nota

Todos os objetos são pelo menos atribuídos a uma entidade

The Behaviour tab allows you to define:

  • child-entities: allows the type to be recursive;

  • Helpdesk: allows an object to be associated to a ticket;

  • Lixeira: Use a funcionalidade de lixeira do GLPI;

  • Anotações: use a funcionalidade de anotações do GLPI;

  • Histórico: Permite histórico para este tipo;

  • Modelos: permite a gestão de modelos;

  • Documentos: permite que documentos sejam anexados a um objeto deste tipo;

  • Loans: allows objects to be loaned;

  • Contracts: link an object to one or more contracts;

  • Network connections: allow ports to be used and management for this type;

  • CSV file injection plugin: allows this type to be available for use in the plugin;

  • Item uninstallation plugin: allows this type to be uninstalled;

  • Order management plugin: allows this type to be linked to an order;

Adicionar campos

Example: Add the accurate fields for a car, like: name, serial number, inventory number, type, model, color, state, etc.

Navigate to the Fields tab.

The plugin comes with several ready to use fields:

  • Nome

  • Tipo

  • Modelo

  • Número de série

  • Número de inventário

  • Usuário do item

  • Grupo

  • Situação

  • Comentários

  • Anotações

  • Localização

  • Outro

  • Fabricante

  • URL

  • Data de criação

  • Data de vencimento

  • Categoria

  • Visível no Helpdesk

  • Técnico responsável pelo hardware

  • Domínio

  • Contato

  • Número de contato

Nota

Using some behaviour will automatically add some fields to the object:

  • network connection => location

  • empréstimos => localização

  • helpdesk => é visível no Helpdesk

  • anotações => bloco de anotações

Helpdesk integration

To use an object in the helpdesk, use following setup:

  • 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 to).

  • 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

Nota

New fields will be available for all object’s types.

  • Create a new file named <GLPI_ROOT>/files/_plugins/genericobject/fields/<type>.constant.php

For example, for a car type the constant file will be <GLPI_ROOT>/files/_plugins/genericobject/fields/car.constant.php.

Please note that the file’s first line must be the following, otherwise the new fields won’t appear in the list:

<?php
global $GO_FIELDS, $LANG;
  • Add the new fields definitions.

Add a simple dropdown field

<?php
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['name']       = $LANG['genericobject']["<type's name>"][2];
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['field']      = 'color';
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['input_type'] = 'dropdown';

Nota

The language variable must be defined in the language file (see explaination above).

  • Add a dropdown field that is assigned to an entity:

<?php
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['name']         = $LANG['genericobject']["<type's name>"][2];
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['field']        = 'color';
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['input_type']   = 'dropdown';
//Does the dropdown take care of entities ? (true/false)
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['entities_id']  = true;
//Can values be recursive ? (true/false, only taking in account if entities_id is set to true)
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['is_recursive'] = true;

Add a tree dropdown field

<?php
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['name']       = $LANG['genericobject']["<type's name>"][2];
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['field']      = 'color';
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['input_type'] = 'dropdown';
//Is it a tree-dropdown, or a simple one ? (true/false)
$GO_FIELDS['plugin_genericobject_mytypecolors_id']['is_tree']    = true;

Nota

You can use at the same time the following parameters : entities_id, is_recursive, is_tree.

Add a dropdown field that is based on a GLPI-core object (user, location…)

<?php
$GO_FIELDS['users_id_passengers_id']['name']       = 'Passenger';
$GO_FIELDS['users_id_passengers_id']['input_type'] = 'dropdown';

Nota

Name between brackets ([]) MUST begin with users_id in order to be recognized as a field based on GLPI users” list.

See file <GLPI_ROOT>/files/_plugins/genericobject/fields/field.constant.php to get a complete list of available fields.

Add a global dropdown

A global dropdown can be used in all itemtypes. A good example would be :

<?php
$GO_FIELDS['categories_id']['name']          = $LANG['common'][36];
$GO_FIELDS['categories_id']['input_type']    = 'dropdown';
$GO_FIELDS['categories_id']['dropdown_type'] = 'global';

A specific category table will be created for each itemtype. The table name and field name will the computed this way:

  • table : glpi_plugin_genericobject_<itemtypename>_category

  • field name : plugin_genericobject_<itemtype>categories_id

Add an integer field

<?php
$GO_FIELDS['testinteger']['name']       = 'testinteger';
$GO_FIELDS['testinteger']['input_type'] = 'integer';
$GO_FIELDS['testinteger']['min']        = 10; //not mandatory, by default 0
$GO_FIELDS['testinteger']['max']        = 40; //not mandatory, by default 100
$GO_FIELDS['testinteger']['step']       = 3; //not mandatory, by default 1

Add a text field

<?php
$GO_FIELDS['mytextfield']['name']       = 'My text field';
$GO_FIELDS['mytextfield']['input_type'] = 'text';

Alterado na versão 2.1.2: By adding the following argument, you can tell the plugin that this field can be automatically generated when using a template:

<?php
$GO_FIELDS['mytextfield']['autoname'] = true;

Add a Yes/No field

<?php
$GO_FIELDS['mybooleanfield']['name']       = 'My boolean field';
$GO_FIELDS['mybooleanfield']['input_type'] = 'bool';

Add a date field

<?php
$GO_FIELDS['creationdate']['name']       = $LANG['genericobject']['fields'][30];
$GO_FIELDS['creationdate']['input_type'] = 'date';

Add a date & time field

<?php
$GO_FIELDS['creationdate']['name']       = $LANG['genericobject']['fields'][30];
$GO_FIELDS['creationdate']['input_type'] = 'datetime';

Nota

If you don’t want a field to be modified using massive actions, add the following line to its definition:

<?php
$GO_FIELDS['myfield']['massiveaction'] = false;

Add global fields

To make your fields accessible to all itemtypes:

  • Create a file named <GLPI_ROOT>/files/_plugins/genericobject/fields/field.constant.php

  • Put your definitions in this file.

Setup 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, no.

To associate the rights you can either:

  • Use the Rights tab in the itemtype form.

  • Navigate to Administration > Profiles and administer the rights for each profile.

Use the new field

Activate the new type, it’s now ready to be used.

The new type is available for users in the Plugins > Objects management menu.

Use case of Generic Object as a CMMS

Purpose of this documentation

Showing a complete usage of Generic Object as a CMMS (Computerized Maintenance Management System) in biomedical environment.

At the end of this use case, you will have :

  • a dedicated Biomed entity (under Root entity)

  • containing Biomedical objects (in Assets menu)

  • with built-in and user-defined fields

  • manages by users with Admin_biomed profile

Steps

Following steps assume you have a Super-Admin authorization :

  • Installing Generic Object on GLPI (validated with genericobject >= 0.85-1.0 and GLPI >= 0.90)

  • Generic Object configuration

  • GLPI configuration

  • Start using Generic Object and GLPI

Installing Generic Object on GLPI

See Instalar o plugin section.

Generic Object configuration

Create your type of object

See Criar um novo tipo de objeto section and use biomedical as internal identifier. Label will be set automatically to Biomedical (with an uppercase B).

After a logoff/login, you will see Biomedical menu in Assets.

Define Biomedical’s new fields

These fields will be usable only by Biomedical’s objects :

  • Create a new file named : <GLPI_ROOT>/files/_plugins/genericobject/fields/biomedical.constant.php

  • Add following content :

<?php
global $GO_FIELDS, $LANG;

// CODE CNEH
$GO_FIELDS['plugin_genericobject_cnehcodes_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][1];
$GO_FIELDS['plugin_genericobject_cnehcodes_id']['field']      = 'cnehcode';
$GO_FIELDS['plugin_genericobject_cnehcodes_id']['input_type'] = 'dropdown';

//  REFORME (yes or no)
$GO_FIELDS['reformed']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][2];
$GO_FIELDS['reformed']['input_type'] = 'bool';

// CLASSE CE (3 choix possibles 1,2a ou 2b)
$GO_FIELDS['plugin_genericobject_classeces_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][3];
$GO_FIELDS['plugin_genericobject_classeces_id']['field']      = 'classce';
$GO_FIELDS['plugin_genericobject_classeces_id']['input_type'] = 'dropdown';

// UF (Unité Fonctionnelle)
$GO_FIELDS['plugin_genericobject_ufs_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][4];
$GO_FIELDS['plugin_genericobject_ufs_id']['field']       = 'uf';
$GO_FIELDS['plugin_genericobject_ufs_id']['input_type'] = 'dropdown';

// PRESTATAIRE BIOMED
$GO_FIELDS['plugin_genericobject_prestataires_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][5];
$GO_FIELDS['plugin_genericobject_prestataires_id']['field']       = 'prestataire biomed';
$GO_FIELDS['plugin_genericobject_prestataires_id']['input_type'] = 'dropdown';

// TYPE D'EQUIPEMENT BIOMED
$GO_FIELDS['plugin_genericobject_typedequipementbiomeds_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][6];
$GO_FIELDS['plugin_genericobject_typedequipementbiomeds_id']['field']       = "type d 'equipement biomed";
$GO_FIELDS['plugin_genericobject_typedequipementbiomeds_id']['input_type'] = 'dropdown';

// Criticite
$GO_FIELDS['plugin_genericobject_criticites_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][7];
$GO_FIELDS['plugin_genericobject_criticites_id']['field']      = 'criticite';
$GO_FIELDS['plugin_genericobject_criticites_id']['input_type'] = 'dropdown';

// Numéro marquage CE
$GO_FIELDS['plugin_genericobject_marquageces_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][8];
$GO_FIELDS['plugin_genericobject_marquageces_id']['field']      = 'marquagece';
$GO_FIELDS['plugin_genericobject_marquageces_id']['input_type'] = 'dropdown';

// Classe électrique
$GO_FIELDS['plugin_genericobject_classeelecs_id']['name']       = $LANG['genericobject']['PluginGenericobjectBiomedical'][9];
$GO_FIELDS['plugin_genericobject_classeelecs_id']['field']      = 'classeelec';
$GO_FIELDS['plugin_genericobject_classeelecs_id']['input_type'] = 'dropdown';
?>

Aviso

Trailing s_id is mandatory in [plugin_genericobject_field*s_id*] because the GLPI framework requires foreign key fields to end with s_id. In database, glpi_plugin_genericobject_fields is table name and id, its foreign key. See GLPI developer documentation.

Define fields labels

See Editar etiquetas section.

  • Edit your locales file, for example : <GLPI_ROOT>/files/_plugins/genericobject/locales/biomedical/biomedical.fr_FR.php

  • Adicione o conteúdo a seguir no final do arquivo:

<?php
// Fields
$LANG['genericobject']['PluginGenericobjectBiomedical'][1]="Code CNEH";
$LANG['genericobject']['PluginGenericobjectBiomedical'][2]="Réformé";
$LANG['genericobject']['PluginGenericobjectBiomedical'][3]="Classe CE";
$LANG['genericobject']['PluginGenericobjectBiomedical'][4]="UF";
$LANG['genericobject']['PluginGenericobjectBiomedical'][5]="Prestataire Biomed";
$LANG['genericobject']['PluginGenericobjectBiomedical'][6]="Type d'équipement biomed";
$LANG['genericobject']['PluginGenericobjectBiomedical'][7]="Criticité";
$LANG['genericobject']['PluginGenericobjectBiomedical'][8]="Marquage CE";
$LANG['genericobject']['PluginGenericobjectBiomedical'][9]="Classe électrique";

Definir comportamentos

No menu «Plugins > Gerenciamento de objetos», na aba Principal, selecione:

  • Item in the dustbin

  • Histórico

  • Informações financeiras e administrativas

  • Documentos

  • Pesquisa global

  • Assistência

  • Modelos

  • Contratos

  • Pesquisa global

This will add ready to use fields to your type of object.

Add fields to your type of object

In Plugins > Objects management menu, on Fields tab, you can now add fields to Biomedical type of object :

GLPI configuration

Define Admin_biomed profile

  1. Clonar perfil Administrador

  2. Set following rights in Admin_biomed profile :

    • Administration > Profiles > Admin_biomed > Assets tab > Unselect all

    • Administration > Profiles > Admin_biomed > Assistance tab > Association > Associable items to a ticket > Biomedical

    • Administration > Profiles > Admin_biomed > Management tab > Select all

    • Administration > Profiles > Admin_biomed > Objects management tab > Biomedical > Select all

Nota

With these settings, Admin_biomed users only see Biomedical in Assets menu.

Define Biomed entity and authorizations rules

  1. Create Biomed entity under Root entity in Administration > Entities

  2. Configure authorizations rules to assign Admin_biomed profile to Biomed entity users.

Start using Generic Object and GLPI

As Admin_biomed user, you can create your first object in Assets > Biomedical.

In order to gain time, define values in Setup > Dropdowns > Objects management for new fields.

FAQ

If you have any questions about using the plugin, please consult our FAQ

Creative Commons License