https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42503
--- Comment #124 from Tomás Cohen Arazi (tcohen) <[email protected]> --- Created attachment 208129 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208129&action=edit Bug 42503: (follow-up) Use $patron_to_html for the holds queue patron column The holds queue patron column formatted the name by hand, which caused two regressions compared to the original view_holdsqueue.tt (which used patron-title.inc): - the preferred name and card number were ignored: the column showed 'Surname, Firstname' instead of 'Surname, Preferredname (cardnumber)' - patrons the logged-in staff member may not see (no 'view_borrower_infos_from_any_libraries' for the patron's library) showed an empty cell instead of 'A patron from <library>' Both are display-only problems. The API already does the right thing: identifying fields are redacted by Koha::Patron->is_accessible during to_api serialisation, while library_id/library are preserved. Rather than reimplement the formatting rules, this patch reuses the shared window.$patron_to_html helper (koha-tmpl/.../js/patron-format.js, already loaded globally via js_includes.inc and used by holds.js, ill-list-table.js, etc.). It handles the preferred name, middle/other names, the card number, the 'A patron from <library>' fallback for redacted patrons, and the circulation link, all consistently with the rest of the staff interface. Changes: - koha-tmpl/.../circ/holds_queue.tt: - render the patron column with $patron_to_html(row.patron, { invert_name, display_cardnumber, url: 'circulation_reserves' }) - keep the 'patron.library' embed (used by the helper's fallback) - t/db_dependent/api/v1/holds_queue.t: add a 'patron visibility across libraries' subtest verifying identifying fields are redacted for a restricted cross-library staff user while library_id is preserved, and that a superlibrarian still sees the full patron Test plan: 1. Apply all patches for this bug 2. Run the API tests: $ ktd --shell k$ prove t/db_dependent/api/v1/holds_queue.t => SUCCESS: all tests pass, including the new cross-library subtest 3. Edit a patron in the queue: set 'Preferred name' different from 'First name' 4. Reload Circulation > Holds queue => FAIL (before this patch): patron shows 'Surname, Firstname', no card number 5. Create a staff user at library A with only 'catalogue' and 'circulate_remaining_permissions' (no 'view_borrower_infos_from_any_libraries'); make sure the queue has a hold for a patron from library B 6. Log in as that staff user and open the holds queue => FAIL (before this patch): the patron cell is empty 7. Apply this patch and rebuild assets: k$ yarn build 8. Repeat steps 4 and 6 => SUCCESS: the patron shows 'Surname, Preferredname (cardnumber)', and the cross-library patron shows 'A patron from <library>' 9. Sign off :-D Assisted-by: Sonnet 4.6 (Anthropic) -- 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/
