Bugzilla – Attachment 69332 Details for
Bug 19640
IdRef webservice display is broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19640: fix OPAC IdRef webservice display
Bug-19640-fix-OPAC-IdRef-webservice-display.patch (text/plain), 4.02 KB, created by
Marcel de Rooy
on 2017-11-24 09:30:36 UTC
(
hide
)
Description:
Bug 19640: fix OPAC IdRef webservice display
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-11-24 09:30:36 UTC
Size:
4.02 KB
patch
obsolete
>From 4811141456fcea477288d1177e559167d8584dee Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Thu, 16 Nov 2017 15:22:48 +0100 >Subject: [PATCH] Bug 19640: fix OPAC IdRef webservice display >Content-Type: text/plain; charset=utf-8 > >The OPAC webservice IdRef display was broken. >The call returns results but citations where empty. >Maybe the webservice has changed. > >This patch corrects the fetch of datas in result. >Also fixes a small HTML missing tag tr. >Also adds a comment with link to official doc : >http://documentation.abes.fr/aideidrefdeveloppeur/index.html#MicroWebBiblio > >Test plan : >1) Enable system preference IdRef >2) Choose an existing PPN like 032581270 >3) Look result on : https://www.idref.fr/services/biblio/032581270.json >4) Call in OPAC website : /cgi-bin/koha/opac-idref.pl?unimarc3=032581270 >5) Without patch you see only one role containing empty rows >6) With patch you see all roles with correct rows > >Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Amended: removed unused @unimarc3 (not to be confused with $unimarc3). >--- > .../opac-tmpl/bootstrap/en/modules/opac-idref.tt | 8 ++-- > opac/opac-idref.pl | 43 +++++++++------------- > 2 files changed, 22 insertions(+), 29 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt >index 4db0d1a..3d0d695 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt >@@ -27,9 +27,11 @@ > <div class="docs"> > <table> > <thead> >- <th>Citation</th> >- <th>Koha</th> >- <th>Sudoc</th> >+ <tr> >+ <th>Citation</th> >+ <th>Koha</th> >+ <th>Sudoc</th> >+ </tr> > </thead> > <tbody> > [% FOREACH doc IN role.docs %] >diff --git a/opac/opac-idref.pl b/opac/opac-idref.pl >index 43692dd..ffd5505 100755 >--- a/opac/opac-idref.pl >+++ b/opac/opac-idref.pl >@@ -42,6 +42,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > > my $ua = LWP::UserAgent->new; > >+# See http://documentation.abes.fr/aideidrefdeveloppeur/index.html#MicroWebBiblio > my $base = 'http://www.idref.fr/services/biblio/'; > my $unimarc3 = $cgi->param('unimarc3'); > >@@ -60,36 +61,26 @@ if ( not $response->is_success) { > my $content = Encode::decode("utf8", $response->content); > my $json = from_json( $content ); > my $r; >-my $role_name; >-my @unimarc3; > my @results = ref $json->{sudoc}{result} eq "ARRAY" > ? @{ $json->{sudoc}{result} } > : ($json->{sudoc}{result}); > >-for my $role_node ( @results ) { >- while ( my ( $k, $v ) = each %$role_node ) { >- next unless $k eq "role"; >- my $role_name; >- my $count = 0; >- my $role_data = {}; >- my @nodes = ref $v eq "ARRAY" >- ? @$v >- : ($v); >- for my $node ( @nodes ) { >- while ( ( $k, $v ) = each %$node ) { >- if ( $k eq 'roleName' ) { >- $role_name = $v; >- $role_data->{role_name} = $role_name; >- } >- elsif ( $k eq 'count' ) { >- $role_data->{count} = $v; >- } >- elsif ( $k eq 'doc' ) { >- push @{ $role_data->{docs} }, $v; >- } >- } >- } >- push @$r, $role_data; >+for my $result (@results) { >+ my $role_node = $result->{'role'}; >+ my @roles = >+ ref $role_node eq "ARRAY" >+ ? @$role_node >+ : ($role_node); >+ for my $role (@roles) { >+ my @docs = ref $role->{doc} eq "ARRAY" >+ ? @{ $role->{doc} } >+ : $role->{doc}; >+ push @$r, >+ { >+ role_name => $role->{roleName}, >+ count => $role->{count}, >+ docs => \@docs, >+ }; > } > } > >-- >2.1.4
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 19640
:
69181
|
69182
|
69196
| 69332