Bug 40101 adds the new 'can_place_holds' method to Koha::Patron, but it avoided updating this complex controller and template to utilise it.
Created attachment 183487 [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
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