-
Notifications
You must be signed in to change notification settings - Fork 54
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 group user import #306
Fix group user import #306
Conversation
@cconard96 Can this be fixed by #302 ? |
@kabassanov and I saw that PR and it did not seem to fix the issue they were having. |
Co-authored-by: Cédric Anne <[email protected]>
7c35293
to
336e4ab
Compare
@cconard96 does not work for me My CSV file
Error : [2022-09-09 08:07:25] glpisqllog.ERROR: DBmysql::query() in /home/dev/GLPI/10.0-bugfixes/src/DBmysql.php line 370
*** MySQL query error:
SQL: INSERT INTO `glpi_users` (`name`, `groups_id`, `entities_id`, `authtype`, `auths_id`, `is_active`, `is_deleted`, `profiles_id`, `date_creation`, `date_mod`) VALUES ('user1', 'group1', '0', '1', '0', '1', '0', '0', '2022-09-09 08:07:25', '2022-09-09 08:07:25')
Error: Incorrect integer value: 'group1' for column 'groups_id' at row 1
Backtrace :
src/DBmysql.php:1312
src/CommonDBTM.php:716 DBmysql->insert()
src/CommonDBTM.php:1316 CommonDBTM->addToDB()
...injection/inc/commoninjectionlib.class.php:1549 CommonDBTM->add()
...injection/inc/commoninjectionlib.class.php:1453 PluginDatainjectionCommonInjectionLib->effectiveAddOrUpdate()
...s/datainjection/inc/userinjection.class.php:121 PluginDatainjectionCommonInjectionLib->processAddOrUpdate()
plugins/datainjection/inc/engine.class.php:147 PluginDatainjectionUserInjection->addOrUpdateObject()
...datainjection/inc/clientinjection.class.php:267 PluginDatainjectionEngine->injectLine()
...datainjection/inc/clientinjection.class.php:219 PluginDatainjectionClientInjection::processInjection()
...datainjection/front/clientinjection.form.php:42 PluginDatainjectionClientInjection::showInjectionForm()
{"user":"2@stanislas-XPS-13-9343"} |
|
You must use groups_id instead of group name in the file you try to import... |
Well, the bug we met was related to the user insertion during a group injection. In your case, it is a group insertion during a user injection. So it could be another bug... |
My bad, I didn't read the description correctly |
@cconard96 :fix/group_user_import - Still same issue - Groups are imported without users. Anyone tested this solution ? because I don't know if I'm doing something wrong |
@Hantiel, it worked for me at least with the first commit. Will try to check with the last 2 ones... |
@Hantiel, the "issue" is that you have to use integer users_id (that GLPI previously gave to each inserted user) and not his name (login)... |
Does-it work when you try to fill a non-manager |
I merged it as it relove a regression introduced in previous versions. Remaining bugs may not be really related to this. |
I just install / copy actually develop version and same ;/ sql-error.log [2022-09-14 13:24:24] glpisqllog.ERROR: DBmysql::query() in /var/www/html/glpi/src/DBmysql.php line 370 |
Please open a new issue. |
I just check this with Mapping - User and for User is working but after return to manager - same issue. |
That is what I use, so I didn't check manager import... |
Oh. Okey my mistake. Ok thanks I will try do something with that. |
Try to fix certain cases of imports such as a Group import that includes a group member field.
Commit 6974858 had broken this type of import because
effectiveAddOrUpdate
would receive anitemtype
anditems_id
value which were not valid search options, but were still required for the import to work.This patch seems to resolve this particular issue although I don't know if it will cause other issues.