From 5558994443a6ce19194c5fb3f4d9a8a6e0bfafbe Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 21 Sep 2023 11:44:49 -0400 Subject: [PATCH] Bug 34868: Add ability for SIP2 to distinguish missing item from other lost types The SIP circulation status specifies that a 12 means an item is lost, and 13 means an item is missing. In Koha, missing items are simply a type of lost item so we never send a 13. This is an important distinction for some SIP based inventory tools. It would be good to be able to specify when lost status means "missing" at the SIP login level. Test Plan: 1) Apply this patch 2) prove t/db_dependent/SIP/Transaction.t Signed-off-by: David Nind --- C4/SIP/ILS/Item.pm | 7 +++++++ C4/SIP/Sip/MsgType.pm | 2 +- etc/SIPconfig.xml | 1 + t/db_dependent/SIP/Transaction.t | 4 +++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm index c949d3056d..abd64fc216 100644 --- a/C4/SIP/ILS/Item.pm +++ b/C4/SIP/ILS/Item.pm @@ -262,12 +262,19 @@ sub title_id { sub sip_circulation_status { my $self = shift; + my $server = shift; + + my $missing_status = $server->{account}->{missing_lost_status}; + if ( $self->{_object}->get_transfer ) { return '10'; # in transit between libraries } elsif ( Koha::Checkouts::ReturnClaims->search({ itemnumber => $self->{_object}->id, resolution => undef })->count ) { return '11'; # claimed returned } + elsif ( $missing_status && $self->{itemlost} && $missing_status eq $self->{itemlost} ) { + return '13'; # missing + } elsif ( $self->{itemlost} ) { return '12'; # lost } diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index e29d390da8..7c09b161a3 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -1240,7 +1240,7 @@ sub handle_item_information { ModDateLastSeen( $item->itemnumber, $seen eq 'keep_lost' ) if $seen; # Valid Item ID, send the good stuff - my $circulation_status = $item->sip_circulation_status; + my $circulation_status = $item->sip_circulation_status($server); $resp .= $circulation_status; $resp .= $item->sip_security_marker; $resp .= $item->sip_fee_type; diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml index 5264c2674c..b9d4ffd152 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -78,6 +78,7 @@ format_due_date="0" inhouse_item_types="" inhouse_patron_categories="" + missing_lost_status="4" blocked_item_types="VM|MU" seen_on_item_information="mark_found"> diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index 232e6456a5..f4791becb4 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -964,7 +964,7 @@ RULES }; subtest item_circulation_status => sub { - plan tests => 7; + plan tests => 8; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); @@ -1020,6 +1020,8 @@ subtest item_circulation_status => sub { $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); $status = $sip_item->sip_circulation_status; is( $status, '12', "Item circulation status is lost" ); + $status = $sip_item->sip_circulation_status( { account => { missing_lost_status => "1" } } ); + is( $status, '13', "Item circulation status is missing" ); $item->itemlost(0)->store(); my $location = $item->location; -- 2.30.2