View | Details | Raw Unified | Return to bug 20487
Collapse All | Expand All

(-)a/C4/Circulation.pm (+1 lines)
Lines 1817-1822 sub AddReturn { Link Here
1817
                . Dumper($issue->unblessed) . "\n";
1817
                . Dumper($issue->unblessed) . "\n";
1818
    } else {
1818
    } else {
1819
        $messages->{'NotIssued'} = $barcode;
1819
        $messages->{'NotIssued'} = $barcode;
1820
        ModItem({ onloan => undef }, $item->{biblionumber}, $item->{itemnumber}) if defined $item->{onloan};
1820
        # even though item is not on loan, it may still be transferred;  therefore, get current branch info
1821
        # even though item is not on loan, it may still be transferred;  therefore, get current branch info
1821
        $doreturn = 0;
1822
        $doreturn = 0;
1822
        # No issue, no borrowernumber.  ONLY if $doreturn, *might* you have a $borrower later.
1823
        # No issue, no borrowernumber.  ONLY if $doreturn, *might* you have a $borrower later.
(-)a/t/db_dependent/Circulation.t (-2 / +11 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 118;
20
use Test::More tests => 119;
21
21
22
use DateTime;
22
use DateTime;
23
use POSIX qw( floor );
23
use POSIX qw( floor );
Lines 2348-2353 subtest 'CanBookBeIssued | notforloan' => sub { Link Here
2348
    # TODO test with AllowNotForLoanOverride = 1
2348
    # TODO test with AllowNotForLoanOverride = 1
2349
};
2349
};
2350
2350
2351
subtest 'AddReturn should clear items.onloan for unissued items' => sub {
2352
    plan tests => 1;
2353
2354
    t::lib::Mocks::mock_preference( "AllowReturnToBranch", 'anywhere' );
2355
    my $item = $builder->build_object({ class => 'Koha::Items', value  => { onloan => '2018-01-01' }});
2356
    AddReturn( $item->barcode, $item->homebranch );
2357
    $item->discard_changes; # refresh
2358
    is( $item->onloan, undef, 'AddReturn did clear items.onloan' );
2359
};
2360
2351
$schema->storage->txn_rollback;
2361
$schema->storage->txn_rollback;
2352
$cache->clear_from_cache('single_holidays');
2362
$cache->clear_from_cache('single_holidays');
2353
2363
2354
- 

Return to bug 20487