Bug 33457

Summary: Improve display of fund users when the patron has no firstname
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: AcquisitionsAssignee: Owen Leonard <oleonard>
Status: Pushed to oldstable --- QA Contact: Martin Renvoize <martin.renvoize>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.03,23.05.09
Bug Depends on: 29575    
Bug Blocks: 35329    
Attachments: Bug 33457: Improve display of fund users when the patron has no firstname
Bug 33457: Improve display of fund users when the patron has no firstname
Bug 33457: Improve display of fund users when the patron has no firstname
Bug 33457: (QA follow-up) Use js-patron-format instead
Bug 33457: (follow-up) Simplify even further
Bug 33457: (QA follow-up) Use js-patron-format instead
Bug 33457: (follow-up) Simplify even further

Description Katrin Fischer 2023-04-08 21:27:40 UTC
When a patron is added to a fund as user and they have no surname, null is displayed instead:

* Go to administration > funds
* Edit fund
* Click 'Add users'
* Select a user, only staff users will be searchable
* In the sample database, choose cardnumber 42
* After adding the user, the name displays as: null koha
Comment 1 Katrin Fischer 2023-04-08 21:28:42 UTC
The same display problems appears for the owner of a fund when the firstname is missing.
Comment 2 Katrin Fischer 2024-01-16 09:33:00 UTC
Still valid
Comment 3 Owen Leonard 2024-01-16 13:22:02 UTC
Created attachment 161064 [details] [review]
Bug 33457: Improve display of fund users when the patron has no firstname

This patch updates the way the fund modification page handles patron
names so that a patron with only a first name or only a surname will
have their name appear correctly when selected as a manager or a user.

To test, apply the patch if necessary, create a patron with only a first
name and one with only a surname and give them acquisitions permissions.

- Go to Administration -> Funds.
- Edit a fund.
- Click 'Add users'.
- Select a user, only staff users will be searchable
- Select one of the patrons you created.
  - The patron name should appear correctly
  - Test with both your first name only patron and your last name only
    patron.
- Perform the same test with the 'Select owner' process.
Comment 4 Lucas Gass 2024-01-17 22:51:50 UTC
Created attachment 161124 [details] [review]
Bug 33457: Improve display of fund users when the patron has no firstname

This patch updates the way the fund modification page handles patron
names so that a patron with only a first name or only a surname will
have their name appear correctly when selected as a manager or a user.

To test, apply the patch if necessary, create a patron with only a first
name and one with only a surname and give them acquisitions permissions.

- Go to Administration -> Funds.
- Edit a fund.
- Click 'Add users'.
- Select a user, only staff users will be searchable
- Select one of the patrons you created.
  - The patron name should appear correctly
  - Test with both your first name only patron and your last name only
    patron.
- Perform the same test with the 'Select owner' process.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 5 Martin Renvoize 2024-01-23 14:34:48 UTC
Can we not use koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc here?
Comment 6 Martin Renvoize 2024-01-23 14:49:22 UTC
Created attachment 161299 [details] [review]
Bug 33457: Improve display of fund users when the patron has no firstname

This patch updates the way the fund modification page handles patron
names so that a patron with only a first name or only a surname will
have their name appear correctly when selected as a manager or a user.

To test, apply the patch if necessary, create a patron with only a first
name and one with only a surname and give them acquisitions permissions.

- Go to Administration -> Funds.
- Edit a fund.
- Click 'Add users'.
- Select a user, only staff users will be searchable
- Select one of the patrons you created.
  - The patron name should appear correctly
  - Test with both your first name only patron and your last name only
    patron.
- Perform the same test with the 'Select owner' process.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2024-01-23 14:49:25 UTC
Created attachment 161300 [details] [review]
Bug 33457: (QA follow-up) Use js-patron-format instead

This patch updates the code to use the $patron_to_html js function
rather than replicating it locally.. this means if in the future we
introduce further fixes/improvements to the display they're affect here
too.

Test plan
1) As for the original implementation, confirm the fix is still fixed
Comment 8 Martin Renvoize 2024-01-23 14:50:05 UTC
If someone fancies checking my follow-up still achieves the desired affect without regressions, I think we could PQA here.
Comment 9 Martin Renvoize 2024-01-25 11:56:22 UTC
Created attachment 161392 [details] [review]
Bug 33457: (follow-up) Simplify even further
Comment 10 Owen Leonard 2024-01-25 13:20:38 UTC
Created attachment 161395 [details] [review]
Bug 33457: (QA follow-up) Use js-patron-format instead

This patch updates the code to use the $patron_to_html js function
rather than replicating it locally.. this means if in the future we
introduce further fixes/improvements to the display they're affect here
too.

Test plan
1) As for the original implementation, confirm the fix is still fixed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 11 Owen Leonard 2024-01-25 13:20:40 UTC
Created attachment 161396 [details] [review]
Bug 33457: (follow-up) Simplify even further

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 12 Katrin Fischer 2024-01-26 14:17:23 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 13 Fridolin Somers 2024-01-31 13:55:40 UTC
Depends on Bug 29575 that added $patron_to_html
Comment 14 Fridolin Somers 2024-01-31 13:55:51 UTC
Pushed to 23.11.x for 23.11.03
Comment 15 Lucas Gass 2024-02-09 20:30:24 UTC
Backported to 23.05.x for upcoming 23.05.09