Bug #5559

Empty computer list in Licence

Added by orthagh almost 2 years ago. Updated over 1 year ago.

Status:ClosedStart date:05/24/2018
Priority:NormalDue date:
Assignee:yllen% Done:


Target version:1.4.0


Due to bad usage of getEntitiesRestrictCriteria and MysqlIterator.
I attach a patch to this issue which correct the bug and some other getEntitiesRestrictCriteria usage i found

Here is two screenshots

  • without fix
  • with fix

pdf_fix_getEntitiesRestrictCriteria.patch Magnifier (3.73 KB) orthagh, 05/24/2018 10:13 AM

bug.png (28.8 KB) orthagh, 05/24/2018 10:16 AM

fixed.png (37.3 KB) orthagh, 05/24/2018 10:16 AM

licence.pdf (12 KB) yllen, 06/04/2018 06:01 PM


#1 Updated by orthagh almost 2 years ago

  • Assignee set to yllen

#2 Updated by yllen over 1 year ago

#3 Updated by yllen over 1 year ago

yllen wrote:

No problem for me, i have all my linked computer (licence.pdf)

and request is generated correctly
From DBmysqlIterator::__construct() in /home/yllen/git92/inc/dbmysqliterator.class.php line 272
Generated query: SELECT COUNT AS cpt FROM `glpi_computers_softwarelicenses` INNER JOIN `glpi_computers` ON (`glpi_computers_softwarelicenses`.`computers_id` = `glpi_computers`.`id`) WHERE `softwarelicenses_id` = 218 AND (`glpi_computers`.`entities_id` IN (1, 332)) AND `glpi_computers`.`is_deleted` = 0 AND `is_template` = 0

#4 Updated by orthagh over 1 year ago

to trigger the issue, you need to have the getEntitiesRestrictCriteria return an empty array (no filter in fact).
To do that, set you active entity to "Root entity (tree structure)".

the array concatenation will do something like this:

[WHERE] => Array
              [softwarelicenses_id] => xxx
              [0] => Array

              [glpi_computers.is_deleted] => 0
              [is_template] => 0

And results: no computers listed in licences export

In your answer, i can see you have entities selected: "AND (`glpi_computers`.`entities_id` IN (1, 332))" and on this case, the current code effectively works.

#5 Updated by yllen over 1 year ago

  • Status changed from New to Closed
  • Target version set to 1.4.0

Also available in: Atom PDF