Filter status by item

Goal

Do not display all statuses for all items. For example software statuses may not be the same as computer ones.

Database changes

Add the following fields (bool) + indexes in glpi_states :
  • is_visible_computer
  • is_visible_softwareversion
  • is_visible_monitor
  • is_visible_printer
  • is_visible_peripheral
  • is_visible_phone
  • is_visible_networkequipment

Interface

Add 7 yes/no dropdowns in status form.

In each form, filter dropdown using the itemtype :

State::dropdown(array('value' => $this->fields["states_id"],
                      'condition' => "`is_visible_softwareversion`='1'"));

h2. Search options

Add a condition to restrict status list in search engine.
For example for a computer :

      $tab[31]['table']          = 'glpi_states';
      $tab[31]['field']          = 'completename';
      $tab[31]['name']           = __('Status');
      $tab[31]['datatype']       = 'dropdown';
      $tab[31]['condition']      = "`is_visible_computer`='1'";