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 2015-01-16 18:31:55

averyml
Member
Registered: 2009-08-11
Posts: 7

Trouble with webapplications plugin after upgrade to .85

I recently upgraded my GLPI instance to .85, and I upgraded the webapplications plugin accordingly.  I can access the web applications page itself, but the web applications tab on the computers just says "loading."  my sql-errors log shows:

2015-01-16 11:20:50 [6@hostname]
  *** MySQL query error:
  SQL: SELECT *
                FROM `glpi_plugin_webapplications_webapplicationtypes`
                WHERE `id` IN (SELECT DISTINCT `plugin_webapplications_webapplicationtypes_id`
                               FROM `glpi_plugin_webapplications_webapplications`
                              WHERE `glpi_plugin_webapplications_webapplications`.`is_deleted` = \'0\' AND ( `glpi_plugin_webapplications_webapplications`.`entities_id` = \'0\'  )  AND `id` NOT IN (0, ,5,2,8))
                ORDER BY `name`
  Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '5,2,8))
                ORDER BY `name`' at line 5
  Backtrace :
  ...ebapplications/inc/webapplication.class.php:388 
  ...lications/inc/webapplication_item.class.php:451 PluginWebapplicationsWebapplication::dropdown()
  ...plications/inc/webapplication_item.class.php:86 PluginWebapplicationsWebapplication_Item::showForItem()
  inc/commonglpi.class.php:455                       PluginWebapplicationsWebapplication_Item::displayTabContentForItem()
  ajax/common.tabs.php:87                            CommonGLPI::displayStandardTab()

I don't know php very well at all, but from looking at the plugin code, I'm guessing this list of "NOT IN" Id's is supposed to be a list of webapplication IDs that belong to the computer whose record I am viewing.  In this particular instance (although this is a problem with all computers that have associated webapplications), web applications 5, 2, and 8 are the only web applications associated with that computer, meaning that it looks like there's an extra entry in that list, rather than a space where a number should be. 

I may be way off base here, but I was able to get the tab to load by editing the following code in plugins/webapplications/inc/webapplication.class.php:

      $where = " WHERE `glpi_plugin_webapplications_webapplications`.`is_deleted` = '0' ".
                       getEntitiesRestrictRequest("AND", "glpi_plugin_webapplications_webapplications", '', $p['entity'], true);

      if (count($p['used'])) {
         $where .= " AND `id` NOT IN (0, ".implode(",",$p['used']).")";
      }

Removing the comma between the 0 and the ".implode" makes the tab load, but the first entry in the list seems to be an invalid entry, so obviously that's not the correct thing to do.  Any advice?

Offline

#2 2015-01-23 11:52:28

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,273

Re: Trouble with webapplications plugin after upgrade to .85

Ticket open on the roadmap of the plugin: https://forge.indepnet.net/issues/5192


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#3 2015-01-23 15:23:52

tsmr
GLPI-DEV
From: Rennes
Registered: 2005-08-26
Posts: 11,632
Website

Re: Trouble with webapplications plugin after upgrade to .85

Can you add an $p['used'] = array_filter($p['used']);

      $where = " WHERE `glpi_plugin_webapplications_webapplications`.`is_deleted` = '0' ".
                       getEntitiesRestrictRequest("AND", "glpi_plugin_webapplications_webapplications", '', $p['entity'], true);
     
      $p['used'] = array_filter($p['used']);
      if (count($p['used'])) {
         $where .= " AND `id` NOT IN (0, ".implode(",",$p['used']).")";
      }

for test ?


Xavier Caillaud
Blog GLPI Infotel

Offline

#4 2015-01-23 19:47:54

averyml
Member
Registered: 2009-08-11
Posts: 7

Re: Trouble with webapplications plugin after upgrade to .85

Adding that line makes the tab load, but it still has that odd first entry.  The name (with no underlying link) shows up as "N/A", and the URL shows up as "..." with a link to that computer's GLPI page (that is, the page I'm on).

Offline

Board footer

Powered by FluxBB