From 03bfa865d2f70a2af171004ab70511ec2f42b435 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 Works as advertised --- 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 72bbbb7..279eec2 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"; -- 1.7.10.4