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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Kyle M Hall 2020-05-01 12:16:48 -04:00 committed by Jonathan Druart
parent be719f30e4
commit ca44a3f2ca
2 changed files with 25 additions and 7 deletions

View File

@ -16,20 +16,21 @@ use Template;
use C4::SIP::ILS::Transaction;
use C4::SIP::Sip qw(add_field);
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
@ -261,6 +262,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->{borrowernumber} ) {
return '04'; # charged
}

View File

@ -399,7 +399,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' } );
@ -436,5 +436,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;