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.

Sponsored-by: PTFS Europe Ltd
Signed-off-by: Esther Melander <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-08-15 17:04:01 +01:00 committed by Katrin Fischer
parent deb0a8f9f6
commit b910ccb647
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 43 additions and 9 deletions

View file

@ -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;

View file

@ -1,5 +1,6 @@
[% USE raw %]
[% USE Asset %]
[% USE Branches %]
[% USE Koha %]
[% USE KohaDates %]
[% USE TablesSettings %]
@ -50,7 +51,7 @@
</main>
</div>
<!-- Filters -->
<!-- Filters & Navigation -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
<div id="filters">
@ -58,6 +59,22 @@
<fieldset class="brief">
<h4>Refine results</h4>
<ol>
<li>
<label for="library">Library:</label>
<select name="library" id="library">
[% SET libraries = Branches.all( only_from_group => 1 ) %]
[% IF libraries.size != 1 %]
<option value="">Any</option>
[% END %]
[% FOREACH l IN libraries %]
[% IF (l.branchcode == branchcode) %]
<option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
[% ELSE %]
<option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="from">Start date: </label>
<input type="text" size="10" id="from" name="from" value="[% from | html %]" class="flatpickr" data-date_to="to"/>
@ -74,6 +91,7 @@
</fieldset>
</form>
</div>
[% INCLUDE 'circ-nav.inc' %]
</aside>
</div>
</div>
@ -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",