From 6ca63e704c4c900fe886ee3559e46db8049792ee Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 1 May 2020 12:16:48 -0400 Subject: [PATCH] Bug 25347: Add support for circulation status 11 ( claimed returned ) Now that we have return claims in Koha, we should support the SIP2 "circulation status" value 11, "claimed returned". Test Plan: 1) Apply this patch 2) prove t/db_dependent/SIP/Transaction.t --- C4/SIP/ILS/Item.pm | 16 ++++++++++------ t/db_dependent/SIP/Transaction.t | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm index 13440ad702..7dd774413a 100644 --- a/C4/SIP/ILS/Item.pm +++ b/C4/SIP/ILS/Item.pm @@ -15,20 +15,21 @@ use Template; use C4::SIP::ILS::Transaction; -use C4::Debug; -use C4::Context; use C4::Biblio; -use C4::Items; use C4::Circulation; +use C4::Context; +use C4::Debug; +use C4::Items; use C4::Members; use C4::Reserves; -use Koha::Database; use Koha::Biblios; +use Koha::Checkouts::ReturnClaims; use Koha::Checkouts; +use Koha::Database; use Koha::DateUtils; -use Koha::Patrons; -use Koha::Items; use Koha::Holds; +use Koha::Items; +use Koha::Patrons; =encoding UTF-8 @@ -258,6 +259,9 @@ sub sip_circulation_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 ( $self->{patron} ) { return '04'; # charged } diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index f56777400a..7dcc8499c6 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -397,7 +397,7 @@ subtest checkin_withdrawn => sub { }; subtest item_circulation_status => sub { - plan tests => 2; + plan tests => 3; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); @@ -434,5 +434,19 @@ subtest item_circulation_status => sub { $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); $status = $sip_item->sip_circulation_status; is( $status, '10', "Item circulation status is in transit" ); + + $transfer->delete; + + my $claim = Koha::Checkouts::ReturnClaim->new({ + itemnumber => $item->id, + borrowernumber => $patron->id, + created_by => $patron->id, + })->store(); + + $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); + $status = $sip_item->sip_circulation_status; + is( $status, '11', "Item circulation status is claimed returned" ); + + $claim->delete; }; $schema->storage->txn_rollback; -- 2.24.2 (Apple Git-127)