Skip to content

fix(tag): handle scalar type_menu in massive updates#360

Open
rickserrat wants to merge 2 commits into
pluginsGLPI:mainfrom
rickserrat:fix/massive-update-type-menu
Open

fix(tag): handle scalar type_menu in massive updates#360
rickserrat wants to merge 2 commits into
pluginsGLPI:mainfrom
rickserrat:fix/massive-update-type-menu

Conversation

@rickserrat

Copy link
Copy Markdown

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective.
  • I have updated the CHANGELOG with a short functional description of the fix.
  • This change requires a documentation update.

Description

  • Fixes Massive update of associated item types fails with TypeError #359 .
  • Prevents a TypeError when updating tag associated item types through GLPI massive actions.
  • Normalizes scalar type_menu values into an array before calling array_values() and encoding the value as JSON.
  • Preserves the existing behavior when type_menu is already an array.
  • Adds a regression test covering an update where type_menu is provided as a scalar string.

Testing

  • Added TagTest::testUpdateAcceptsScalarTypeMenu().
  • Verified PHP syntax for the modified and new files.
  • Ran the PHPUnit test suite successfully.

Screenshots

Not applicable. This is a backend error handling fix.

@rickserrat
rickserrat marked this pull request as ready for review July 20, 2026 18:56
@Rom1-B
Rom1-B self-requested a review July 24, 2026 10:36

@Rom1-B Rom1-B left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally, it seems OK.
Can you rebase to resolve the conflicts
and then fix the lint issues?

@rickserrat
rickserrat force-pushed the fix/massive-update-type-menu branch from 007d0cf to dd5c55c Compare July 24, 2026 11:58
@rickserrat

Copy link
Copy Markdown
Author

Functionally, it seems OK. Can you rebase to resolve the conflicts and then fix the lint issues?

Thanks for the review.

I rebased the branch onto the latest main, resolved the conflicts, and fixed the PHP-CS-Fixer, Rector, and licence header issues.

The test was merged into the existing TagTest class and the test suite passes.

@rickserrat
rickserrat requested a review from Rom1-B July 24, 2026 12:14
Comment thread tests/Units/TagTest.php
Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com>
@rickserrat
rickserrat requested a review from Rom1-B July 24, 2026 13:58
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.

Massive update of associated item types fails with TypeError

2 participants