From 49b3da4b5f58d8a36a431b480f53a574f9f0435f Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 15 Aug 2024 17:04:01 +0100 Subject: [PATCH] Bug 33736: Add filter for holding library This patch adds the option to filter the pending bookings to collect report by items current holding library and defaults to the users logged in library. We also add the 'Pickup library' column to the report output so staff know whether the item needs collecting for sending to another library or for their own. --- circ/pendingbookings.pl | 17 +++++---- .../prog/en/modules/circ/pendingbookings.tt | 35 +++++++++++++++++-- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/circ/pendingbookings.pl b/circ/pendingbookings.pl index 677925268dd..5cb4b1eb0c9 100755 --- a/circ/pendingbookings.pl +++ b/circ/pendingbookings.pl @@ -21,8 +21,10 @@ use Modern::Perl; use CGI qw ( -utf8 ); +use C4::Context; + use C4::Output qw( output_html_with_http_headers ); -use C4::Auth qw( get_template_and_user ); +use C4::Auth qw( get_template_and_user ); use Koha::DateUtils qw(dt_from_string); @@ -36,14 +38,17 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( } ); -my $today = dt_from_string(); +my $today = dt_from_string(); my $startdate = $today->truncate( to => 'day' ); -my $enddate = $startdate->clone->add( days => 7 ); +my $enddate = $startdate->clone->add( days => 7 ); +my $branchcode = + defined( $input->param('library') ) ? $input->param('library') : C4::Context->userenv->{'branch'}; $template->param( - todaysdate => $today, - from => $startdate, - to => $enddate + todaysdate => $today, + from => $startdate, + to => $enddate, + branchcode => $branchcode ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt index 11cb47241fb..60103d8ab0a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt @@ -1,5 +1,6 @@ [% USE raw %] [% USE Asset %] +[% USE Branches %] [% USE Koha %] [% USE KohaDates %] [% USE TablesSettings %] @@ -50,7 +51,7 @@ - +
@@ -106,7 +124,11 @@ } return { '>=': isoFrom, '<=': isoTo }; - } + }, + 'item.holding_library_id': function() { + let library = $("#library").find(":selected").val(); + return library; + }, }; var bookings_table_url = '/api/v1/bookings?'; @@ -117,7 +139,8 @@ "embed": [ "biblio", "item", - "patron" + "patron", + "pickup_library" ], "order": [[ 1, "asc" ]], "columns": [{ @@ -125,6 +148,12 @@ "title": "Booking ID", "visible": false }, + { + "data": "pickup_library.name", + "title": "Pickup library", + "searchable": true, + "orderable": true, + }, { "data": "biblio.title", "title": "Title", -- 2.46.0