Skip to content

fix(commoninjectionlib): unseting the groups_id fields when empty instead of setting it to 0#598

Open
TarekRemo wants to merge 2 commits intopluginsGLPI:mainfrom
TarekRemo:ticket43155
Open

fix(commoninjectionlib): unseting the groups_id fields when empty instead of setting it to 0#598
TarekRemo wants to merge 2 commits intopluginsGLPI:mainfrom
TarekRemo:ticket43155

Conversation

@TarekRemo
Copy link
Copy Markdown
Contributor

fix(commoninjectionlib): fix association of imported data with non-existing groups when the group column is empty in the import file

Checklist before requesting a review

Please delete options that are not relevant.

  • 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

ticket 43155 : fixes the association of imported data with non-existing groups when the group column is empty in the import file.

@TarekRemo TarekRemo requested review from Rom1-B and stonebuzz April 1, 2026 12:51
@TarekRemo TarekRemo self-assigned this Apr 1, 2026
@TarekRemo TarekRemo added bug php Pull requests that update Php code labels Apr 1, 2026
@TarekRemo TarekRemo requested a review from Rom1-B April 1, 2026 14:27
@stonebuzz
Copy link
Copy Markdown
Contributor

@TarekRemo

can you rebase

…isting groups when the group column is empty in the import file
// If the field is an id, we set it to 0
$this->values[$itemtype][$field] = self::DROPDOWN_EMPTY_VALUE;
//If the field concernes groupds, unseting it instead of setting it to 0 in order to avoid associating the item to a non existing group (id 0)
$group_fields = ['groups_id_tech', 'groups_id', 'groups_id_normal'];
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.

Where come from this -> groups_id_normal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Its one of the keys used by the plugin to map the import file column to a group field (see line 1700).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants