Skip to content

Commit

Permalink
Add Type To Computer_Item List
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmr committed Feb 7, 2024
1 parent 9a2c475 commit 469c1f5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Computer_Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,18 +411,24 @@ public static function showForComputer(Computer $comp, $withtemplate = 0)
$header_bottom .= "</th>";
}

$header_end .= "<th>" . _n('Type', 'Types', 1) . "</th>";
$header_end .= "<th>" . __('Item type') . "</th>";
$header_end .= "<th>" . __('Name') . "</th>";
$header_end .= "<th>" . __('Automatic inventory') . "</th>";
$header_end .= "<th>" . Entity::getTypeName(1) . "</th>";
$header_end .= "<th>" . __('Serial number') . "</th>";
$header_end .= "<th>" . __('Inventory number') . "</th>";
$header_end .= "<th>" . _n('Type', 'Types', 1) . "</th>";
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;

foreach ($datas as $data) {
$linkname = $data["name"];
$itemtype = $data['assoc_itemtype'];

$type_class = $itemtype . "Type";
$type_table = getTableForItemType($type_class);
$type_field = getForeignKeyFieldForTable($type_table);

if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
$linkname = sprintf(__('%1$s (%2$s)'), $linkname, $data["id"]);
}
Expand Down Expand Up @@ -451,6 +457,11 @@ public static function showForComputer(Computer $comp, $withtemplate = 0)
(isset($data["serial"]) ? "" . $data["serial"] . "" : "-") . "</td>";
echo "<td>" .
(isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-") . "</td>";
echo "<td>" .
(isset($data[$type_field]) ? "" . Dropdown::getDropdownName(
$type_table,
$data[$type_field]
) . "" : "-") . "</td>";
echo "</tr>";
}
echo $header_begin . $header_bottom . $header_end;
Expand Down

0 comments on commit 469c1f5

Please sign in to comment.