Bugzilla – Attachment 55956 Details for
Bug 17317
Adding "bib" type to GetAvailability method for ILSDI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Performance Improvement
file_17317.txt (text/plain), 5.51 KB, created by
Arthur Suzuki
on 2016-09-30 13:07:28 UTC
(
hide
)
Description:
Performance Improvement
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2016-09-30 13:07:28 UTC
Size:
5.51 KB
patch
obsolete
>From 23ee00353a67ad205f3f4e9105abd2f570ac427b Mon Sep 17 00:00:00 2001 >From: Lyon3 Team <koha@univ-lyon3.fr> >Date: Tue, 20 Sep 2016 12:13:23 +0200 >Subject: [PATCH 1/2] Bug 17317 ILSDI - Getavailability method with id_type=bib > implementation > >--- > C4/ILSDI/Services.pm | 31 ++++++++++++++++++++++--------- > 1 file changed, 22 insertions(+), 9 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index ccf283d..77646eb 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -134,19 +134,32 @@ sub GetAvailability { > my $msg; > my $biblioitem = ( GetBiblioItemByBiblioNumber( $id, undef ) )[0]; > if ($biblioitem) { >- >+ my $biblioitemnumber = $biblioitem->{'biblioitemnumber'}; >+ my $items = (GetItemsByBiblioitemnumber($biblioitemnumber))[0]; >+ >+ # We loop over the items to clean them >+ my $itemnumber; >+ foreach my $item (@$items) { >+ $itemnumber=$item->{'itemnumber'}; >+ my ( $biblionumber, $status, $msg, $location ) = _availability($itemnumber); >+ $out .= " <dlf:record>\n"; >+ $out .= " <dlf:bibliographic id=\"" . ( $biblionumber || $itemnumber ) . "\" />\n"; >+ $out .= " <dlf:items>\n"; >+ $out .= " <dlf:item id=\"" . $itemnumber . "\">\n"; >+ $out .= " <dlf:simpleavailability>\n"; >+ $out .= " <dlf:identifier>" . $itemnumber . "</dlf:identifier>\n"; >+ $out .= " <dlf:availabilitystatus>" . $status . "</dlf:availabilitystatus>\n"; >+ if ($msg) { $out .= " <dlf:availabilitymsg>" . $msg . "</dlf:availabilitymsg>\n"; } >+ if ($location) { $out .= " <dlf:location>" . $location . "</dlf:location>\n"; } >+ $out .= " </dlf:simpleavailability>\n"; >+ $out .= " </dlf:item>\n"; >+ $out .= " </dlf:items>\n"; >+ $out .= " </dlf:record>\n"; >+ } > } else { > $status = "unknown"; > $msg = "Error: could not retrieve availability for this ID"; > } >- $out .= " <dlf:record>\n"; >- $out .= " <dlf:bibliographic id=\"" . $id . "\" />\n"; >- $out .= " <dlf:simpleavailability>\n"; >- $out .= " <dlf:identifier>" . $id . "</dlf:identifier>\n"; >- $out .= " <dlf:availabilitystatus>" . $status . "</dlf:availabilitystatus>\n"; >- $out .= " <dlf:availabilitymsg>" . $msg . "</dlf:availabilitymsg>\n"; >- $out .= " </dlf:simpleavailability>\n"; >- $out .= " </dlf:record>\n"; > } > } > $out .= "</dlf:collection>\n"; >-- >2.1.4 > >From c1dafa4a6403561541a6861bd4d257a336944e17 Mon Sep 17 00:00:00 2001 >From: root <root@v-kohaly3b2.univ-lyon3.fr> >Date: Fri, 30 Sep 2016 14:50:16 +0200 >Subject: [PATCH 2/2] Perfomance Improvement: > >- Use of GetItemnumbersForBiblio instead of GetItemsByBiblioitemnumber (thx Jonathan Druart) >--- > C4/ILSDI/Services.pm | 23 ++++++++++------------- > 1 file changed, 10 insertions(+), 13 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index 77646eb..e2dce95 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -132,19 +132,15 @@ sub GetAvailability { > } else { > my $status; > my $msg; >- my $biblioitem = ( GetBiblioItemByBiblioNumber( $id, undef ) )[0]; >- if ($biblioitem) { >- my $biblioitemnumber = $biblioitem->{'biblioitemnumber'}; >- my $items = (GetItemsByBiblioitemnumber($biblioitemnumber))[0]; >- >+ my $items = GetItemnumbersForBiblio($id); >+ if ($items) { >+ # Open XML >+ $out .= " <dlf:record>\n"; >+ $out .= " <dlf:bibliographic id=\"" .$id. "\" />\n"; >+ $out .= " <dlf:items>\n"; > # We loop over the items to clean them >- my $itemnumber; >- foreach my $item (@$items) { >- $itemnumber=$item->{'itemnumber'}; >+ foreach my $itemnumber (@$items) { > my ( $biblionumber, $status, $msg, $location ) = _availability($itemnumber); >- $out .= " <dlf:record>\n"; >- $out .= " <dlf:bibliographic id=\"" . ( $biblionumber || $itemnumber ) . "\" />\n"; >- $out .= " <dlf:items>\n"; > $out .= " <dlf:item id=\"" . $itemnumber . "\">\n"; > $out .= " <dlf:simpleavailability>\n"; > $out .= " <dlf:identifier>" . $itemnumber . "</dlf:identifier>\n"; >@@ -153,9 +149,10 @@ sub GetAvailability { > if ($location) { $out .= " <dlf:location>" . $location . "</dlf:location>\n"; } > $out .= " </dlf:simpleavailability>\n"; > $out .= " </dlf:item>\n"; >- $out .= " </dlf:items>\n"; >- $out .= " </dlf:record>\n"; > } >+ # Close XML >+ $out .= " </dlf:items>\n"; >+ $out .= " </dlf:record>\n"; > } else { > $status = "unknown"; > $msg = "Error: could not retrieve availability for this ID"; >-- >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 17317
:
55685
|
55714
|
55775
|
55956
|
55970
|
55971
|
55981
|
55982
|
58180
|
58287
|
58288
|
58469