Bug 20487: AddReturn should clear items.onloan for unissued items
If an item is no longer issued but somehow still has a date in the onloan
column, checking it in should clear that date.
Adding a ModItem call in the NotIssued section.
Test plan:
[1] Run t/db_dependent/Circulation.t
[2] Bonus: Checkout item, delete issue from table, checkin. Verify that
items.onloan has been cleared.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit a744a3e202)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
32b01b2642
commit
1ed846bf5b
|
|
@ -1817,6 +1817,7 @@ sub AddReturn {
|
|||
. Dumper($issue->unblessed) . "\n";
|
||||
} else {
|
||||
$messages->{'NotIssued'} = $barcode;
|
||||
ModItem({ onloan => undef }, $item->{biblionumber}, $item->{itemnumber}) if defined $item->{onloan};
|
||||
# even though item is not on loan, it may still be transferred; therefore, get current branch info
|
||||
$doreturn = 0;
|
||||
# No issue, no borrowernumber. ONLY if $doreturn, *might* you have a $borrower later.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 118;
|
||||
use Test::More tests => 119;
|
||||
|
||||
use Data::Dumper;
|
||||
use DateTime;
|
||||
|
|
@ -2359,6 +2359,16 @@ subtest 'CanBookBeIssued | notforloan' => sub {
|
|||
# TODO test with AllowNotForLoanOverride = 1
|
||||
};
|
||||
|
||||
subtest 'AddReturn should clear items.onloan for unissued items' => sub {
|
||||
plan tests => 1;
|
||||
|
||||
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' );
|
||||
};
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
$cache->clear_from_cache('single_holidays');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue