Bug 14697: Add return claim handling to AddReturn
This adds the ability to alert a librarian of an item claimed as returned is actually returned. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
e89c5bfed6
commit
e97887bcbb
2 changed files with 40 additions and 1 deletions
|
@ -60,6 +60,7 @@ use Koha::Account::Offsets;
|
|||
use Koha::Config::SysPrefs;
|
||||
use Koha::Charges::Fees;
|
||||
use Koha::Util::SystemPreferences;
|
||||
use Koha::Checkouts::ReturnClaims;
|
||||
use Carp;
|
||||
use List::MoreUtils qw( uniq any );
|
||||
use Scalar::Util qw( looks_like_number );
|
||||
|
@ -2127,6 +2128,19 @@ sub AddReturn {
|
|||
}
|
||||
}
|
||||
|
||||
if ( C4::Context->preference('ClaimReturnedLostValue') ) {
|
||||
my $claims = Koha::Checkouts::ReturnClaims->search(
|
||||
{
|
||||
itemnumber => $item->id,
|
||||
resolution => undef,
|
||||
}
|
||||
);
|
||||
|
||||
if ( $claims->count ) {
|
||||
$messages->{ReturnClaims} = $claims;
|
||||
}
|
||||
}
|
||||
|
||||
return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 5;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
|
||||
|
@ -339,4 +339,29 @@ subtest 'BlockReturnOfLostItems' => sub {
|
|||
is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");
|
||||
};
|
||||
|
||||
subtest 'Checkin of an item claimed as returned should generate a message' => sub {
|
||||
plan tests => 1;
|
||||
|
||||
t::lib::Mocks::mock_preference('ClaimReturnedLostValue', 1);
|
||||
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
|
||||
my $item = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Items',
|
||||
value => {
|
||||
biblionumber => $biblio->biblionumber,
|
||||
notforloan => 0,
|
||||
itemlost => 0,
|
||||
withdrawn => 0,
|
||||
}
|
||||
}
|
||||
);
|
||||
my $patron = $builder->build_object({class => 'Koha::Patrons'});
|
||||
my $checkout = AddIssue( $patron->unblessed, $item->barcode );
|
||||
|
||||
$checkout->claim_returned({ created_by => $patron->id });
|
||||
|
||||
my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
|
||||
ok( $messages->{ReturnClaims}, "ReturnClaims is in messages for return of a claimed as returned itm" );
|
||||
};
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
Loading…
Reference in a new issue