From 7413de82f2d3f4cc359c9963bcfb9008f8d048f4 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Thu, 12 Jul 2018 11:12:00 +0100 Subject: [PATCH] Bug 21063: Add "Columns settings" for ILL This patch adds the "Columns settings" values for the illrequests table Signed-off-by: Niamh.Walker-Headon@it-tallaght.ie Signed-off-by: Josef Moravec Bug 21063: Add ability to show / hide columns This patch adds the "Column visibility" functionality to the main ILL request list table. To test: - Ensure ILL is enabled and you have some requests - Apply patch - From the "Koha administration screen, select "Configure columns" - In the "Columns settings" page: => TEST: Ensure an "Interlibrary loans" category exists - Upon expanding the category: => TEST: Ensure a table is displayed showing columns => TEST: Ensure the "action" column has "Cannot be toggled" pre-selected => TEST: Change values for columns and ensure they're saved - From the main staff menu, select "ILL requests" - In the table: => TEST: Click the "Column visibility" button and ensure a modal containing all columns (except "Action") is displayed => TEST: Select various columns and ensure they are shown and hidden Signed-off-by: Niamh.Walker-Headon@it-tallaght.ie Signed-off-by: Josef Moravec Bug 21063: (follow-up) Add user ID to column list As originally specified in bug 20883, there is a requirement for some users to be able to display the user ID (borrowernumber) in the UI. This patch adds that ability to this bug, 20883 will be marked as a duplicate of this one. Signed-off-by: Josef Moravec Bug 21063: (follow-up) Amendments for rebase Modify to add the additional changes required now we're rebasing on top of the dependency tree. Includes adding additional columns (and changing indexes for search/filter where appropriate) Signed-off-by: Josef Moravec Bug 21063: (follow-up) Add comments to column list Since this bug is now dependent on Bug 18591 (Allow an arbitrary number of comments on ILLs) we need to add the comments column to this table and the list of selectable columns. This patch does this. Signed-off-by: Josef Moravec Bug 21063: (follow-up) Sanitize datatable data This mitigates bug 22268 by sanitizing data prior to display using the built in $.fn.dataTable.render.text() helper provided by Datatables. The patch was added here, rather that in 22268 since this is the bug that introduced the problem by increasing the number of fields that are displayed in the table, some of which could contain user provided malicious data Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- Koha/Illrequest.pm | 2 + Koha/REST/V1/Illrequests.pm | 9 +- admin/columns_settings.yml | 71 +++++ api/v1/swagger/paths/illrequests.json | 6 + .../prog/en/modules/admin/columns_settings.tt | 6 + .../prog/en/modules/ill/ill-requests.tt | 288 ++++++++++-------- t/db_dependent/api/v1/illrequests.t | 8 +- 7 files changed, 251 insertions(+), 139 deletions(-) diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 13c0b1114d..7158aa519e 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -25,6 +25,7 @@ use File::Basename qw( basename ); use Encode qw( encode ); use Mail::Sendmail; use Try::Tiny; +use DateTime; use Koha::Database; use Koha::Email; @@ -659,6 +660,7 @@ Mark a request as completed (status = COMP). sub mark_completed { my ( $self ) = @_; $self->status('COMP')->store; + $self->completed(DateTime->now)->store; return { error => 0, status => '', diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm index 2e428f7527..f8385a7fd2 100644 --- a/Koha/REST/V1/Illrequests.pm +++ b/Koha/REST/V1/Illrequests.pm @@ -43,7 +43,7 @@ sub list { my $args = $c->req->params->to_hash // {}; my $output = []; - my @format_dates = ( 'placed', 'updated' ); + my @format_dates = ( 'placed', 'updated', 'completed' ); # Create a hash where all keys are embedded values # Enables easy checking @@ -127,9 +127,10 @@ sub list { foreach my $p(@{$patron_arr}) { if ($p->{borrowernumber} == $req->borrowernumber) { $to_push->{patron} = { - firstname => $p->{firstname}, - surname => $p->{surname}, - cardnumber => $p->{cardnumber} + patron_id => $p->{borrowernumber}, + firstname => $p->{firstname}, + surname => $p->{surname}, + cardnumber => $p->{cardnumber} }; last; } diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 296103de45..d0ad093a2f 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -350,6 +350,77 @@ modules: cannot_be_toggled: 1 cannot_be_modified: 1 + illrequests: + ill-requests: + ill-requests: + - + columnname: illrequest_id + - + columnname: metadata_author + - + columnname: metadata_title + - + columnname: metadata_article_title + - + columnname: metadata_issue + - + columnname: metadata_volume + - + columnname: metadata_year + - + columnname: metadata_pages + - + columnname: metadata_type + - + columnname: orderid + - + columnname: patron + - + columnname: biblio_id + - + columnname: library_branchname + - + columnname: status + - + columnname: placed + cannot_be_toggled: 1 + cannot_be_modified: 1 + is_hidden: 1 + - + columnname: placed_formatted + - + columnname: updated + cannot_be_toggled: 1 + cannot_be_modified: 1 + is_hidden: 1 + - + columnname: updated_formatted + - + columnname: replied + - + columnname: completed + cannot_be_toggled: 1 + cannot_be_modified: 1 + is_hidden: 1 + - + columnname: completed_formatted + - + columnname: accessurl + - + columnname: cost + - + columnname: comments + - + columnname: notesopac + - + columnname: notesstaff + - + columnname: backend + - + columnname: action + cannot_be_toggled: 1 + cannot_be_modified: 1 + members: fines: account-fines: diff --git a/api/v1/swagger/paths/illrequests.json b/api/v1/swagger/paths/illrequests.json index ac63bc4f55..99ec0dd95b 100644 --- a/api/v1/swagger/paths/illrequests.json +++ b/api/v1/swagger/paths/illrequests.json @@ -50,6 +50,12 @@ "description": "The date the request was considered completed", "required": false, "type": "string" + }, { + "name": "completed_formatted", + "in": "query", + "description": "The date the request was considered complete formatted", + "required": false, + "type": "string" }, { "name": "status", "in": "query", diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt index 53b4e9ed8d..e5f9df444b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt @@ -146,6 +146,12 @@ [% PROCESS pagelist module=modules.coursereserves modulename="coursereserves" %] +

Interlibrary loans

+
+

Interlibrary loans tables

+ [% PROCESS pagelist module=modules.illrequests modulename="illrequests" %] +
+

Patrons

Patrons tables

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 18e7820207..63514107d0 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 @@ -5,6 +5,7 @@ [% USE KohaDates %] [% SET footerjs = 1 %] [% USE AuthorisedValues %] +[% USE ColumnsSettings %] [% INCLUDE 'doc-head-open.inc' %] Koha › ILL requests @@ -62,8 +63,8 @@
  • - - + +
  • @@ -507,20 +508,34 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -544,6 +559,7 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] [% INCLUDE 'calendar.inc' %] [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
    AuthorTitlePatronBibliographic record IDLibraryStatus Date placed Updated onRequest numberCommentsCardnumberRequest IDAuthorTitleArticle titleIssueVolumeYearPagesTypeOrder IDPatronBibliographic recordBranchStatus Placed on Updated onReplied Completed onAccess URLCostCommentsOPAC notesStaff notesBackend