From 1d01c2a57540850d2740e800ba1b1be4d03b2487 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 c949d3056d3..abd64fc216d 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 97ad633e318..d8c49cddcff 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -1244,7 +1244,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 c696c8376e8..cdefb3f02df 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -80,6 +80,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 30ddfc182c8..6bc02a62879 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -1057,7 +1057,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' } ); @@ -1116,6 +1116,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