glpi-project/glpi

GLPI 11 : duplicate entry for key 'glpi_validatorsubstitutes

Closed this issue · 0 comments

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

11.0/bugfixes

Bug description

When purging two users who were substitutes for someone, we encounter an error (the second user is therefore not deleted).

Relevant log output

MySQL query error: Duplicate entry '2-0' for key 'glpi_validatorsubstitutes.users_id_users_id_substitute' (1062) in SQL query "UPDATE `glpi_validatorsubstitutes` SET `users_id_substitute` = '0' WHERE `id` = '6'".
In ./src/DBmysql.php(381)
#0 ./src/DBmysql.php(1456): DBmysql->doQuery()
#1 ./src/CommonDBTM.php(733): DBmysql->update()
#2 ./src/CommonDBTM.php(1760): CommonDBTM->updateInDB()
#3 ./src/CommonDBTM.php(988): CommonDBTM->update()
#4 ./src/CommonDBTM.php(838): CommonDBTM->cleanRelationData()
#5 ./src/CommonDBTM.php(2151): CommonDBTM->deleteFromDB()
#6 ./front/user.form.php(119): CommonDBTM->delete()
#7 ./src/Glpi/Controller/LegacyFileLoadController.php(63): require('...')
#8 ./vendor/symfony/http-kernel/HttpKernel.php(181): Glpi\Controller\LegacyFileLoadController->__invoke()
#9 ./vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#10 ./vendor/symfony/http-kernel/Kernel.php(197): Symfony\Component\HttpKernel\HttpKernel->handle()
#11 ./public/index.php(70): Symfony\Component\HttpKernel\Kernel->handle()
#12 {main}

Page URL

https://glpi11bf.local/front/user.php?is_deleted=1

Steps To reproduce

  • I have two users (Marie and Jean)
  • Both are added as substitutes of a third user (for example, glpi)
Image
  • I decide to completely delete from my database Marie and Jean (without having removed them first from glpi’s substitutes)
  • Moving them to the trash works without any issue
  • Purging the first user works without any issue
  • However, purging the second user causes a duplicate entry error

Your GLPI setup information

No response

Anything else?

No response