From 81de099530935e4e53ae80e0421941d5821a69e8 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Tue, 17 Apr 2018 12:00:15 +0100 Subject: [PATCH] Bug 20581: API provide status_alias embed - This patch provides the illrequests API route with an additional embed, called 'status_alias'. Requesting this embed returns an object for the request's status_alias authorised value, or null if one is not set. - This patch also adds the new status_alias as a default embed on the API call made by the illlist view Signed-off-by: Niamh.Walker-Headon@it-tallaght.ie --- Koha/REST/V1/Illrequests.pm | 3 +++ api/v1/swagger/paths/illrequests.json | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm index a1cb0772b4..414a12bd39 100644 --- a/Koha/REST/V1/Illrequests.pm +++ b/Koha/REST/V1/Illrequests.pm @@ -156,6 +156,9 @@ sub list { if ($embed{comments}) { $to_push->{comments} = $req->illcomments->count; } + if ($embed{status_alias}) { + $to_push->{status_alias} = $req->statusalias; + } push @output, $to_push; } diff --git a/api/v1/swagger/paths/illrequests.json b/api/v1/swagger/paths/illrequests.json index 3087caf3bf..81093a1d84 100644 --- a/api/v1/swagger/paths/illrequests.json +++ b/api/v1/swagger/paths/illrequests.json @@ -14,6 +14,7 @@ "items": { "type": "string", "enum": [ + "status_alias", "patron", "library", "capabilities", 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 f035245caf..5ec7849764 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 @@ -827,7 +827,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,comments' + '/api/v1/illrequests?embed=metadata,patron,capabilities,library,comments,status_alias' ).done(function() { var data = JSON.parse(ajax.responseText); // Make a copy, we'll be removing columns next and need -- 2.11.0