/**
* @since version 0.84 (before in entitydata.class)
*
* @param $field
* @param $values
* @param $options array
**/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'use_licenses_alert':
case 'use_contracts_alert':
case 'use_infocoms_alert':
case 'is_notif_enable_default':
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return Dropdown::getYesNo($values[$field]);
case 'use_reservations_alert':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('Never');
}
return sprintf(_n('%d hour', '%d hours', $values[$field]), $values[$field]);
case 'default_cartridges_alarm_threshold':
case 'default_consumables_alarm_threshold':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('Never');
}
return $values[$field];
case 'send_contracts_alert_before_delay':
case 'send_infocoms_alert_before_delay':
case 'send_licenses_alert_before_delay':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('No');
}
return sprintf(_n('%d day', '%d days', $values[$field]), $values[$field]);
case 'cartridges_alert_repeat':
case 'consumables_alert_repeat':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case self::CONFIG_NEVER:
case 0:
// For compatibility issue
return __('Never');
case DAY_TIMESTAMP:
return __('Each day');
case WEEK_TIMESTAMP:
return __('Each week');
case MONTH_TIMESTAMP:
return __('Each month');
default:
// Display value if not defined
return $values[$field];
}
break;
case 'notclosed_delay':
// 0 means never
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('Never');
}
return sprintf(_n('%d day', '%d days', $values[$field]), $values[$field]);
case 'auto_assign_mode':
return self::getAutoAssignMode($values[$field]);
case 'tickettype':
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return Ticket::getTicketTypeName($values[$field]);
case 'autofill_buy_date':
case 'autofill_order_date':
case 'autofill_delivery_date':
case 'autofill_use_date':
case 'autofill_warranty_date':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case Infocom::COPY_WARRANTY_DATE:
return __('Copy the start date of warranty');
case Infocom::COPY_BUY_DATE:
return __('Copy the date of purchase');
case Infocom::COPY_ORDER_DATE:
return __('Copy the order date');
case Infocom::COPY_DELIVERY_DATE:
return __('Copy the delivery date');
default:
if (strstr($values[$field], '_')) {
list($type, $sid) = explode('_', $values[$field], 2);
if ($type == Infocom::ON_STATUS_CHANGE) {
// TRANS %s is the name of the state
return sprintf(__('Fill when shifting to state %s'), Dropdown::getDropdownName('glpi_states', $sid));
}
}
}
return __('No autofill');
case 'inquest_config':
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return TicketSatisfaction::getTypeInquestName($values[$field]);
case 'default_contract_alert':
return Contract::getAlertName($values[$field]);
case 'default_infocom_alert':
return Infocom::getAlertName($values[$field]);
case 'entities_id_software':
if ($values[$field] == self::CONFIG_NEVER) {
return __('No change of entity');
}
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return Dropdown::getDropdownName('glpi_entities', $values[$field]);
case 'tickettemplates_id':
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return Dropdown::getDropdownName('glpi_tickettemplates', $values[$field]);
case 'calendars_id':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('24/7');
}
return Dropdown::getDropdownName('glpi_calendars', $values[$field]);
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}