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 - getFriendlyNameFields() query to return only first name if only one is defined #19351

Merged

Conversation

RomainLvr
Copy link
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes !37139 linked to !34567
  • Here is a brief description of what this PR does

The getFriendlyNameFields() function takes care of constructing a query expression to retrieve a user's name.
It works as follows:

  • If name and surname are filled in, a concatenation of the two is returned.
  • If neither is filled in, the login is returned.
  • If only one of the two is filled in, we return the login.

But we should return the first name if it's the only one filled in, and the same for the last name.

IMHO i consider this to be a bug fix, rather because :

  • The current behavior is not intuitive and does not correspond to what one would expect from a user interface.
  • The aim is to adjust existing conditional logic, not to add new functionality.
  • The aim is to display the available information in a consistent way.

Sorry, something went wrong.

@RomainLvr RomainLvr self-assigned this Apr 2, 2025
@RomainLvr RomainLvr requested review from stonebuzz and Rom1-B April 2, 2025 09:37
Copy link
Contributor

@trasher trasher left a comment

Choose a reason for hiding this comment

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

lgtm

@trasher trasher merged commit 34d42c5 into glpi-project:10.0/bugfixes Apr 3, 2025
6 checks passed
@cedric-anne cedric-anne added this to the 10.0.19 milestone Apr 7, 2025
@cedric-anne cedric-anne added the bug label Apr 7, 2025
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.

None yet

5 participants