https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27184 --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 212466 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212466&action=edit Bug 27184: Make the circulation history use the API This patch replaces the server-side rendered table on members/readingrec.pl with a `circulation-history` Vue island that fetches the data from GET /patrons/{patron_id}/checkouts, paginated, sorted and filtered server-side. readingrec.pl no longer loads the full list of checkouts and old checkouts, which was very slow for heavy borrowers. The page now shows two tables: 'Current checkouts' and 'Previous checkouts'. Both use the existing 'checkouthistory-table' table settings. The On-site checkouts tabs filter both tables. The page is bootstrapped with the CheckoutHistory module policy, passed to the island as an attribute: it replaces the permission and system preference checks the template did (access to the history, OnSiteCheckouts and RecordStaffUserOnCheckout). Display details: - Dates use $date/$datetime, due dates use { as_due_date: true } like the KohaDates TT plugin did - Titles use $biblio_to_html. Rows for deleted items read 'Item deleted' - 'Checked out by' (RecordStaffUserOnCheckout) uses $patron_to_html. When the logged in user cannot see the issuer, the API redacts it and 'A patron from <library>' is displayed, without a link. The column is neither searchable nor sortable, to avoid leaking redacted names through filtering or ordering. Note the previous template displayed the issuer name regardless of this. - The renewals 'View' link keeps using checkout_renewals_modal.js, now using a delegated click handler so it works on rows drawn by the table 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 for a patron, and leave some checked out 4. Go to the patron's 'Circulation 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: Dates and due dates are formatted as per the 'dateformat' and 'TimeFormat' system preferences 5. Click 'View' on a renewed checkout => SUCCESS: The renewals modal is displayed 6. Enable OnSiteCheckouts, do an on-site checkout, reload and use the tabs => SUCCESS: Both tables are filtered 7. Enable RecordStaffUserOnCheckout and checkout items with a staff user from a different library 8. Set up a library group with 'Hide patron info for libraries outside this group' that doesn't include that library, and login as a user without view_borrower_infos_from_any_libraries, from a library in the group, that can see the patron => SUCCESS: 'Checked out by' reads 'A patron from <library>', no link 9. Run: k$ prove xt/check-thead-tt-tags.t k$ yarn cypress run --spec t/cypress/integration/KohaTable/CirculationHistory_spec.ts => SUCCESS: Tests pass! 10. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.