From 36222fb735eb4db9fe8309e4db21d34d5aa63e7b Mon Sep 17 00:00:00 2001 From: Lyon3 Team Date: Tue, 20 Sep 2016 12:13:23 +0200 Subject: [PATCH] Bug 17317: ILSDI: Getavailability method with id_type=bib implementation To test this patch you should try to send a query to you opac formatted this way : http://[your-opac-domain-name]/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=[biblionumber]&id_type=bib You should get availability status for all the items of the matched bibliographic record. Signed-off-by: Hector Castro Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- 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 e8ae7c0212..03f60853a4 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -136,19 +136,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 .= " \n"; + $out .= " \n"; + $out .= " \n"; + $out .= " \n"; + $out .= " \n"; + $out .= " " . $itemnumber . "\n"; + $out .= " " . $status . "\n"; + if ($msg) { $out .= " " . $msg . "\n"; } + if ($location) { $out .= " " . $location . "\n"; } + $out .= " \n"; + $out .= " \n"; + $out .= " \n"; + $out .= " \n"; + } } else { $status = "unknown"; $msg = "Error: could not retrieve availability for this ID"; } - $out .= " \n"; - $out .= " \n"; - $out .= " \n"; - $out .= " " . $id . "\n"; - $out .= " " . $status . "\n"; - $out .= " " . $msg . "\n"; - $out .= " \n"; - $out .= " \n"; } } $out .= "\n"; -- 2.39.5