From 581a822762ce9d07aeb5ae36c3800816429dc372 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Mon, 27 Jan 2020 03:41:17 +0100 Subject: [PATCH] Bug 12469: Moved callnumber to a specific XML node in reply --- C4/ILSDI/Services.pm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 7c09268e0f..958885adcc 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -121,7 +121,7 @@ sub GetAvailability { foreach my $id ( split( / /, $cgi->param('id') ) ) { if ( $cgi->param('id_type') eq "item" ) { - my ( $biblionumber, $status, $msg, $location ) = _availability($id); + my ( $biblionumber, $status, $msg, $location, $callnum, $duedate ) = _availability($id); $out .= " \n"; $out .= " \n"; $out .= " \n"; @@ -131,6 +131,7 @@ sub GetAvailability { $out .= " " . $status . "\n"; if ($msg) { $out .= " " . $msg . "\n"; } if ($location) { $out .= " " . $location . "\n"; } + if ($callnum) { $out .= " " . $callnum . "\n"; } if ($duedate) { $out .= " " . $duedate . "\n"; } $out .= " \n"; $out .= " \n"; @@ -148,13 +149,15 @@ sub GetAvailability { # We loop over the items to clean them while ( my $item = $items->next ) { my $itemnumber = $item->itemnumber; - my ( $biblionumber, $status, $msg, $location ) = _availability($itemnumber); + my ( $biblionumber, $status, $msg, $location, $callnum, $duedate ) = _availability($itemnumber); $out .= " \n"; $out .= " \n"; $out .= " " . $itemnumber . "\n"; $out .= " " . $status . "\n"; if ($msg) { $out .= " " . $msg . "\n"; } if ($location) { $out .= " " . $location . "\n"; } + if ($callnum) { $out .= " " . $callnum . "\n"; } + if ($duedate) { $out .= " " . $duedate . "\n"; } $out .= " \n"; $out .= " \n"; } @@ -860,7 +863,7 @@ sub CancelHold { Returns, for an itemnumber, an array containing availability information. - my ($biblionumber, $status, $msg, $location) = _availability($id); + my ($biblionumber, $status, $msg, $location, $callnumber, duedate) = _availability($id); =cut @@ -872,27 +875,26 @@ sub _availability { return ( undef, 'unknown', 'Error: could not retrieve availability for this ID', undef ); } - my $biblionumber = $item->biblioitemnumber; my $library = Koha::Libraries->find( $item->holdingbranch ); my $location = $library ? $library->branchname : ''; - $location .= ", Call # $item->{itemcallnumber}" if $item->{itemcallnumber}; + my $callnumber = $item->itemcallnumber; if ( $item->notforloan ) { - return ( $biblionumber, 'not available', 'Not for loan', $location ); + return ( $biblionumber, 'not available', 'Not for loan', $location, $callnumber ); } elsif ( $item->{'onloan'} ) { return ( $biblionumber, 'not available', 'Checked out', - $location, $item->{'onloan'} + $location, $item->itemcallnumber, $item->{'onloan'} ); } elsif ( $item->{'itemlost'} ) { - return ( $biblionumber, 'not available', 'Item lost', $location ); + return ( $biblionumber, 'not available', 'Item lost', $location, $callnumber ); } elsif ( $item->withdrawn ) { - return ( $biblionumber, 'not available', 'Item withdrawn', $location ); + return ( $biblionumber, 'not available', 'Item withdrawn', $location, $callnumber ); } elsif ( $item->damaged ) { - return ( $biblionumber, 'not available', 'Item damaged', $location ); + return ( $biblionumber, 'not available', 'Item damaged', $location, $callnumber ); } else { - return ( $biblionumber, 'available', undef, $location ); + return ( $biblionumber, 'available', undef, $location, $callnumber, Koha::DateUtils::dt_from_string( DateTime->now )); } } -- 2.20.1