From aab4ed314c21293957a7b75a5164823f69069ab7 Mon Sep 17 00:00:00 2001 From: William Lavoie Date: Mon, 3 Feb 2025 12:31:41 -0500 Subject: [PATCH] Bug 38040: Light reformating When IndependentBranches is enabled, any staff member from any library can see and edit the holds for patrons from other libraries. Only superlibrarians should be able to edit all holds, including those from other libraries. Staff patrons should only be able to edit or delete holds for their library. Test plan: 1. Set IndependentBranches, IndependentBranchesPatronModifications, and IndependentBranchesTransfers to 'Yes'. 2. Set canreservefromotherbranches to "Don't allow (with independent branches)". 3. Give limited permissions to a staff patron - circulate - catalogue - delete_borrowers - edit_borrowers - list_borrowers - send_messages_to_borrowers - reserveforothers - updatecharges 4. As the superlibrarian, place several holds on a record with items from various branches. 5. Log in as the restricted staff 6. View the holds for the record --> Some will say "A patron from library XX" instead of the name -- OK 7. Click the trash bin icon to cancel a hold from another library --> Hold is cancelled -- NOT OK 8. Apply the patch and validate that step 7 is not possible now. --- .../intranet-tmpl/prog/en/modules/reserve/request.tt | 4 ++-- reserve/request.pl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 9597d7ad72..268cd5507e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1870,8 +1870,8 @@ return false; }); - [% IF (!is_super_librarian) %] - var user_branch = "[% user_branch %]"; + [% IF (!CAN_user_superlibrarian) %] + var user_branch = "[% Branches.GetLoggedInBranchcode %]"; if(user_branch !== undefined && user_branch !== ""){ $('#patron_holds_table tbody tr').each(function() { var link = $(this).find('a[href*="member"]'); diff --git a/reserve/request.pl b/reserve/request.pl index d06b6a5aba..c8006385bd 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -121,10 +121,10 @@ if ( $op eq 'cud-move' ) { } } elsif ( $op eq 'cud-cancel' ) { - my $reserve_id = $input->param('reserve_id'); - my $cancellation_reason = $input->param("cancellation-reason"); - my $hold = Koha::Holds->find($reserve_id); - $hold->cancel( { cancellation_reason => $cancellation_reason } ) if $hold; + my $reserve_id = $input->param('reserve_id'); + my $cancellation_reason = $input->param("cancellation-reason"); + my $hold = Koha::Holds->find($reserve_id); + $hold->cancel( { cancellation_reason => $cancellation_reason } ) if $hold; } elsif ( $op eq 'cud-setLowestPriority' ) { my $reserve_id = $input->param('reserve_id'); -- 2.43.0