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

(-)a/t/db_dependent/Circulation.t (-6 / +22 lines)
Lines 1820-1826 subtest 'AddIssue & AllowReturnToBranch' => sub { Link Here
1820
1820
1821
1821
1822
subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub {
1822
subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub {
1823
    plan tests => 31;
1823
    plan tests => 33;
1824
1824
1825
    t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
1825
    t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
1826
1826
Lines 1914-1920 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
1914
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
1914
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
1915
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
1915
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
1916
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
1916
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
1917
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
1917
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to holding (homebranch forbidden) from returnbranch');
1918
1919
    my $limit_2 = Koha::Item::Transfer::Limit->new({
1920
        toBranch   => $holdingbranch->{branchcode},
1921
        fromBranch => $returnbranch->{branchcode},
1922
        itemtype   => $item->effective_itemtype,
1923
    })->store();
1924
1925
    diag("Attempt return at returnbranch ('Anywhere' + Return -> Home and Return -> Holding limit)");
1926
    # NOTE: Should we prevent return here.. we cannot transfer from 'returnbranch'
1927
    # to 'homebranch' (But we can transfer back to 'holdingbranch').
1928
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
1929
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
1930
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
1931
    is ( 0 , $allowed , 'Prevent return where item can\'t be transferred to both homebranch and holding from returnbranch');
1932
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
1933
1934
    $limit_2->delete()->store()->discard_changes;
1918
1935
1919
    # Set limit ( Return -> Holding denied)
1936
    # Set limit ( Return -> Holding denied)
1920
    $limit->set(
1937
    $limit->set(
Lines 1947-1953 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
1947
    # to 'holdingbranch' (But we can transfer back to 'homebranch').
1964
    # to 'holdingbranch' (But we can transfer back to 'homebranch').
1948
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
1965
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
1949
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
1966
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
1950
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
1967
    is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to homebranch (holdingbranch forbidden) from returnbranch');
1951
1968
1952
    # Set limit ( Holding -> Home denied)
1969
    # Set limit ( Holding -> Home denied)
1953
    $limit->set(
1970
    $limit->set(
Lines 1976-1986 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
1976
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
1993
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
1977
1994
1978
    diag("Attempt return at returnbranch ('Anywhere' + Holding -> Home limit)");
1995
    diag("Attempt return at returnbranch ('Anywhere' + Holding -> Home limit)");
1979
    # NOTE: A return here can subsequently be transfered to back to homebranch
1996
    # NOTE: A return here can subsequently be transferred to back to homebranch
1980
    # or holdingbranch.
1997
    # or holdingbranch.
1981
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
1998
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
1982
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
1999
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
1983
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
2000
    is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to from anywhere');
1984
};
2001
};
1985
2002
1986
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
2003
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
1987
- 

Return to bug 7376