public function getLinkedItemDetails($itemtype, $items_id) { $comments = ""; switch ($itemtype) { case 'ConsumableItem': $ci = new Consumable(); if ($ci->getFromDB($items_id)) { $ct = new ConsumableItem(); $ct->getFromDB($ci->fields['consumableitems_id']); $comments .= "<strong>" . __("Entity") . ":</strong> "; $comments .= Dropdown::getDropdownName("glpi_entities", $ct->fields["entities_id"]); $comments .= '<br><strong>' . __("Consumable") . ' : </strong> #' . $items_id; $comments .= '<br><strong>' . __("Consumable type") . ' : </strong>'; $comments .= $ct->fields['name']; $comments .= '<br><strong>' . __("Manufacturer") . ' : </strong>'; $comments .= Dropdown::getDropdownName('glpi_manufacturers', $ct->fields['manufacturers_id']); $comments .= '<br><strong>' . __("State") . ' : </strong>'; $comments .= !$ci->fields['users_id'] ? __("In stock") : __("Used"); if ($ci->fields['users_id']) { $comments .= '<br><strong>' . __("User") . ' : </strong>'; $comments .= Dropdown::getDropdownName('glpi_users', $ci->fields['users_id']); } } break; case 'CartridgeItem': $ci = new Cartridge(); if ($ci->getFromDB($items_id)) { $ct = new CartridgeItem(); $ct->getFromDB($ci->fields['cartridgeitems_id']); $comments .= "<strong>" . __("Entity") . ":</strong> "; $comments .= Dropdown::getDropdownName("glpi_entities", $ct->fields["entities_id"]); $comments .= '<br><strong>' . __("Cartridge") . ' : </strong> #' . $items_id; $comments .= '<br><strong>' . _n("New", "New", 2) . ' : </strong>'; $comments .= $ct->fields['name']; $comments .= '<br><strong>' . __("Manufacturer") . ' : </strong>'; $comments .= Dropdown::getDropdownName('glpi_manufacturers', $ct->fields['manufacturers_id']); } break; // case 'Computer' : // case 'Monitor' : // case 'NetworkEquipment' : // case 'Peripheral' : // case 'Phone' : // case 'Printer' : // case 'Computer' : // case 'Monitor' : // case 'NetworkEquipment' : // case 'Peripheral' : // case 'Phone' : // case 'Printer' : default: $item = new $itemtype(); $item->getFromDB($items_id); if ($item->getField("name")) { $comments .= "<strong>" . __("Name") . ":</strong> "; $comments .= $item->getField("name"); } if ($item->getField("entities_id")) { $comments .= "<strong>" . __("Entity") . ":</strong> "; $comments .= Dropdown::getDropdownName("glpi_entities", $item->getField("entities_id")); } if ($item->getField("serial") != '') { $comments .= "<br><strong>" . __("Serial number") . ":</strong> "; $comments .= $item->getField("serial"); } if ($item->getField("otherserial") != '') { $comments .= "<br><strong>" . __("Inventory number") . ":</strong> "; $comments .= $item->getField("otherserial"); } if ($item->getField("locations_id")) { $comments .= "<br><strong>" . __("Location") . ":</strong> "; $comments .= Dropdown::getDropdownName('glpi_locations', $item->getField("locations_id")); } if ($item->getField("users_id")) { $comments .= "<br><strong>" . __("User") . ":</strong> "; $comments .= Dropdown::getDropdownName('glpi_users', $item->getField("users_id")); } break; } return $comments; }