Koha-clms/reserve
Pedro Amorim 8ccba18691
Bug 31391: (RM follow-up) Enforce recalls permission when converting holds to recalls
The previous follow-up only blanked the button's label via JS for
users without the recalls permission; the button still rendered,
was still clickable, and modrequest.pl's cud-convertall had no
permission check at all, so the conversion still succeeded.

Adds CAN_user_recalls to the button's template condition (matching
the existing "Move selected holds" button) so it doesn't render at
all without the permission, drops the now-redundant JS check in
holds.js, and adds a manage_recalls check in modrequest.pl itself.
checkauth()'s userid is the login username, not a borrowernumber, so
this uses C4::Auth::haspermission() directly rather than
Koha::Patrons->find().

Test plan:
1) Set a default recalls rule in admin/smart-rules.pl.
2) Set UseRecalls to 'staff' or 'opac_and_staff'.
3) Give a test patron 'catalogue' + 'reserveforothers' but not
   'recalls'.
4) Check out an item, place a hold on it for another patron.
5) As the test patron, go to that record's Holds tab, confirm
   'Convert selected to recall' doesn't appear.
6) Since the button is gone, confirm the server side is enforced too:
   post op=cud-convertall directly to modrequest.pl and confirm it no
   longer converts the hold.
7) Grant 'recalls' and confirm the button reappears and works.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-14 14:16:03 +00:00
..
hold-group.pl Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
modrequest.pl Bug 31391: (RM follow-up) Enforce recalls permission when converting holds to recalls 2026-09-14 14:16:03 +00:00
modrequest_suspendall.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
placerequest.pl Bug 36868: (follow-up) Fix variable names 2026-09-10 14:24:10 +00:00
request.pl Bug 31391: Request recalls and convert reserves on staff interface 2026-09-14 14:15:54 +00:00