From c369f4c6334e5e0d20907525610e51888224a5a1 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 3 Nov 2023 11:39:27 +0000 Subject: [PATCH] Bug 29002: Add 'manage_bookings' permission Somehow this got lost during rebases. Restoring the permission here to allow libraries to restrict which librarians can add, edit and remove bookings. Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_29002.pl | 10 ++++++++++ installer/data/mysql/mandatory/userpermissions.sql | 1 + .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 2 +- .../intranet-tmpl/prog/en/includes/permissions.inc | 5 +++++ .../intranet-tmpl/prog/en/modules/bookings/list.tt | 9 ++++++++- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_29002.pl b/installer/data/mysql/atomicupdate/bug_29002.pl index fe8b6afc71..dd0a978ddd 100755 --- a/installer/data/mysql/atomicupdate/bug_29002.pl +++ b/installer/data/mysql/atomicupdate/bug_29002.pl @@ -37,5 +37,15 @@ return { ALTER TABLE deleteditems ADD COLUMN `bookable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean value defining whether this this item is available for bookings or not' AFTER `barcode` }); } + + $dbh->do(q{ + INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( + 1, + 'manage_bookings', + 'Manage item bookings' + ); + }); + say $out "Added new permissions 'manage_bookings'"; + }, }; diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 2ffe484f3e..9660879f86 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -4,6 +4,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'overdues_report', 'Execute overdue items report'), ( 1, 'force_checkout', 'Force checkout if a limitation exists'), ( 1, 'manage_restrictions', 'Manage restrictions for accounts'), + ( 1, 'manage_bookings', 'Manage item bookings'), ( 1, 'manage_checkout_notes', 'Mark checkout notes as seen/not seen'), ( 1, 'manage_curbside_pickups', 'Manage curbside pickups'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index 41c8d1ed50..93818826d2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -195,7 +195,7 @@ [% END %] [% END %] -[% IF Biblio.CanBook(biblionumber) %] +[% IF ( CAN_user_circulate_manage_bookings && Biblio.CanBook(biblionumber) ) %]
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index aa40a2fe11..3d0af47233 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -117,6 +117,11 @@ Override blocked renewals ([% name | html %]) + [%- CASE 'manage_bookings' %] + + Manage item bookings + + ([% name | html %]) [%- CASE 'manage_checkout_notes' %] Mark checkout notes as seen/not seen diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt index cd1db03a94..07c228412a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt @@ -106,7 +106,11 @@ display_cardnumber: true, url: false }), + [% IF CAN_user_circulate_manage_bookings %] editable: { remove: true, updateTime: true }, + [% ELSE %] + editable: false, + [% END %] type: 'range', group: booking.item_id ? booking.item_id : 0 }); @@ -251,8 +255,11 @@ "searchable": false, "orderable": false, "render": function(data, type, row, meta) { - var result = ''; + let result = ""; + [% IF CAN_user_circulate_manage_bookings %] + result += ''; result += ''; + [% END %] return result; } }]