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

(-)a/C4/Circulation.pm (-2 / +2 lines)
Lines 1919-1927 sub AddReturn { Link Here
1919
            $messages->{'WasReturned'} = 1;
1919
            $messages->{'WasReturned'} = 1;
1920
1920
1921
        }
1921
        }
1922
1923
        ModItem({ onloan => undef }, $item->{biblionumber}, $item->{'itemnumber'});
1924
    }
1922
    }
1923
    # Clear items.onloan when needed
1924
    ModItem({ onloan => undef }, $item->{biblionumber}, $item->{itemnumber}) if defined $item->{onloan};
1925
1925
1926
    # the holdingbranch is updated if the document is returned to another location.
1926
    # the holdingbranch is updated if the document is returned to another location.
1927
    # this is always done regardless of whether the item was on loan or not
1927
    # this is always done regardless of whether the item was on loan or not
(-)a/t/db_dependent/Circulation.t (-2 / +12 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 113;
20
use Test::More tests => 114;
21
21
22
use DateTime;
22
use DateTime;
23
23
Lines 2047-2052 subtest 'CanBookBeIssued | is_overdue' => sub { Link Here
2047
2047
2048
};
2048
};
2049
2049
2050
subtest 'AddReturn should always clear items.onloan' => sub {
2051
    plan tests => 1;
2052
2053
    # Tested by returning an item that has not been issued
2054
    t::lib::Mocks::mock_preference( "AllowReturnToBranch", 'anywhere' );
2055
    my $item = $builder->build_object({ class => 'Koha::Items', value  => { onloan => '2018-01-01' }});
2056
    AddReturn( $item->barcode, $item->homebranch );
2057
    $item->discard_changes; # refresh
2058
    is( $item->onloan, undef, 'AddReturn did clear items.onloan' );
2059
};
2060
2050
sub set_userenv {
2061
sub set_userenv {
2051
    my ( $library ) = @_;
2062
    my ( $library ) = @_;
2052
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', '');
2063
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', '');
2053
- 

Return to bug 20487