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>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2024-01-16 12:57:34 +00:00 committed by Katrin Fischer
parent 8a478f912f
commit 00ed806d20
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 2 additions and 2 deletions

View file

@ -650,7 +650,7 @@
e.preventDefault();
var borrowernumber = $(this).data("borrowernumber");
var borrower_data = JSON.parse($("#borrower_data"+borrowernumber).val());
add_user( borrowernumber, borrower_data.firstname + " " + borrower_data.surname );
add_user( borrowernumber, ( borrower_data.firstname ? borrower_data.firstname : "" ) + ' ' + ( borrower_data.surname ? borrower_data.surname : "" ) );
});
$("body").on("click",".select_user",function(e){

View file

@ -558,7 +558,7 @@
function select_user(borrowernumber, borrower) {
ownerRemove();
var borrowername = borrower.firstname + ' ' + borrower.surname;
var borrowername = ( borrower.firstname ? borrower.firstname : "" ) + ' ' + ( borrower.surname ? borrower.surname : "" );
if (borrowernumber) {
var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
+ '?borrowernumber=' + borrowernumber + '">'