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 <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-11-03 11:39:27 +00:00 committed by Tomas Cohen Arazi
parent c358f9cc45
commit c369f4c633
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
5 changed files with 25 additions and 2 deletions

View file

@ -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'";
},
};

View file

@ -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'),

View file

@ -195,7 +195,7 @@
[% END %]
[% END %]
[% IF Biblio.CanBook(biblionumber) %]
[% IF ( CAN_user_circulate_manage_bookings && Biblio.CanBook(biblionumber) ) %]
<div class="btn-group"><button id="placbooking" class="btn btn-default" data-toggle="modal" data-target="#placeBookingModal" data-biblionumber="[% biblionumber | html %]"><i class="fa fa-calendar"></i> Place booking</button></div>
[% END %]

View file

@ -117,6 +117,11 @@
Override blocked renewals
</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'manage_bookings' %]
<span class="sub_permission manage_bookings_subpermission">
Manage item bookings
</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'manage_checkout_notes' %]
<span class="sub_permission manage_checkout_notes_subpermission">
Mark checkout notes as seen/not seen

View file

@ -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 = '<button type="button" class="btn btn-default btn-xs edit-action" data-toggle="modal" data-target="#placeBookingModal" data-booking="'+row.booking_id+'" data-biblionumber="[% biblionumber | uri %]" data-itemnumber="'+row.item_id+'" data-patron="'+row.patron_id+'" data-start_date="'+row.start_date+'" data-end_date="'+row.end_date+'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</button>';
let result = "";
[% IF CAN_user_circulate_manage_bookings %]
result += '<button type="button" class="btn btn-default btn-xs edit-action" data-toggle="modal" data-target="#placeBookingModal" data-booking="'+row.booking_id+'" data-biblionumber="[% biblionumber | uri %]" data-itemnumber="'+row.item_id+'" data-patron="'+row.patron_id+'" data-start_date="'+row.start_date+'" data-end_date="'+row.end_date+'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</button>';
result += '<button type="button" class="btn btn-default btn-xs cancel-action" data-toggle="modal" data-target="#cancelBookingModal" data-booking="'+row.booking_id+'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Cancel")+'</button>';
[% END %]
return result;
}
}]