query("SELECT glpi_computers.name, glpi_operatingsystems.name as OS,plugin_fields_astreinteqpcfielddropdowns_id as crit, last_contact, glpi_computers.computertypes_id FROM glpi_computers
left join glpi_items_operatingsystems on glpi_computers.id = glpi_items_operatingsystems.items_id
left join glpi_operatingsystems on glpi_operatingsystems.id = glpi_items_operatingsystems.operatingsystems_id
left join glpi_plugin_fields_computerdatasupps on glpi_plugin_fields_computerdatasupps.items_id = glpi_computers.id
LEFT JOIN glpi_plugin_fusioninventory_agents ON computers_id = glpi_computers.id
WHERE glpi_computers.entities_id = 6 AND glpi_computers.is_deleted = 0 AND glpi_computers.states_ID in(2,26) AND glpi_computers.computertypes_id in(7,19,6,2) and glpi_computers.name <> ''");
?>
| Name |
Type |
Criticity |
Last F.I Inventory |
";
echo "".$row['name']." | ";
echo match ($row['computertypes_id']) {
7 => "Serveur | ",
19 => "VM | ",
6 => "Portable | ",
2 => "PC | ",
default => " | ",
};
echo match ($row['crit']) {
1 => "Silver | ",
2 => "Gold | ",
3 => "Bronze | ",
default => " | ",
};
if($row['last_contact']){
$fi=date_create($row['last_contact']);
$diff=date_diff($fi,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){
echo "".$row['last_contact']." | ";
}else{
echo "".$row['last_contact']." | ";
}
}else{echo " | ";}
echo "";
}
?>