You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2018-02-14 19:00:02

bugless
Guest
Registered: 2010-01-24
Posts: 25

[Plugin glpi-reports 1.11.1] 2 bugs

In the listofequipmentbylocation.php report there's this fragment:

$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.

Offline

Board footer

Powered by FluxBB