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 location hierarchy #17187

Merged

Conversation

trasher
Copy link
Contributor

@trasher trasher commented May 24, 2024

Q A
Bug fix? yes/no
New feature? yes/no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets glpi-project/glpi-inventory-plugin#513 (and maybe #17106)

@trasher
Copy link
Contributor Author

trasher commented May 24, 2024

I'm a bit surprised location is created with the full name; I was ewpecting its name to be "Paris" only.

I'll dig into that if necessary when I'll be back.

@khaegebaert
Copy link

Hi, I've tried your solution as I have the issue with locations for users and inventory but got an error:

[2024-06-03 14:05:16] glpiphplog.CRITICAL: *** Uncaught Exception TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, LDAP\Connection given in /opt/glpi/src/Html.php at line 318
Backtrace :
src/Html.php:318 str_replace()
: Html::cleanPostForTextArea()
src/Html.php:304 array_map()
src/CommonDBTM.php:1187 Html::cleanPostForTextArea()
src/CommonDBTM.php:1736 CommonDBTM->restoreInput()
src/AuthLDAP.php:2970 CommonDBTM->update()
src/AuthLDAP.php:404 AuthLDAP::ldapImportUserByServerId()
src/MassiveAction.php:1420 AuthLDAP::processMassiveActionsForOneItemtype()
src/MassiveAction.php:1398 MassiveAction->processForSeveralItemtypes()
front/massiveaction.php:62 MassiveAction->process()
public/index.php:82 require()

@trasher
Copy link
Contributor Author

trasher commented Jun 3, 2024

Either this is not related; either the proposed solution is not correct at all.

@trasher trasher changed the title Fix proposal for import location hierarchy Fix import location hierarchy Jun 3, 2024
@trasher trasher marked this pull request as ready for review June 3, 2024 12:59
@trasher
Copy link
Contributor Author

trasher commented Jun 3, 2024

I cannot test LDAP import, but if proposed changes here cause an LDAP\Connection to be sent instead of a string; I guess there is a problem elsewhere.
Please also make sure you do not have plugins installed.

(restoreInput() method should not be called at all as far as I understand, since we're not dealing with an user input)

src/CommonTreeDropdown.php Outdated Show resolved Hide resolved
src/CommonTreeDropdown.php Outdated Show resolved Hide resolved
@khaegebaert
Copy link

Hi, tried the changes from cedric-anne, everything ok now, solves the bug and no errors.
Thanks

@trasher trasher merged commit d8a0b9f into glpi-project:10.0/bugfixes Jun 4, 2024
13 checks passed
@trasher trasher deleted the fix/location_hierarchy_import branch June 4, 2024 09:44
anthonymontebrun pushed a commit to IT-Gouvernance/glpi that referenced this pull request Jul 11, 2024
* Fix proposal for import location hierarchy

* Fixes

* Apply suggestions from code review

Co-authored-by: Cédric Anne <[email protected]>

* Update tests/functional/Glpi/Inventory/Inventory.php

---------

Co-authored-by: Cédric Anne <[email protected]>
btry pushed a commit to btry/glpi that referenced this pull request Sep 19, 2024
* Fix proposal for import location hierarchy

* Fixes

* Apply suggestions from code review

Co-authored-by: Cédric Anne <[email protected]>

* Update tests/functional/Glpi/Inventory/Inventory.php

---------

Co-authored-by: Cédric Anne <[email protected]>
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.

3 participants