You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GLPI 12: 11 reports fail with "Ocorreu um erro inesperado" (subquery params lost in QueryExpression, QueryUnion passed to request(), empty IN) #409
With GLPI 12.0.1 and mreporting 1.11.0 / 1.11.1, 11 of the bundled reports end on the GLPI error page. We opened every report of the plugin (Helpdesk, Helpdesk advanced, Inventory, Tag): the Helpdesk and Tag reports work. The broken ones are 10 Inventory reports and 1 Helpdesk advanced report. There are three different causes, all related to GLPI 12 executing queries as prepared statements.
1. Percentage subquery loses its parameters (6 Inventory reports)
Casting the QuerySubQuery to a string keeps the ? placeholders of the subquery, but its values are not carried over, so the statement has more placeholders than values. In GLPI 12, QueryExpression has a third $values argument, so the parameters can be passed along:
TypeError: DBmysqlIterator::execute(): Argument #1 ($criteria) must be of type array, Glpi\DBAL\QueryUnion given
inc/inventory.class.php:386 (computersByAge), inc/inventory.class.php:525 (computersByOS)
GLPI 12 only accepts an array here. Using the union as FROM works, as the core does (for example Lockedfield.php):
These queries also contain the percentage subquery from point 1.
3. Empty IN when no ticket has an SLA (1 Helpdesk advanced report)
reportHgbarRespectedSlasByTopCategory:
RuntimeException: Empty IN are not allowed
inc/helpdeskplus.class.php (second $DB->request() of reportHgbarRespectedSlasByTopCategory)
When no category is selected and no ticket has an SLA, $categories is empty and is used as ITILCategory::getTable() . '.id' => $categories. Returning the empty result before the second query avoids the error, for example:
With these three changes applied locally on 1.11.1, all reports of the plugin open without error, nothing new is logged, and the percentages are the same as a direct SQL count (checked on "Computers by manufacturer").
Side note, not an error: in the Inventory reports the total used for the percentage (the subquery) does not filter is_deleted = 0, while the counted rows do. When items are in the trash, the percentages do not add up to 100 %.
Environment
GLPI 12.0.1
mreporting 1.11.0 and 1.11.1 (same code for these parts in master)
Activity
Fix: avoid SLA report crash, exclude trash from percentages (#418)