Bug 40237 - Update reserves/request.pl to use Koha::Patron->can_place_holds
Summary: Update reserves/request.pl to use Koha::Patron->can_place_holds
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on: 40101
Blocks:
  Show dependency treegraph
 
Reported: 2025-06-25 11:32 UTC by Martin Renvoize (ashimema)
Modified: 2025-06-25 13:04 UTC (History)
0 users

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 40237: Make reserve/request.pl use $patron->can_place_holds() (20.35 KB, patch)
2025-06-25 11:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 40237: Make reserve/request.pl use $patron->can_place_holds() (20.36 KB, patch)
2025-06-25 13:04 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2025-06-25 11:32:06 UTC
Bug 40101 adds the new 'can_place_holds' method to Koha::Patron, but it avoided updating this complex controller and template to utilise it.
Comment 1 Martin Renvoize (ashimema) 2025-06-25 11:40:36 UTC Comment hidden (obsolete)
Comment 2 Martin Renvoize (ashimema) 2025-06-25 13:04:44 UTC
Created attachment 183494 [details] [review]
Bug 40237: Make reserve/request.pl use $patron->can_place_holds()

This patch updates the staff interface hold placement script to use
the centralized patron hold validation method instead of duplicated
manual validation logic.

Changes:
- Replaces manual maxreserves, debt, expiration, and restriction checks
  with $patron->can_place_holds() method call
- Adds staff override support by reading override_* parameters and
  passing them to the validation method
- Updates template to iterate through validation messages array
- Enhances all "Place hold" buttons to show red "Place hold with
  overrides" buttons when AllowHoldPolicyOverride is enabled and
  validation issues exist
- Maintains backward compatibility with existing item-level override
  functionality

This consolidates patron-level hold validation logic across the
codebase and provides consistent staff override capabilities in
both OPAC and staff interfaces.

Test plan:
1. Apply patches and restart services
2. Enable system preference AllowHoldPolicyOverride
3. Create a test patron with various restrictions:
   - Set expiration date in the past
   - Add fines exceeding maxoutstanding preference
   - Mark address as bad (gonenoaddress = 1)
   - Mark card as lost (lost = 1)
   - Add a debarment/restriction
   - Create holds to exceed maxreserves preference
4. Log into staff interface and try to place holds for this patron
5. Verify validation messages appear for each restriction
6. Verify "Place hold with overrides" red buttons appear instead of normal blue buttons
7. Click override button and verify hold is placed successfully
8. Test with single holds, multi-holds, item-level holds, and group holds
9. Disable AllowHoldPolicyOverride and verify normal restriction behavior
10. Verify existing item-level override functionality still works