$query = getSqlSubRequest("Computer",$loc,new Computer());
foreach($CFG_GLPI["infocom_types"] as $itemtype) {
$obj = new $itemtype;
if ($obj->isField('locations_id')) {
$query.= "UNION (".getSqlSubRequest($itemtype,$loc,$obj).")";
}
}
I noticed that getSqlSubRequest function is repeating itself *twice* for one same itemtype, Computer: first one being the very first function instance -before any UNION clause-, and the other one during the infocom_types loop that walks thorugh all itemtypes, including Computer itself again.
This seems to have no effect in the actual report displaying, but wouldn't it represent an unnecessary redundancy in the sql query?
Just in case, I made a workaround, or possible "fix":
$query = getSqlSubRequest("Computer",$loc,new Computer());
foreach($CFG_GLPI["infocom_types"] as $itemtype) {
$obj = new $itemtype;
if ($obj->isField('locations_id')) {
if ($itemtype != "Computer") {
$query.= " UNION (".getSqlSubRequest($itemtype,$loc,$obj).")";
}
}
}
Other bug, I noticed this very same old one http://forum.glpi-project.org/viewtopic … 47#p171747 stills there. Where exactly was it "fixed"? It is not fixed neither in current glpi release itself nor in github.
]]>