Empty computer list in Licence
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
#3 Updated by yllen over 1 year ago
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  => 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.