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

--- Comment #8 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 199200
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199200&action=edit
Bug 42444: Convert waiting holds page to API-driven

The waiting holds page (circ/waitingreserves.pl) loaded all waiting
holds at once server-side, which is slow for libraries with many
waiting holds. This patch converts it to use the REST API with
DataTables for paginated, client-side rendering.

Changes:
- circ/waitingreserves.pl: stripped down to auth + POST actions
  (cancel single, cancel bulk, cancel all expired). Data loading
  removed entirely.
- waitingreserves.tt: replaced server-rendered FOREACH loops with
  three kohaTable instances calling /api/v1/holds with appropriate
  JSON query filters:
  * Holds waiting: status=W, expiration_date >= today
  * Holds over: status=W, expiration_date < today
  * Cancellation requests: status=W, has cancellation_requests
- Embeds used: patron, patron.category, patron.notice_email_address,
  biblio, item+strings, item.holding_library, item.home_library,
  desk, cancellation_requests (last tab only)
- Library columns sort by name via embedded relationships
- Removes waiting_holds.inc (no longer used anywhere)

Note: Shelving location sorting is intentionally disabled. The
location value is an authorised value code resolved to a description
via item+strings. Server-side sorting by AV description would require
embedding the authorised_values table, which is not currently
supported by the framework.

Test plan:
1. Apply patches (including the [DO NOT PUSH] sample data commit)
2. Populate sample data:
   $ ktd --shell
  k$ yarn build ; koha-plack --restart kohadev
  k$ cd /kohadevbox/koha && perl t/lib/sample_waiting_holds.pl
   => SUCCESS: Creates 35 waiting holds covering all scenarios
3. Navigate to Circulation > Holds awaiting pickup
4. Verify 'Holds waiting' tab:
   => SUCCESS: Shows ~28 current holds with pagination
   => Columns: waiting date, hold date, expiration date, title
      (with barcode and item type), patron info, libraries,
      location, call number, copy number, enumeration
   => Some holds show desk name next to current library
   => Items with different home/holding branch show
      'Cancel hold and return to: <library>'
5. Verify 'Holds waiting past their expiration date' tab:
   => SUCCESS: Shows 7 expired holds
   => 'Cancel all' button present and functional
6. Verify 'Holds with cancellation requests' tab:
   => SUCCESS: Shows 3 holds with cancellation request date column
7. Verify patron column:
   => Name links to patron detail page
   => Phone number displayed
   => Email displayed (uses patron.notice_email_address embed,
      respects EmailFieldPrimary syspref)
   => Main contact method label displayed (Primary phone,
      Primary email, Secondary phone, etc.)
8. Verify sorting works on all sortable columns (server-side via API)
9. Test cancel single hold (form POST, check confirmation message)
10. Test bulk cancel (select multiple via checkboxes, confirm in
    modal, verify background job enqueued)
11. Test 'Cancel all' on expired holds tab
12. Verify 'View all libraries' link works (allbranches=1)
13. Sign off :-D

Assisted-by: Sonnet 4.6 (Anthropic)
Signed-off-by: Tomas Cohen Arazi <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to