Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(Import): Fix CommonDBRelation import #389

Merged
merged 2 commits into from
Mar 12, 2024
Merged

Conversation

stonebuzz
Copy link
Contributor

@stonebuzz stonebuzz commented Feb 26, 2024

CommonDBRelation are managed separately, so related field should be ignored
Ex : User -> groups_id -> Group_User
groups_id should not be injected in User (field contains group name (string)) to prevent SQL error

SQL Error "1366": Incorrect integer value: 'TALENTO HUMANO' for column `glpi`.`glpi_users`.`groups_id` at row 1 in query "INSERT INTO `glpi_users` (`name`, `realname`, `firstname`, `usertitles_id`, `locations_id`, `usercategories_id`, `groups_id`, `entities_id`, `is_active`, `profiles_id`, `password`, `authtype`, `auths_id`, `is_deleted`, `date_creation`, `date_mod`) VALUES ('[email protected]', 'USERLASTNAME', 'USERNAME', '47', '872', '3', 'TALENTO HUMANO', '87', '1', '28', 'USERPASSWORD', '1', '0', '0', '2024-02-06 12:17:41', '2024-02-06 12:17:41')"

From effectiveAddOrUpdate when related item class instanceof CommonDBRelation
we should inject itemtype and items_id OR related foreign key

Fix #387

@stonebuzz stonebuzz added the bug label Feb 26, 2024
@stonebuzz stonebuzz added this to the 2.13.6 milestone Feb 26, 2024
@stonebuzz stonebuzz self-assigned this Feb 26, 2024
@stonebuzz stonebuzz force-pushed the fix/user_group_import branch 2 times, most recently from ae4e630 to f5211bb Compare February 27, 2024 07:36
@stonebuzz stonebuzz merged commit 338117f into main Mar 12, 2024
3 checks passed
@stonebuzz stonebuzz deleted the fix/user_group_import branch March 12, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't inject users with groups
3 participants