pluginsGLPI / ocsinventoryng

Plugin ocsinventoryng for GLPI
GNU General Public License v2.0
68 stars 52 forks source link

PHP User Warning when GLPI user is deleted #353

Open emilfazzi opened 1 year ago

emilfazzi commented 1 year ago

The reported PHP Warning appears when deleting a GLPI user.

How to reproduce

PHP error log in glpi/files/_log/php-errors.log contains:

[2023-04-14 10:26:53] glpiphplog.WARNING:   *** PHP User Warning (512): Relation between "glpi_networkports" and "glpi_plugin_ocsinventoryng_networkports" table based on "networkports_id" field cannot be handled automatically as "networkports_id" also corresponds to index field of the target table. in /usr/share/glpi/src/DbUtils.php at line 2099
  Backtrace :
  src/DbUtils.php:2099                               trigger_error()
  inc/db.function.php:585                            DbUtils->getDbRelations()
  src/CommonDBTM.php:866                             getDbRelations()
  src/CommonDBTM.php:788                             CommonDBTM->cleanRelationData()
  src/CommonDBTM.php:2064                            CommonDBTM->deleteFromDB()
  src/CommonDBConnexity.php:127                      CommonDBTM->delete()
  src/CommonDBTM.php:986                             CommonDBConnexity->cleanDBonItemDelete()
  src/User.php:437                                   CommonDBTM->deleteChildrenAndRelationsFromDb()
  src/CommonDBTM.php:783                             User->cleanDBonPurge()
  src/CommonDBTM.php:2064                            CommonDBTM->deleteFromDB()
  src/MassiveAction.php:1495                         CommonDBTM->delete()
  src/MassiveAction.php:1408                         MassiveAction::processMassiveActionsForOneItemtype()
  src/MassiveAction.php:1386                         MassiveAction->processForSeveralItemtypes()
  front/massiveaction.php:59                         MassiveAction->process()

[2023-04-14 10:26:53] glpiphplog.WARNING:   *** PHP User Warning (512): Relation between "glpi_networkports" and "glpi_plugin_ocsinventoryng_networkports" table based on "networkports_id" field cannot be handled automatically as "networkports_id" also corresponds to index field of the target table. in /usr/share/glpi/src/DbUtils.php at line 2099
  Backtrace :
  src/DbUtils.php:2099                               trigger_error()
  inc/db.function.php:585                            DbUtils->getDbRelations()
  src/CommonDBTM.php:866                             getDbRelations()
  src/CommonDBTM.php:788                             CommonDBTM->cleanRelationData()
  src/CommonDBTM.php:2064                            CommonDBTM->deleteFromDB()
  src/MassiveAction.php:1495                         CommonDBTM->delete()
  src/MassiveAction.php:1408                         MassiveAction::processMassiveActionsForOneItemtype()
  src/MassiveAction.php:1386                         MassiveAction->processForSeveralItemtypes()
  front/massiveaction.php:59                         MassiveAction->process()
kabassanov commented 1 year ago

Similar issue: https://github.com/pluginsGLPI/ocsinventoryng/issues/355

Mirkk commented 9 months ago

Ciao @emilfazzi, the commit 8433a4822d7693619981adfcd0c5a934633a55ec by @tsmr should resolve this. However, the very similar #355 seems not to be solved.