OBPIH-5972 trim white space from firstname and last name when binding user to recipient on PO items import #4384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The issue is that somehow in the database there was a user which had an extra space in it's firstname column value like
I don't know how that extra space appeared there, because I tested creating Person/User in the UI and via import and in both cases it clears the extra white space, the only way I was able to reproduce it is updating the value directly in the database.
When exporting the PO items excel it exports the users value with that extra space "name lastname" (there are two spaces in between) and trying to re-import the same file causes the system to not find the set user because when we do
split(" ")
it splits by the first space and now we are looking for users with a combo firstname and last name[ firstname: "name", lastname: " lastname" ]
adding
*.trim()
does solve the problem in a way, but I am not sure if it is necessary because the simplest solution would be to just fix the data and I am not sure if we want to dive that deep into parsing/transforming potentially incorrect data.I pushed this PR as an example and to give you guys a better context to what is happening, but if you think that we should not go this direction and just fix the data then we can close this PR.