From 5788a0f2626a715a4d9c245685b335b4038b3e32 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 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- 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 97ad633e31..d8c49cddcf 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 b2a32d49c5..594ea46fa7 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -81,6 +81,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 e4741d84fe..aa0a811ce2 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -1126,7 +1126,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' } ); @@ -1185,6 +1185,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.39.5