Bug 34681

Summary: Last returned by and last/previous borrower doesn't display if patron's cardnumber is empty
Product: Koha Reporter: hebah
Component: Staff interfaceAssignee: Lucas Gass (lukeg) <lucas>
Status: Pushed to main --- QA Contact: Matt Blenkinsop <matt.blenkinsop>
Severity: normal    
Priority: P5 - low CC: gmcharlt, lucas, matt.blenkinsop, mteal
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes a bug where the 'Last borrower' and 'Previous borrower' links did not appear when the borrower lacked a cardnumber. This patch makes it fall back to borrowernumber in those cases.
Version(s) released in:
25.05.00
Circulation function:
Attachments: Bug 34681: Fallback to borrowernumber when there is no cardnumber
Bug 34681: Fallback to borrowernumber when there is no cardnumber
Bug 34681: Follow up - fix typo
Bug 34681: Fallback to borrowernumber when there is no cardnumber
Bug 34681: Follow up - fix typo

Description hebah 2023-08-31 18:42:46 UTC
To recreate:
Have StoreLastBorrower enabled to store Last Returned By.
Create account and leave cardnumber empty.
Check out and return item with that account.
Go to items detail page.
See that Last Returned By and, if return is not anonymized, Last Borrower appears blank (you can inspect the fields and see that borrower information is there but not visible). Previous borrower will similarly be blank if it is from an account with no cardnumber.

Most libraries will usually have a value in cardnumber, but if they don't for any reason, perhaps for in-house cards or by user error, it hides important circ information.
Comment 1 Lucas Gass (lukeg) 2025-01-21 16:41:16 UTC Comment hidden (obsolete)
Comment 2 Magnus Enger 2025-01-23 08:36:45 UTC
Created attachment 176940 [details] [review]
Bug 34681: Fallback to borrowernumber when there is no cardnumber

To test:
1. Have StoreLastBorrower enabled to store Last Returned By.
2. Create account and leave cardnumber empty.
3. Check out and return item with that account.
4. Go to items detail page.
5. See that Last Returned By and, if return is not anonymized, Last Borrower appears blank (you can inspect the fields and see that borrower information is there but not visible). Previous borrower will similarly be blank if it is from an account with no cardnumber.
6. APPLY PATCH
7. Try the items detail page again. You should see the link for 'Last borrower' and/or 'Previous borrower' now as the borrowernumber.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised, with the tiny followup I am providing.
Comment 3 Magnus Enger 2025-01-23 08:36:48 UTC
Created attachment 176941 [details] [review]
Bug 34681: Follow up - fix typo

Change from: [% last_retruned_by | html %]
To: [% last_returned_by | html %]
Comment 4 Matt Blenkinsop 2025-01-24 15:10:01 UTC
Created attachment 177117 [details] [review]
Bug 34681: Fallback to borrowernumber when there is no cardnumber

To test:
1. Have StoreLastBorrower enabled to store Last Returned By.
2. Create account and leave cardnumber empty.
3. Check out and return item with that account.
4. Go to items detail page.
5. See that Last Returned By and, if return is not anonymized, Last Borrower appears blank (you can inspect the fields and see that borrower information is there but not visible). Previous borrower will similarly be blank if it is from an account with no cardnumber.
6. APPLY PATCH
7. Try the items detail page again. You should see the link for 'Last borrower' and/or 'Previous borrower' now as the borrowernumber.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised, with the tiny followup I am providing.
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 5 Matt Blenkinsop 2025-01-24 15:10:04 UTC
Created attachment 177118 [details] [review]
Bug 34681: Follow up - fix typo

Change from: [% last_retruned_by | html %]
To: [% last_returned_by | html %]

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 6 Katrin Fischer 2025-01-30 17:07:12 UTC
Pushed for 25.05!

Well done everyone, thank you!