https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42503

--- Comment #128 from Pedro Amorim (ammopt) <[email protected]> ---
Created attachment 208300
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208300&action=edit
Bug 42503: (RM follow-up) Fix patron column when HidePatronName is enabled

With HidePatronName enabled the API returns the patron with only
patron_id, cardnumber and category, so $patron_to_html finds no name
and renders "A patron from another library" for everyone.

This patch:
- renders the cardnumber, linked to the patron's holds, when the
  patron is accessible (patron_id present) but has no name
- keeps library_id and the library embed in the HidePatronName
  redaction, so restricted staff get "A patron from <library>" as
  before the conversion
- updates the HidePatronName API tests to expect library_id and the
  library embed

Test plan:

Setup:
1) Apply all patches for this bug except this one, then:
   updatedatabase && yarn build && restart_all
2) Populate the queue: perl t/lib/sample_holds_queue.pl

A) The regression (as koha, superlibrarian):
1) In 'Administration' > 'System preferences', set 'HidePatronName'
   to 'Don't show' and save.
2) Open http://localhost:8081/cgi-bin/koha/circ/holds_queue.pl?run_report=1
3) Notice every 'Patron' cell says "A patron from another library",
   with no link.
4) Apply this patch, run restart_all and reload the page.
5) The 'Patron' column now shows the patron's cardnumber as a link,
   phone and email still hidden.
6) Click a cardnumber, it should land on
  
http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=X#reserves

B) No regressions (with this patch applied):
1) Set 'HidePatronName' to 'Show'. Reload the queue, patrons show as
   "Surname, Preferredname (cardnumber)" plus phone/email.
2) Create a staff user at Centerville with only 'catalogue' and
   'circulate_remaining_permissions' (no superlibrarian, no
   'view_borrower_infos_from_any_libraries'), set a username/password.
3) Make sure the queue has a hold for a Centerville patron and one for
   a patron from another library (edit a patron's home library if
   needed).
4) Log in as that user and open the queue.
5) Centerville patron: "Surname, Preferredname (cardnumber)".
   Other library patron: "A patron from <library name>".
6) As koha, set 'HidePatronName' to 'Don't show', log back in as the
   restricted user and reload.
7) Centerville patron: cardnumber link only.
   Other library patron: "A patron from <library name>" (before this
   patch: "A patron from another library").

prove t/db_dependent/api/v1/holds_queue.t

Co-Authored-By: Claude Opus 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to