yllen / reports

Additional reports
GNU Affero General Public License v3.0
6 stars 11 forks source link

Error on generating "Applications by locations and versions" report #20

Closed eduardomozart closed 1 year ago

eduardomozart commented 1 year ago

I'm using GLPI 10.0.5 and the following errors are being thrown when attempting to generate the "Applications by locations and versions" report:

error_log (PHP error log):

[06-Dec-2022 16:07:40 America/Sao_Paulo] PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php on line 363
[06-Dec-2022 16:07:40 America/Sao_Paulo] PHP Warning:  DBmysql::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php on line 367
[06-Dec-2022 16:07:40 America/Sao_Paulo] PHP Warning:  DBmysql::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php on line 372
[06-Dec-2022 16:07:40 America/Sao_Paulo] PHP Warning:  DBmysql::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php on line 372
[06-Dec-2022 16:07:40 America/Sao_Paulo] PHP Warning:  DBmysql::fetchQueryWarnings(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php on line 1913

php-errors.log:


[2022-12-06 16:07:40] glpiphplog.WARNING:   *** PHP Warning (2): mysqli::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php at line 363
  Backtrace :
  src/DBmysql.php:363                                mysqli->query()
  src/DBmysqlIterator.php:112                        DBmysql->query()
  src/DBmysql.php:1056                               DBmysqlIterator->execute()
  src/Session.php:903                                DBmysql->request()
  src/Session.php:1022                               Session::checkValidSessionId()
  plugins/reports/inc/autoreport.class.php:304       Session::checkRight()
  ...ationsbylocation/applicationsbylocation.php:105 PluginReportsAutoReport->execute()

[2022-12-06 16:07:40] glpiphplog.WARNING:   *** PHP Warning (2): DBmysql::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php at line 367
  Backtrace :
  src/DBmysqlIterator.php:112                        DBmysql->query()
  src/DBmysql.php:1056                               DBmysqlIterator->execute()
  src/Session.php:903                                DBmysql->request()
  src/Session.php:1022                               Session::checkValidSessionId()
  plugins/reports/inc/autoreport.class.php:304       Session::checkRight()
  ...ationsbylocation/applicationsbylocation.php:105 PluginReportsAutoReport->execute()

[2022-12-06 16:07:40] glpiphplog.WARNING:   *** PHP Warning (2): DBmysql::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php at line 372
  Backtrace :
  src/DBmysqlIterator.php:112                        DBmysql->query()
  src/DBmysql.php:1056                               DBmysqlIterator->execute()
  src/Session.php:903                                DBmysql->request()
  src/Session.php:1022                               Session::checkValidSessionId()
  plugins/reports/inc/autoreport.class.php:304       Session::checkRight()
  ...ationsbylocation/applicationsbylocation.php:105 PluginReportsAutoReport->execute()

[2022-12-06 16:07:40] glpiphplog.WARNING:   *** PHP Warning (2): DBmysql::query(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php at line 372
  Backtrace :
  src/DBmysqlIterator.php:112                        DBmysql->query()
  src/DBmysql.php:1056                               DBmysqlIterator->execute()
  src/Session.php:903                                DBmysql->request()
  src/Session.php:1022                               Session::checkValidSessionId()
  plugins/reports/inc/autoreport.class.php:304       Session::checkRight()
  ...ationsbylocation/applicationsbylocation.php:105 PluginReportsAutoReport->execute()

[2022-12-06 16:07:40] glpiphplog.WARNING:   *** PHP Warning (2): DBmysql::fetchQueryWarnings(): Couldn't fetch mysqli in /home/robertinho/public_html/glpi/src/DBmysql.php at line 1913
  Backtrace :
  src/DBmysql.php:385                                DBmysql->fetchQueryWarnings()
  src/DBmysqlIterator.php:112                        DBmysql->query()
  src/DBmysql.php:1056                               DBmysqlIterator->execute()
  src/Session.php:903                                DBmysql->request()
  src/Session.php:1022                               Session::checkValidSessionId()
  plugins/reports/inc/autoreport.class.php:304       Session::checkRight()
  ...ationsbylocation/applicationsbylocation.php:105 PluginReportsAutoReport->execute()

sql-errors.log:

[2022-12-06 16:07:40] glpisqllog.ERROR: DBmysql::query() in /home/robertinho/public_html/glpi/src/DBmysql.php line 370
  *** MySQL query error:
  SQL: SELECT COUNT(*) AS count FROM `glpi_users` LEFT JOIN `glpi_profiles_users` ON (`glpi_profiles_users`.`users_id` = `glpi_users`.`id`) WHERE `glpi_users`.`id` = '14' AND `glpi_users`.`is_active` = '1' AND `glpi_users`.`is_deleted` = '0' AND `glpi_profiles_users`.`profiles_id` = '4' AND (`glpi_profiles_users`.`entities_id` = '0')
  Error: 
  Backtrace :
  src/DBmysqlIterator.php:112                        
  src/DBmysql.php:1056                               DBmysqlIterator->execute()
  src/Session.php:903                                DBmysql->request()
  src/Session.php:1022                               Session::checkValidSessionId()
  plugins/reports/inc/autoreport.class.php:304       Session::checkRight()
  ...ationsbylocation/applicationsbylocation.php:105 PluginReportsAutoReport->execute()
  {"user":"14@cloud.ifantasy.com.br"} 

When I'd run the query through PHPMyAdmin it runs successfully, so I believe that the SELECT COUNT query isn't allowed through the DBmysqlIterator or maybe some problem related to the entities permission (#18)?

yllen commented 1 year ago

Corrected by https://github.com/yllen/reports/issues/26