# Fields

Fields plugin allows to add additional fields on various items GLPI manages: tickets, computers, users, ...

## Sources

| Download                                         | Sources                                 |
| ------------------------------------------------ | --------------------------------------- |
| <https://github.com/pluginsGLPI/fields/releases> | <https://github.com/pluginsGLPI/fields> |

***

## Requirements (self-hosted)

| GLPI Version | Minimum PHP | Recommended |
| ------------ | ----------- | ----------- |
| 10.0.x       | 8.1         | 8.2         |
| 11.0.x       | 8.2         | 8.4         |

{% hint style="info" %}
This plugin is available without a [GLPI Network](https://services.glpi-network.com/#offers) subscription. It is also available on [GLPI Cloud](https://glpi-network.cloud).
{% endhint %}

***

## Install the plugin

* Go to the marketplace. Download and install the plugin **Fields**.

<div align="left"><figure><img src="https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2FVWY4qOsj1DynheJpuedB%2Ffields.png?alt=media&#x26;token=c051593b-ec22-4b04-bf2e-b16ae3d32361" alt=""><figcaption></figcaption></figure></div>

***

## Features

* Add containers block on various items,
* Add fields into blocks,
* Display blocks in an existing tab or in their own tab,
* Many fields types available,
* Fields can be flagged as required,
* Manage profiles ACLs per container,
* ...

***

## Install the Plugin

* Uncompress the archive.
* Move the `fields` directory to the `<GLPI_ROOT>/plugins` directory
* Navigate to the *Configuration > Plugins* page,
* Install and activate the plugin.

***

## Usage

The plugin will create required tables in the database and some files on disk (into `<GLPI_ROOT>/files/_plugins/fields`) automatically. Those files and tables will be updated along with the plugin.

Plugin usage is quite simple:

* create a block linked with some items,
* create fields in this block.

You will access the plugin configuration from the *Setup* > *Aditionnal fields* menu.

### Adding a new block

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-25dfe1a6e57585adf85f5b546109addba8e63b7f%2Fnew_block.png?alt=media)

* \`Label\`: the label of the block that will appears on items forms,
* \`Type\`: type of display, one of:
  * \`Add tab\`: will add a new tab on the item form containing the block,
  * \`Insertion in the form\`: will add the block at the end of the main item form,
  * \`Insertion in the form of a specific tab\`: will add the block at the end of a specific tab of the item.
* \`Associated item type\`: a list of items types on which the block will be added,
* \`Active\`: whether the block is active or not.

{% hint style="info" %}
You can add only one block of the type \[Insertion in the form]{.title-ref} for an associated item type.
{% endhint %}

Inserting a block in a specific tab is only possible for one item:

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-fc31b14b82f3b26430c3e248f637e91e44691aff%2Fnew_block_tab.png?alt=media)

Once a block have been created, it is possible to change its label or is active flag, but not its type or associated items list.

#### Profiles

You can refine profiles access on the block using the \[Profiles]{.title-ref} tab from the block. You will be able to choose either \[No access]{.title-ref}, \[Read]{.title-ref} or \[Write]{.title-ref} for every existing profile.

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-7a08205c843b2ce358ed0a9ce267772e1f0b4c76%2Fblock_profiles.png?alt=media)

### Adding a new field

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-e45057b7accfa3c61e08ac90de6251c484e42381%2Fblock_new_field.png?alt=media)

* \`Label\`: the label of the block that will appears on items forms,
* \[Type]{.title-ref} field type, one of:
  * \`Header\`: an header label, for visual distinction,
  * \`Text (single line)\[: a single line (]{.title-ref}\[input/@type="text"]{.title-ref}\`) of text,
  * \`Text (multiples lines)\[: a multiline (]{.title-ref}\[textarea]{.title-ref}\`) text,
  * \`Number\`: a single number (no text allowed),
  * \`Dropdown\`: a configurable dropdown list, values are configured from the main GLPI dropdown configuration you can find in *Setup* > *Dropdowns* menu,
  * \`Yes/No\`: a dropdown list with only \[Yes]{.title-ref} and \[No]{.title-ref} values,
  * \`Date\`: a standalone date with a date picker,
  * \`Date & time\`: a date field with a date picker and a time dropdown field (step is configured from GLPI core),
  * \`Users\`: list of users.
* \`Active\`: whether the block is active or not,
* \`Read only\`: flag this field as read only,
* \`Default values\`: default field values,
* \`Mandatory field\`: flag this field as mandatory.

{% hint style="warning" %}
Of course, you will need to pay attention playing with the various options... For example, if you flag a field as mandatory and as read only, and if you do not provide a default value, form validation will fail.

Another example: you should not set a text default value for a number field... That kind of things ;)
{% endhint %}

Once fields have been created, you can reorder or edit them from the Fields tab of the block:

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-fb8d6dda9fd4cb06e47c12d5e3489f95c4d4215d%2Fblock_list_fields.png?alt=media)

And see what it should look like on a \[User]{.title-ref} item for example:

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-fd11df92947508c7785658eef16064e6f020caff%2Fblock_user_display.png?alt=media)

***

## Search

All fields that have been added are available in the attached items search forms.

***

## Simplified Interface

Only blocks attached to tickets and with the type \[Insertion in the form]{.title-ref} will be displayed in the simplified interface of ticket creation. Of course, it will also take care of current profile rights!

***

## Translations

Added in version 1.4.0.

Plugin itself is translated using [the transifex services](https://www.transifex.com/teclib/glpi-plugin-plugin-fields); but you aslo can translate the label values for blocs and fields; the process is identical on both those ones:

On the block form, choose the *Translations* tab:

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-06cc12e0e4513bd64f86481257e53626b7b91aca%2Ftranslate_block_label.png?alt=media)

On block creation, a new translation with current language and value set as label will be created; you can add as many translations as you want.

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-1b13604d6b8d2e8ac0d6e5608a0c0313503c5138%2Fadd_block_label_translation.png?alt=media)

Dropdown values can be translated using the core's dropdown configuration.

{% hint style="warning" %}
As of GLPI 9.1.1; some issues on the core side prevent dropdown plugin values to be translated; the possibility has been deactivated in the plugin. It will be enabled again once the core has been fixed.
{% endhint %}

***

## Entities

If you are using entities in your GLPI instance, a block will be displayed only if the entity it is attached to is compatible with the one of the item it applies to.

When you create or edit a block in multi entities mode, you'll have to choose if the block will be available in children entities:

![image](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fgit-blob-d88fe1a7ec4190dec51776f8e4cee35898af061c%2Fblock_entities.png?alt=media)

As an example, let's say our entities have the following structure:

* `root`
  * `A`
    * `C`
  * `B`

The following table will tell you in wich cases the block is displayed or not:

| Block entity | Recursive block | Item entity | Block displayed |
| ------------ | --------------- | ----------- | --------------- |
| A            | Yes or No       | A           | Yes             |
| A            | Yes or No       | B           | No              |
| A            | Yes             | C           | Yes             |
| A            | No              | C           | No              |

***

## FAQ

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

<a href="https://app.gitbook.com/s/SvoJ3lioglS2UZLcWWyP/plugins/fields" class="button secondary">Go to FAQ</a>
