From b8753edfd07ae6c375556b93c49323dd3511a517 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Fri, 20 Apr 2018 14:25:49 +0100 Subject: [PATCH] Bug 20600: Add filtering of ILL requests in list This patch adds the ability for the ILL request list in the staff interface to be filtered by a number of criteria: - Status - Date placed - Date modified - Pickup branch - Borrower card number To test: 1) Apply patch 2) Ensure you have a reasonable range of ILL requests created 3) Navigate to the "View ILL requests" page 4) Choose one or more filtering criteria 5) Click "Search" 6) Observe the results are filtered to match the selected criteria 7) Click "Clear" 8) Observe your results are returned to their initial state 9) Repeat steps 4 -> 6 until you are happy. Dates supplied by the /api/v1/illrequests API route were not conforming to the preference specified by the dateformat syspref. This patch addresses that. It has been addressed as part of this bug since we are adding filtering of requests by some date fields and, therefore, needed dates in a predictable format. To test: 1) Apply the patch 2) Ensure you have at least one ILL request created 3) Make a request to the /api/v1/illrequests endpoint 4) Observe that dates supplied for "placed_formatted" & "updated_formatted" conform to your dateformat syspref. 5) Change your date format syspref, repeat steps 3 & 4 Signed-off-by: Magnus Enger Works as advertised. Nice enh! Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer --- Koha/REST/V1/Illrequests.pm | 20 ++ .../intranet-tmpl/prog/css/src/staff-global.scss | 5 + .../prog/en/modules/ill/ill-requests.tt | 328 +++++++++++++++++++-- 3 files changed, 323 insertions(+), 30 deletions(-) diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm index 324a1ca94f..66ac795006 100644 --- a/Koha/REST/V1/Illrequests.pm +++ b/Koha/REST/V1/Illrequests.pm @@ -22,6 +22,7 @@ use Koha::Illrequestattributes; use Koha::Libraries; use Koha::Patrons; use Koha::Libraries; +use Koha::DateUtils qw( format_sqldatetime ); =head1 NAME @@ -39,6 +40,9 @@ sub list { my $c = shift->openapi->valid_input or return; my $args = $c->req->params->to_hash // {}; + my $filter; + my $output = []; + my @format_dates = ( 'placed', 'updated' ); # Create a hash where all keys are embedded values # Enables easy checking @@ -52,6 +56,22 @@ sub list { # Get all requests my @requests = Koha::Illrequests->as_list; + # Create new "formatted" columns for each date column + # that needs formatting + foreach(@requests) { + foreach my $field(@format_dates) { + if (defined $_->{$field}) { + $_->{$field . "_formatted"} = format_sqldatetime( + $_->{$field}, + undef, + undef, + 1 + ); + } + } + + } + # Identify patrons & branches that # we're going to need and get them my $to_fetch = { diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index ec7cd4711b..599dc2d742 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -4060,6 +4060,11 @@ span { } } +#illfilter_dateplaced, +#illfilter_datemodified { + width: 80%; +} + #requestattributes { font-family: monospace; line-height: 1.3em; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index 8b747105c8..c753494c13 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -10,12 +10,30 @@ [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] [% Asset.css("css/datatables.css") | $raw %] [% INCLUDE 'datatables.inc' %] - @@ -326,6 +552,45 @@
+ [% IF query_type == 'illlist' %] +
+
+
+

Filters

+
    +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
  7. + + +
  8. +
  9. + + +
  10. +
+
+ + +
+
+
+
+ [% END %]
[% IF !backends_available || !has_branch %] @@ -715,7 +980,10 @@ Bibliographic record ID Library Status - Updated on +   + Date placed +   + Updated on Request number Comments -- 2.11.0