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 2019-01-30 18:07:54

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Labels and sizes in wrong order - GLPI bug?

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:

http://prntscr.com/mebp1f

Server 1 details:

http://prntscr.com/mebvuy

Server 5 details:

http://prntscr.com/mebwfx

Offline

#2 2019-01-30 18:27:11

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Re: Labels and sizes in wrong order - GLPI bug?

Free sizes are ok (!)

http://prntscr.com/mec749

Offline

#3 2019-01-30 19:13:08

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Re: Labels and sizes in wrong order - GLPI bug?

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:

http://prntscr.com/mecwtc

Offline

#4 2019-01-31 00:18:45

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Re: Labels and sizes in wrong order - GLPI bug?

Also, in glpi_items_disks, I see the data stored ordered:

http://prntscr.com/meh16s

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:

http://prntscr.com/meh6lt

Offline

#5 2019-01-31 00:44:25

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Re: Labels and sizes in wrong order - GLPI bug?

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

#6 2019-01-31 18:54:21

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Re: Labels and sizes in wrong order - GLPI bug?

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

#7 2019-01-31 18:55:14

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Re: Labels and sizes in wrong order - GLPI bug?

2883c2883
<                                                '".self::SHORTSEP."',$tocomputeid) ORDER BY $tocomputeid SEPARATOR '".self::LONGSEP."')
---
>                                                '".self::SHORTSEP."',$tocomputeid) SEPARATOR '".self::LONGSEP."')

Offline

#8 2019-01-31 19:01:13

pchamorro
Member
Registered: 2009-09-21
Posts: 18

Re: Labels and sizes in wrong order - GLPI bug?

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

Board footer

Powered by FluxBB