Bugzilla – Attachment 82166 Details for
Bug 20563
ILL request list gives no indication of source and/or target
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20563: Allow display of requested partners
Bug-20563-Allow-display-of-requested-partners.patch (text/plain), 8.59 KB, created by
Andrew Isherwood
on 2018-11-09 14:06:21 UTC
(
hide
)
Description:
Bug 20563: Allow display of requested partners
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2018-11-09 14:06:21 UTC
Size:
8.59 KB
patch
obsolete
>From feda64dc8c2fc92fae89e22d99df3249548970f6 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Fri, 13 Apr 2018 09:22:26 +0100 >Subject: [PATCH] Bug 20563: Allow display of requested partners > >This patch adds the display of requested partner email addresses when an >ILL backend provides the ability to send requests to partners. Partner >email addresses are displayed in the illlist and illview displays, they >are also included in the 'illrequests' API response. > >* api/v1/swagger/paths/illrequests.json: > - Add 'requested_partners' as an 'embed' enum >* Koha/Illrequest.pm: > - Add 'requested_partners' accessor calling optional backend 'get_requested_partners' method. > - Store requested partners upon email send, calling optional backend 'set_requested_partners' method. > - Add 'requested_parners' embed to overloaded TO_JSON method. >* koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt: > - Add 'requested_partners' embed to illrequests API call > - Add render function for "Additional status" datatables column > - Add display of requested partner email addresses to illlist table > - Add display of requested partner email addresses to illview display > >To test: >1) Enable Interlibrary loans >2) Add a backend that supports sending requests to partners, e.g. >FreeForm >3) Set up at least one partner >4) Create an ILL request >5) Send request to partner(s) >6) Observe partner(s) email address(es) are displayed in "View ILL >requests" view >7) Observe partner(s) email address(es) are displayed in "Manage ILL >request" view > >Signed-off-by: mmg@interleaf.ie > >https://bugs.koha-community.org/show_bug.cgi?id=20653 > >Bug 20563: (follow-up) Fix requested partners > >As per: >https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20563#c10 > >Thanks for the suggestion on merging the "Status" and "Additional status" columns, looks much better! >--- > Koha/Illrequest.pm | 27 +++++++++++++++++++++- > Koha/REST/V1/Illrequests.pm | 3 +++ > api/v1/swagger/paths/illrequests.json | 3 ++- > ill/ill-requests.pl | 4 ++-- > .../prog/en/modules/ill/ill-requests.tt | 22 ++++++++++++++---- > 5 files changed, 50 insertions(+), 9 deletions(-) > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index 9aeebe972d..9a7b182bcf 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -1,6 +1,6 @@ > package Koha::Illrequest; > >-# Copyright PTFS Europe 2016 >+# Copyright PTFS Europe 2016,2018 > # > # This file is part of Koha. > # >@@ -1042,6 +1042,13 @@ EOF > my $result = sendmail(%mail); > if ( $result ) { > $self->status("GENREQ")->store; >+ $self->_backend_capability( >+ 'set_requested_partners', >+ { >+ request => $self, >+ to => $to >+ } >+ ); > return { > error => 0, > status => '', >@@ -1125,6 +1132,23 @@ sub store { > return $ret; > } > >+=head3 requested_partners >+ >+ my $partners_string = $illRequest->requested_partners; >+ >+Return the string representing the email addresses of the partners to >+whom a request has been sent >+ >+=cut >+ >+sub requested_partners { >+ my ( $self ) = @_; >+ return $self->_backend_capability( >+ 'get_requested_partners', >+ { request => $self } >+ ); >+} >+ > =head3 TO_JSON > > $json = $illrequest->TO_JSON >@@ -1160,6 +1184,7 @@ sub _type { > =head1 AUTHOR > > Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com> >+Andrew Isherwood <andrew.isherwood@ptfs-europe.com> > > =cut > >diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm >index c93368886c..2a856e0616 100644 >--- a/Koha/REST/V1/Illrequests.pm >+++ b/Koha/REST/V1/Illrequests.pm >@@ -160,6 +160,9 @@ sub list { > if ($embed{status_alias}) { > $to_push->{status_alias} = $req->statusalias; > } >+ if ($embed{requested_partners}) { >+ $to_push->{requested_partners} = $req->requested_partners; >+ } > push @output, $to_push; > } > >diff --git a/api/v1/swagger/paths/illrequests.json b/api/v1/swagger/paths/illrequests.json >index 81093a1d84..4389cea894 100644 >--- a/api/v1/swagger/paths/illrequests.json >+++ b/api/v1/swagger/paths/illrequests.json >@@ -18,7 +18,8 @@ > "patron", > "library", > "capabilities", >- "metadata" >+ "metadata", >+ "requested_partners" > ] > } > }, { >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index 6053813c4d..c556adfeee 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -251,10 +251,10 @@ if ( $backends_available ) { > } > catch { > my $error; >- if ( $_->isa( 'Koha::Exceptions::Ill::NoTargetEmail' ) ) { >+ if ( ref($_) eq 'Koha::Exceptions::Ill::NoTargetEmail' ) { > $error = 'no_target_email'; > } >- elsif ( $_->isa( 'Koha::Exceptions::Ill::NoLibraryEmail' ) ) { >+ elsif ( ref($_) eq 'Koha::Exceptions::Ill::NoLibraryEmail' ) { > $error = 'no_library_email'; > } > else { >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 fcb7bddf29..3a7b05ca45 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 >@@ -353,6 +353,9 @@ > [% request.statusalias.lib | html %] > [% ELSE %] > [% request.capabilities.$req_status.name | html%] >+ [% IF request.requested_partners.length > 0 %] >+ ([% request.requested_partners | html %]) >+ [% END %] > [% END %] > </div> > <div class="updated"> >@@ -580,7 +583,8 @@ > var uniques = {}; > tableData.forEach(function(row) { > var resolvedName = getStatusName( >- oData[0].capabilities[row.status].name >+ oData[0].capabilities[row.status].name, >+ row > ); > uniques[resolvedName] = 1 > }); >@@ -761,21 +765,29 @@ > var status_name = meta.settings.oInit.originalData[0].capabilities[ > row.status > ].name; >- return getStatusName(status_name); >+ return getStatusName(status_name, row); > } else { > return ''; > } > } > }; > >- var getStatusName = function(origName) { >+ var getStatusName = function(origName, row) { > switch( origName ) { > case "New request": > return _("New request"); > case "Requested": > return _("Requested"); > case "Requested from partners": >- return _("Requested from partners"); >+ var statStr = _("Requested from partners"); >+ if ( >+ row.hasOwnProperty('requested_partners') && >+ row.requested_partners && >+ row.requested_partners.length > 0 >+ ) { >+ statStr += ' (' + row.requested_partners + ')'; >+ } >+ return statStr; > case "Request reverted": > return _("Request reverted"); > case "Queued request": >@@ -873,7 +885,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,status_alias' >+ '/api/v1/illrequests?embed=metadata,patron,capabilities,library,comments,status_alias,requested_partners' > ).done(function() { > var data = JSON.parse(ajax.responseText); > // Make a copy, we'll be removing columns next and need >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20563
:
74152
|
74153
|
75657
|
79523
|
79715
|
79716
|
80603
|
82166
|
82167
|
82511
|
82512
|
82734
|
84695
|
84696
|
84697
|
84698
|
86376
|
86377
|
86378
|
86427
|
86428
|
86429
|
86430
|
86431