From 78eea99b7ef3d03a0e6322b7dc9cf633f6d35bee Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Tue, 17 Apr 2018 12:03:07 +0100 Subject: [PATCH] Bug 20581: Add display of status_alias to staff vw - This patch adds display of the new status_alias value, when set, in favour of the request's status value. - It also allows the user to set a status_alias for an existing request. When set, this value will be displayed in preference to the status. --- ill/ill-requests.pl | 12 +++- .../prog/en/modules/ill/ill-requests.tt | 81 ++++++++++++++-------- 2 files changed, 62 insertions(+), 31 deletions(-) diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index 029fa49eea..847ffc8658 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -61,7 +61,6 @@ if ( $backends_available ) { if ( $op eq 'illview' ) { # View the details of an ILL my $request = Koha::Illrequests->find($params->{illrequest_id}); - $template->param( request => $request ); @@ -119,8 +118,11 @@ if ( $backends_available ) { value => {} }; $template->param( - whole => $backend_result, - request => $request + whole => $backend_result, + request => $request, + status_aliases => scalar Koha::AuthorisedValues->search( + { category => 'ILLSTATUS' } + ) ); } else { # Commit: @@ -130,6 +132,10 @@ if ( $backends_available ) { $request->branchcode($params->{branchcode}); $request->notesopac($params->{notesopac}); $request->notesstaff($params->{notesstaff}); + my $alias = ($params->{status_alias} =~ /\d/) ? + $params->{status_alias} : + undef; + $request->status_alias($alias); $request->store; my $backend_result = { error => 0, 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 cdaa2031ec..94de301903 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 @@ -127,33 +127,36 @@ // Render function for request status var createStatus = function(data, type, row, meta) { - var origData = meta.settings.oInit.originalData; - if (origData.length > 0) { - var status_name = meta.settings.oInit.originalData[0].capabilities[ - row.status - ].name; - switch( status_name ) { - case "New request": - return _("New request"); - case "Requested": - return _("Requested"); - case "Requested from partners": - return _("Requested from partners"); - case "Request reverted": - return _("Request reverted"); - case "Queued request": - return _("Queued request"); - case "Cancellation requested": - return _("Cancellation requested"); - case "Completed": - return _("Completed"); - case "Delete request": - return _("Delete request"); - default: - return status_name; - } + if (row.status_alias) { + return row.status_alias.authorised_value; } else { - return ''; + var origData = meta.settings.oInit.originalData; + if (origData.length > 0) { + var status_name = meta.settings.oInit.originalData[0] + .capabilities[row.status].name; + switch( status_name ) { + case "New request": + return _("New request"); + case "Requested": + return _("Requested"); + case "Requested from partners": + return _("Requested from partners"); + case "Request reverted": + return _("Request reverted"); + case "Queued request": + return _("Queued request"); + case "Cancellation requested": + return _("Cancellation requested"); + case "Completed": + return _("Completed"); + case "Delete request": + return _("Delete request"); + default: + return status_name; + } + } else { + return ''; + } } }; @@ -428,7 +431,25 @@
  • [% stat = request.status %] - [% request.capabilities.$stat.name %] + [% current_alias = request.status_alias %] +
  • @@ -526,7 +547,11 @@
    Status: - [% capabilities.$req_status.name %] + [% IF request.statusalias %] + [% request.statusalias.authorised_value %] + [% ELSE %] + [% capabilities.$req_status.name %] + [% END %]
    Last updated: -- 2.11.0