@@ -, +, @@ --- Koha/Illrequest.pm | 2 ++ Koha/REST/V1/Illrequests.pm | 2 +- admin/columns_settings.yml | 9 +++++++-- api/v1/swagger/paths/illrequests.json | 6 ++++++ .../prog/en/modules/ill/ill-requests.tt | 22 ++++++++++++++++++++-- 5 files changed, 36 insertions(+), 5 deletions(-) --- a/Koha/Illrequest.pm +++ a/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 => '', --- a/Koha/REST/V1/Illrequests.pm +++ a/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 --- a/admin/columns_settings.yml +++ a/admin/columns_settings.yml @@ -360,7 +360,7 @@ modules: - columnname: metadata_title - - columnname: metadata_item_part_title + columnname: metadata_article_title - columnname: metadata_issue - @@ -368,7 +368,7 @@ modules: - columnname: metadata_year - - columnname: metadata_item_part_pages + columnname: metadata_pages - columnname: metadata_type - @@ -399,6 +399,11 @@ modules: columnname: replied - columnname: completed + cannot_be_toggled: 1 + cannot_be_modified: 1 + is_hidden: 1 + - + columnname: completed_formatted - columnname: accessurl - --- a/api/v1/swagger/paths/illrequests.json +++ a/api/v1/swagger/paths/illrequests.json @@ -51,6 +51,12 @@ "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", "description": "A full status string e.g. REQREV", --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -527,7 +527,8 @@   Updated on Replied - Completed on +   + Completed on Access URL Cost Comments @@ -749,6 +750,14 @@ '' : ''; }; + // Our 'render' function for title + var createTitle = function(data, type, row) { + return ( + row.hasOwnProperty('metadata_container_title') && + row.metadata_container_title + ) ? row.metadata_container_title : row.metadata_title; + }; + // Render function for request ID var createRequestId = function(data, type, row) { return row.id_prefix + row.illrequest_id; @@ -834,6 +843,9 @@ func: createBiblioLink, skipSanitize: true }, + metadata_title: { + func: createTitle + }, metadata_Type: { func: createType }, @@ -905,7 +917,7 @@ // Get our data from the API and process it prior to passing // it to datatables var ajax = $.ajax( - '/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias' + '/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias,comments' ).done(function() { var data = JSON.parse(ajax.responseText); // Make a copy, we'll be removing columns next and need @@ -960,6 +972,7 @@ }); colData.push(colObj); }); + console.log(colData); // Initialise the datatable table = KohaTable("ill-requests", { @@ -978,6 +991,11 @@ // unformatted column 'aTargets': [ 'updated_formatted'], 'iDataSort': 16 + }, + { // When sorting 'completed', we want to use the + // unformatted column + 'aTargets': [ 'completed_formatted'], + 'iDataSort': 19 } ], 'aaSorting': [[ 16, 'desc' ]], // Default sort, updated descending --