From 9577c386e98391798b6bae58af3a173c8ed32821 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 7 Dec 2018 13:20:51 -0500 Subject: [PATCH] Bug 21977: Add ability to transmit shelving location via SIP Some libraries use bin sorters that communicate via SIP2. To sort the items correctly, it is necessary for these sorters to know the shelving location code assigned to the item. For this to function correctly we need to transmit the shelving location via the item information and checkin responses. Test Plan: 1) Apply this patch 2) Restart the SIP server 3) Perform a checkin via SIP 4) Note the new SL field contains the shelving location code in the response 5) Perform an item information request 6) Note the new SL field contains the shelving location code in the response --- C4/SIP/ILS/Item.pm | 15 +++++++++++---- C4/SIP/Sip/Constants.pm | 3 +++ C4/SIP/Sip/MsgType.pm | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm index 240e1990a0..eb244760a2 100644 --- a/C4/SIP/ILS/Item.pm +++ b/C4/SIP/ILS/Item.pm @@ -81,10 +81,11 @@ sub new { return; } my $self = $item->unblessed; - $self->{ 'id' } = $item->barcode; # to SIP, the barcode IS the id. - $self->{permanent_location}= $item->homebranch; - $self->{'collection_code'} = $item->ccode; - $self->{ 'call_number' } = $item->itemcallnumber; + $self->{'id'} = $item->barcode; # to SIP, the barcode IS the id. + $self->{permanent_location} = $item->homebranch; + $self->{'collection_code'} = $item->ccode; + $self->{'call_number'} = $item->itemcallnumber; + $self->{'shelving_location'} = $item->location; my $it = $item->effective_itemtype; my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it ); @@ -380,6 +381,12 @@ sub fill_reserve { } return ModReserveFill($hold); } + +sub next_hold { + my $self = shift; + return $self->{shelving_location}; +} + 1; __END__ diff --git a/C4/SIP/Sip/Constants.pm b/C4/SIP/Sip/Constants.pm index fb48c333c6..3642802576 100644 --- a/C4/SIP/Sip/Constants.pm +++ b/C4/SIP/Sip/Constants.pm @@ -240,6 +240,9 @@ use constant { FID_ALERT_TYPE => 'CV', FID_HOLD_PATRON_ID => 'CY', FID_HOLD_PATRON_NAME => 'DA', + + # SIP Extensions by RFIDLS + FID_SHELVING_LOCATION => 'SL', }; # diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 9ec126ed12..775ea731de 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -676,6 +676,7 @@ sub handle_checkin { $resp .= maybe_add( FID_DESTINATION_LOCATION, $item->destination_loc ); $resp .= maybe_add( FID_HOLD_PATRON_ID, $item->hold_patron_bcode ); $resp .= maybe_add( FID_HOLD_PATRON_NAME, $item->hold_patron_name( $server->{account}->{da_field_template} ) ); + $resp .= maybe_add( FID_SHELVING_LOCATION, $item->shelving_location ); if ( $status->hold and $status->hold->{branchcode} ne $item->destination_loc ) { warn 'SIP hold mismatch: $status->hold->{branchcode}=' . $status->hold->{branchcode} . '; $item->destination_loc=' . $item->destination_loc; @@ -1141,6 +1142,8 @@ sub handle_item_information { $resp .= maybe_add( FID_CURRENT_LOCN, $item->current_location ); $resp .= maybe_add( FID_ITEM_PROPS, $item->sip_item_properties ); + $resp .= maybe_add( FID_SHELVING_LOCATION, $item->shelving_location ); + if ( ( $i = $item->fee ) != 0 ) { $resp .= add_field( FID_CURRENCY, $item->fee_currency ); $resp .= add_field( FID_FEE_AMT, $i ); -- 2.17.2 (Apple Git-113)