Skip to content

fix(links): prevent SQL error during item generation - #601

Merged
RomainLvr merged 1 commit into
pluginsGLPI:mainfrom
MyvTsv:ticket46225
Sep 9, 2026
Merged

fix(links): prevent SQL error during item generation#601
RomainLvr merged 1 commit into
pluginsGLPI:mainfrom
MyvTsv:ticket46225

Conversation

@MyvTsv

@MyvTsv MyvTsv commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !46225
  • Generating a new item from an order reference whose associated template already has financial information (Infocom) crashes the whole "Generate new item" massive action with a fatal SQL error, aborting the process without generating anything.
MySQL query error: Data truncated for column 'old_id' at row 1 (1265) in SQL query "INSERT INTO `glpi_logs` (`items_id`, `itemtype`, `itemtype_link`, `linked_action`, `user_name`, `date_mod`, `id_search_option`, `old_value`, `old_id`, `new_value`, `new_id`) VALUES ('10', 'Phone', '', '0', 'glpi (2)', '2026-09-09 12:59:56', '121', ' (2026-09-09 12:59:56)', '2026-09-09 12:59:56', ' (2026-09-09 12:08:01)', '2026')".
In ./src/DBmysql.php(416)
#0 ./src/DBmysql.php(1377): DBmysql->doQuery('INSERT INTO `gl...')
#1 ./src/Log.php(317): DBmysql->insert('glpi_logs', Array)
#2 ./src/Log.php(213): Log::history(10, 'Phone', Array)
#3 ./src/CommonDBTM.php(750): Log::constructHistory(Object(Infocom), Array, Array)
#4 ./src/CommonDBTM.php(1765): CommonDBTM->updateInDB(Array, Array)
#5 ./plugins/order/inc/link.class.php(912): CommonDBTM->update(Array)
#6 ./plugins/order/inc/link.class.php(1064): PluginOrderLink->generateInfoComRelatedToOrder('0', '29', 'Phone', 10, 6)
#7 ./plugins/order/inc/link.class.php(1402): PluginOrderLink->createLinkWithItem('29', 10, 'Phone', '2', '0', 6, false, false)
#8 ./plugins/order/inc/link.class.php(624): PluginOrderLink->generateNewItem(Array)
#9 ./src/MassiveAction.php(1348): PluginOrderLink::processMassiveActionsForOneItemtype(Object(MassiveAction), Object(PluginOrderLink), Array)
#10 ./src/MassiveAction.php(1326): MassiveAction->processForSeveralItemtypes()
#11 ./front/massiveaction.php(63): MassiveAction->process()
#12 ./src/Glpi/Controller/LegacyFileLoadController.php(64): require('./f...')
#13 ./vendor/symfony/http-kernel/HttpKernel.php(181): Glpi\Controller\LegacyFileLoadController->__invoke(Object(Symfony\Component\HttpFoundation\Request))
#14 ./vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#15 ./vendor/symfony/http-kernel/Kernel.php(208): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 ./public/index.php(71): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#17 {main}

@MyvTsv MyvTsv self-assigned this Sep 9, 2026
@MyvTsv
MyvTsv requested review from RomainLvr and stonebuzz and removed request for RomainLvr September 9, 2026 13:01
@MyvTsv
MyvTsv marked this pull request as ready for review September 9, 2026 13:01
@RomainLvr
RomainLvr merged commit 652ef5c into pluginsGLPI:main Sep 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants