OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
344 stars 139 forks source link

Table softwares is still used in Apache/Ocsinventory/Interface/Inventory.pm, that causes an error #337

Closed Ysincit closed 1 year ago

Ysincit commented 3 years ago

General informations

Operating system : openSUSE Leap 15.3

Server informations

Perl version : 5 Mysql / Mariadb / Percona version : 8.0.21

OCS Inventory informations

Ocs server version : 2.9

Problem's description

Got a ==Bad request== SQL:SELECT DISTINCT dico_soft.FORMATTED AS FORMAT FROM softwares,dico_soft WHERE HARDWARE_ID=? AND EXTRACTED=NAME on a API call, found that on line 192 of Apache/Ocsinventory/Interface/Inventory.pm my $sth = get_sth('SELECT DISTINCT dico_soft.FORMATTED AS FORMAT FROM softwares,dico_soft WHERE HARDWARE_ID=? AND EXTRACTED=NAME', $id); table softwares is still used. Maybe it should be changed to

my $sth = get_sth('SELECT DISTINCT d.`FORMATTED` AS FORMAT FROM `software` s JOIN `software_name` n ON (n.`ID` = s.`NAME_ID`) JOIN `dico_soft` d ON (d.`EXTRACTED` = n.`NAME`) WHERE s.`HARDWARE_ID`=?;', $id);`

ALSO, with a grep -r "SELECT.*softwares" . over the OCSNG_UNIX_SERVER of OCSNG_UNIX_SERVER_2.9-nightly-2021-07-09.tar.gz, I found that the table softwares is also still used in: ocsreports/plugins/main_sections/ms_search_soft/ms_options.php ocsreports/plugins/main_sections/ms_search_soft/require/fonction.inc.php that seems, not having an impact on my usage case, but is maybe also a problem for others.

Best regards!