You are not logged in.
I have GLPI 9.3.3 y glpi-ocsinventoryng-1.5.6 under CentOS 7 working. I made a query and added these columns in the results view:
- Volumes - Global size
- Volumes - Name
- Volumes - Free size
But as you can see below, some cells are showing values in the wrong order. Please look at this:
Server 1 details:
Server 5 details:
Offline
Free sizes are ok (!)
Offline
Well, I think is a GLPI bug? I made this SQL query SELECT letter, filesystem, total, free, volumn,name from drives d, hardware h where name like 'xxxxx' and h.id=d.hardware_id and d.type = 'Hard Drive' and those data are stored in an ordered way:
Offline
Also, in glpi_items_disks, I see the data stored ordered:
This is the SQL query:
SELECT DISTINCT `glpi_computers`.`id` AS id, 'admin' AS currentuser, `glpi_computers`.`entities_id`, `glpi_computers`.`is_recursive`, `glpi_computers`.`name` AS `ITEM_0`, `glpi_computers`.`id` AS `ITEM_0_id`, `glpi_states`.`completename` AS `ITEM_1`, `glpi_manufacturers`.`name` AS `ITEM_2`, `glpi_computers`.`serial` AS `ITEM_3`, `glpi_computertypes`.`name` AS `ITEM_4`, `glpi_computermodels`.`name` AS `ITEM_5`, `glpi_operatingsystems_9719987b154aaf3b42c3db32aef59090`.`name` AS `ITEM_6`, `glpi_locations`.`completename` AS `ITEM_7`, `glpi_computers`.`date_mod` AS `ITEM_8`, GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_deviceprocessors_7083fb7d2b7a8b8abd619678acc5b604`.`designation`, '__NULL__'), '$#$',`glpi_deviceprocessors_7083fb7d2b7a8b8abd619678acc5b604`.`id`) SEPARATOR '$$##$$') AS `ITEM_9`, `glpi_computers`.`contact` AS `ITEM_10`, GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_ipaddresses_0cc35feab42e5909929ff742b4834540`.`name`, '__NULL__'), '$#$',`glpi_ipaddresses_0cc35feab42e5909929ff742b4834540`.`id`) SEPARATOR '$$##$$') AS `ITEM_11`, GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_deviceharddrives_65bd144f61164951cc9d21d0d2df9803`.`designation`, '__NULL__'), '$#$',`glpi_deviceharddrives_65bd144f61164951cc9d21d0d2df9803`.`id`) SEPARATOR '$$##$$') AS `ITEM_12`, GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_items_disks`.`name`, '__NULL__'), '$#$',`glpi_items_disks`.`id`) SEPARATOR '$$##$$') AS `ITEM_13`, GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_items_disks`.`totalsize`, '__NULL__'), '$#$',`glpi_items_disks`.`id`) SEPARATOR '$$##$$') AS `ITEM_14`, GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_items_disks`.`freesize`, '__NULL__'), '$#$',`glpi_items_disks`.`id`) SEPARATOR '$$##$$') AS `ITEM_15`, GROUP_CONCAT(DISTINCT CONCAT(IFNULL(ROUND(100*`glpi_items_disks`.freesize/`glpi_items_disks`.totalsize), '__NULL__'), '$#$',`glpi_items_disks`.`id`) SEPARATOR '$$##$$') AS `ITEM_16`, `glpi_plugin_ocsinventoryng_ocslinks`.`last_ocs_update` AS `ITEM_17`
FROM `glpi_computers`
LEFT JOIN `glpi_states` ON (`glpi_computers`.`states_id` = `glpi_states`.`id` )
LEFT JOIN `glpi_manufacturers` ON (`glpi_computers`.`manufacturers_id` = `glpi_manufacturers`.`id` )
LEFT JOIN `glpi_computertypes` ON (`glpi_computers`.`computertypes_id` = `glpi_computertypes`.`id` )
LEFT JOIN `glpi_computermodels` ON (`glpi_computers`.`computermodels_id` = `glpi_computermodels`.`id` )
LEFT JOIN `glpi_items_operatingsystems` ON (`glpi_computers`.`id` = `glpi_items_operatingsystems`.`items_id` AND `glpi_items_operatingsystems`.`itemtype` = 'Computer' )
LEFT JOIN `glpi_operatingsystems` AS `glpi_operatingsystems_9719987b154aaf3b42c3db32aef59090` ON (`glpi_items_operatingsystems`.`operatingsystems_id` = `glpi_operatingsystems_9719987b154aaf3b42c3db32aef59090`.`id` )
LEFT JOIN `glpi_locations` ON (`glpi_computers`.`locations_id` = `glpi_locations`.`id` )
LEFT JOIN `glpi_items_deviceprocessors` ON (`glpi_computers`.`id` = `glpi_items_deviceprocessors`.`items_id` AND `glpi_items_deviceprocessors`.`itemtype` = 'Computer' )
LEFT JOIN `glpi_deviceprocessors` AS `glpi_deviceprocessors_7083fb7d2b7a8b8abd619678acc5b604` ON (`glpi_items_deviceprocessors`.`deviceprocessors_id` = `glpi_deviceprocessors_7083fb7d2b7a8b8abd619678acc5b604`.`id` )
LEFT JOIN `glpi_ipaddresses` AS `glpi_ipaddresses_0cc35feab42e5909929ff742b4834540` ON (`glpi_computers`.`id` = `glpi_ipaddresses_0cc35feab42e5909929ff742b4834540`.`mainitems_id` AND `glpi_ipaddresses_0cc35feab42e5909929ff742b4834540`.`mainitemtype` = 'Computer' AND `glpi_ipaddresses_0cc35feab42e5909929ff742b4834540`.`is_deleted` = 0 )
LEFT JOIN `glpi_items_deviceharddrives` ON (`glpi_computers`.`id` = `glpi_items_deviceharddrives`.`items_id` AND `glpi_items_deviceharddrives`.`itemtype` = 'Computer' )
LEFT JOIN `glpi_deviceharddrives` AS `glpi_deviceharddrives_65bd144f61164951cc9d21d0d2df9803` ON (`glpi_items_deviceharddrives`.`deviceharddrives_id` = `glpi_deviceharddrives_65bd144f61164951cc9d21d0d2df9803`.`id` )
LEFT JOIN `glpi_items_disks` ON (`glpi_computers`.`id` = `glpi_items_disks`.`items_id` AND `glpi_items_disks`.`itemtype` = 'Computer' )
LEFT JOIN `glpi_plugin_ocsinventoryng_ocslinks` ON (`glpi_computers`.`id` = `glpi_plugin_ocsinventoryng_ocslinks`.`computers_id` )
WHERE `glpi_computers`.`is_deleted` = 0 AND `glpi_computers`.`is_template` = 0 AND ( ( (`glpi_computers`.`name` LIKE '%server-sp%' ) OR (`glpi_states`.`completename` LIKE '%server-sp%' ) OR (`glpi_manufacturers`.`name` LIKE '%server-sp%' ) OR (`glpi_computers`.`serial` LIKE '%server-sp%' ) OR (`glpi_computertypes`.`name` LIKE '%server-sp%' ) OR (`glpi_computermodels`.`name` LIKE '%server-sp%' ) OR (`glpi_operatingsystems_9719987b154aaf3b42c3db32aef59090`.`name` LIKE '%server-sp%' ) OR (`glpi_locations`.`completename` LIKE '%server-sp%' ) OR (CONVERT(`glpi_computers`.`date_mod` USING utf8) LIKE '%server-sp%' ) OR (`glpi_computers`.`contact` LIKE '%server-sp%' ) OR (`glpi_ipaddresses_0cc35feab42e5909929ff742b4834540`.`name` LIKE '%server-sp%' ) OR (`glpi_items_disks`.`name` LIKE '%server-sp%' ) OR (`glpi_items_disks`.`freesize` LIKE '%server-sp%' ) OR (ROUND(100*`glpi_items_disks`.freesize/`glpi_items_disks`.totalsize) LIKE '%server-sp%' ) OR (CONVERT(`glpi_plugin_ocsinventoryng_ocslinks`.`last_ocs_update` USING utf8) LIKE '%server-sp%' ) ) ) GROUP BY `glpi_computers`.`id`
ORDER BY ITEM_0 ASC
A query results detail:
Offline
So, as I can understand, for ITEM_13 for example, this SQL code is not doing the concat instruction in order:
GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_items_disks`.`name`, '__NULL__'), '$#$',`glpi_items_disks`.`id`) SEPARATOR '$$##$$') AS `ITEM_13
How can that code include an ORDER BY sql clause to do the trick?
Offline
Well, it seems I found the solution, changing lines 2882 and 2883 of glpi/inc/search.class.php:
return " GROUP_CONCAT(DISTINCT CONCAT(IFNULL($tocompute, '".self::NULLVALUE."'),
'".self::SHORTSEP."',$tocomputeid) SEPARATOR '".self::LONGSEP."')
by
return " GROUP_CONCAT(DISTINCT CONCAT(IFNULL($tocompute, '".self::NULLVALUE."'),
'".self::SHORTSEP."',$tocomputeid) ORDER BY $tocomputeid SEPARATOR '".self::LONGSEP."')
Offline
2883c2883
< '".self::SHORTSEP."',$tocomputeid) ORDER BY $tocomputeid SEPARATOR '".self::LONGSEP."')
---
> '".self::SHORTSEP."',$tocomputeid) SEPARATOR '".self::LONGSEP."')
Offline
But I think the ORDER BY is also needed at the end of line 2858:
case "itemlink" :
if ($meta
|| (isset($searchopt[$ID]["forcegroupby"]) && $searchopt[$ID]["forcegroupby"])) {
$TRANS = '';
if (Session::haveTranslations(getItemTypeForTable($table), $field)) {
$TRANS = "GROUP_CONCAT(DISTINCT CONCAT(IFNULL($tocomputetrans, '".self::NULLVALUE."'),
'".self::SHORTSEP."',$tocomputeid)
SEPARATOR '".self::LONGSEP."')
AS `".$NAME."_".$num."_trans`, ";
}
return " GROUP_CONCAT(DISTINCT CONCAT($tocompute, '".self::SHORTSEP."' ,
`$table$addtable`.`id`)
SEPARATOR '".self::LONGSEP."') AS `".$NAME."_$num`,
$TRANS
$ADDITONALFIELDS";
}
I mean, like this:
`$table$addtable`.`id`) ORDER BY $ `$table$addtable`.`id`
Offline