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

(-)a/t/db_dependent/Circulation.t (-6 / +22 lines)
Lines 1926-1932 subtest 'AddIssue & AllowReturnToBranch' => sub { Link Here
1926
1926
1927
1927
1928
subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub {
1928
subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub {
1929
    plan tests => 31;
1929
    plan tests => 33;
1930
1930
1931
    t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
1931
    t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
1932
1932
Lines 2020-2026 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
2020
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
2020
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
2021
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2021
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2022
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2022
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2023
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
2023
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to holding (homebranch forbidden) from returnbranch');
2024
2025
    my $limit_2 = Koha::Item::Transfer::Limit->new({
2026
        toBranch   => $holdingbranch->{branchcode},
2027
        fromBranch => $returnbranch->{branchcode},
2028
        itemtype   => $item->effective_itemtype,
2029
    })->store();
2030
2031
    diag("Attempt return at returnbranch ('Anywhere' + Return -> Home and Return -> Holding limit)");
2032
    # NOTE: Should we prevent return here.. we cannot transfer from 'returnbranch'
2033
    # to 'homebranch' (But we can transfer back to 'holdingbranch').
2034
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
2035
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2036
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2037
    is ( 0 , $allowed , 'Prevent return where item can\'t be transferred to both homebranch and holding from returnbranch');
2038
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
2039
2040
    $limit_2->delete()->store()->discard_changes;
2024
2041
2025
    # Set limit ( Return -> Holding denied)
2042
    # Set limit ( Return -> Holding denied)
2026
    $limit->set(
2043
    $limit->set(
Lines 2053-2059 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
2053
    # to 'holdingbranch' (But we can transfer back to 'homebranch').
2070
    # to 'holdingbranch' (But we can transfer back to 'homebranch').
2054
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2071
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2055
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2072
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2056
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
2073
    is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to homebranch (holdingbranch forbidden) from returnbranch');
2057
2074
2058
    # Set limit ( Holding -> Home denied)
2075
    # Set limit ( Holding -> Home denied)
2059
    $limit->set(
2076
    $limit->set(
Lines 2082-2092 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
2082
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
2099
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
2083
2100
2084
    diag("Attempt return at returnbranch ('Anywhere' + Holding -> Home limit)");
2101
    diag("Attempt return at returnbranch ('Anywhere' + Holding -> Home limit)");
2085
    # NOTE: A return here can subsequently be transfered to back to homebranch
2102
    # NOTE: A return here can subsequently be transferred to back to homebranch
2086
    # or holdingbranch.
2103
    # or holdingbranch.
2087
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2104
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2088
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2105
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2089
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
2106
    is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to from anywhere');
2090
};
2107
};
2091
2108
2092
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
2109
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
2093
- 

Return to bug 7376