$messages->{'WasReturned'} = 1;
}
ModItem({ onloan => undef }, $item->{biblionumber}, $item->{'itemnumber'});
# Clear items.onloan when needed
ModItem({ onloan => undef }, $item->{biblionumber}, $item->{itemnumber}) if defined $item->{onloan};
# the holdingbranch is updated if the document is returned to another location.
# this is always done regardless of whether the item was on loan or not
use Modern::Perl;
use Test::More tests => 113;
use Test::More tests => 114;
use DateTime;
};
subtest 'AddReturn should always clear items.onloan' => sub {
plan tests => 1;
# Tested by returning an item that has not been issued
t::lib::Mocks::mock_preference( "AllowReturnToBranch", 'anywhere' );
my $item = $builder->build_object({ class => 'Koha::Items', value => { onloan => '2018-01-01' }});
AddReturn( $item->barcode, $item->homebranch );
$item->discard_changes; # refresh
is( $item->onloan, undef, 'AddReturn did clear items.onloan' );
sub set_userenv {
my ( $library ) = @_;
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', '');
-