https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29275 --- Comment #54 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 212277 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212277&action=edit Bug 29275: Use the API to render the checkout history for a record This patch replaces the server-side rendered table on catalogue/issuehistory.pl with a `biblio-checkout-history` Vue island that fetches the data from GET /biblios/{biblio_id}/checkouts, paginated, sorted and filtered server-side. issuehistory.pl no longer loads all the checkouts and old checkouts for the record, which made the page time out for records with many checkouts. The page now shows two tables: 'Current checkouts' and 'Previous checkouts', rendered by the same component. Both use the existing 'checkoutshistory-table' table settings. The 'Checked out N times' count and the 'never been checked out' message are kept. The page is bootstrapped with the CheckoutHistory module policy, passed to the island as an attribute, instead of computing permissions and system preferences in the template. Patron display matches what patron-title.inc did: - The Patron column is only displayed (and the patron embed only requested) with the view_patrons and view_checkout_history policy capabilities - Checkouts by the AnonymousPatron read 'Anonymized' - HidePatronName displays the cardnumber instead of the name - Patrons the user cannot see are redacted by the API, and are displayed as 'A patron from <patron's library>', without a link The patron and 'Checked out by' columns are neither searchable nor sortable, to avoid leaking redacted names through filtering or ordering. The issuer was displayed regardless of visibility before. Like on the patron's circulation history, 'Checked out by' is only displayed if RecordStaffUserOnCheckout is enabled. Dates use $date/$datetime, due dates use { as_due_date: true } like the KohaDates TT plugin did. Test plan: 1. Apply patch 2. Rebuild the JS and restart: $ ktd --shell k$ yarn js:build k$ yarn api:bundle k$ restart_all 3. Check out and check in a few items from a record, leave some checked out 4. Go to the record's 'Checkout history' tab => SUCCESS: Current and previous checkouts are listed in two tables => SUCCESS: Sorting, searching and pagination work (check the API requests in the browser's network tab) => SUCCESS: 'Checked out N times' is displayed 5. Open the tab for a record that has never been checked out => SUCCESS: 'This record has never been checked out.' is displayed 6. Enable HidePatronName and reload => SUCCESS: Cardnumbers are displayed instead of patron names 7. Set AnonymousPatron to the patron of one of the checkouts and reload => SUCCESS: 'Anonymized' is displayed 8. Set up a library group with 'Hide patron info for libraries outside this group', login as a user without view_borrower_infos_from_any_libraries from a library in the group => SUCCESS: Patrons from libraries outside the group read 'A patron from <their library>', without link 9. Login as a user with only the catalogue permission => SUCCESS: The page loads, without the Patron column 10. Enable RecordStaffUserOnCheckout and reload => SUCCESS: The 'Checked out by' column is displayed 11. Run: k$ prove xt/check-thead-tt-tags.t k$ yarn cypress run --spec t/cypress/integration/KohaTable/BiblioCheckoutHistory_spec.ts => SUCCESS: Tests pass! 12. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes.