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

(-)a/t/db_dependent/Circulation.t (-6 / +22 lines)
Lines 2212-2218 subtest 'AddIssue & illrequests.due_date' => sub { Link Here
2212
};
2212
};
2213
2213
2214
subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub {
2214
subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub {
2215
    plan tests => 31;
2215
    plan tests => 33;
2216
2216
2217
    t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
2217
    t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
2218
2218
Lines 2306-2312 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
2306
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
2306
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
2307
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2307
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2308
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2308
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2309
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
2309
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to holding (homebranch forbidden) from returnbranch');
2310
2311
    my $limit_2 = Koha::Item::Transfer::Limit->new({
2312
        toBranch   => $holdingbranch->{branchcode},
2313
        fromBranch => $returnbranch->{branchcode},
2314
        itemtype   => $item->effective_itemtype,
2315
    })->store();
2316
2317
    diag("Attempt return at returnbranch ('Anywhere' + Return -> Home and Return -> Holding limit)");
2318
    # NOTE: Should we prevent return here.. we cannot transfer from 'returnbranch'
2319
    # to 'homebranch' (But we can transfer back to 'holdingbranch').
2320
    # NOTE: This is the ONLY change that bug 7376 introduces currently.
2321
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2322
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2323
    is ( 0 , $allowed , 'Prevent return where item can\'t be transferred to both homebranch and holding from returnbranch');
2324
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
2325
2326
    $limit_2->delete()->store()->discard_changes;
2310
2327
2311
    # Set limit ( Return -> Holding denied)
2328
    # Set limit ( Return -> Holding denied)
2312
    $limit->set(
2329
    $limit->set(
Lines 2339-2345 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
2339
    # to 'holdingbranch' (But we can transfer back to 'homebranch').
2356
    # to 'holdingbranch' (But we can transfer back to 'homebranch').
2340
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2357
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2341
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2358
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2342
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
2359
    is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to homebranch (holdingbranch forbidden) from returnbranch');
2343
2360
2344
    # Set limit ( Holding -> Home denied)
2361
    # Set limit ( Holding -> Home denied)
2345
    $limit->set(
2362
    $limit->set(
Lines 2368-2378 subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { Link Here
2368
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
2385
    is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch');
2369
2386
2370
    diag("Attempt return at returnbranch ('Anywhere' + Holding -> Home limit)");
2387
    diag("Attempt return at returnbranch ('Anywhere' + Holding -> Home limit)");
2371
    # NOTE: A return here can subsequently be transfered to back to homebranch
2388
    # NOTE: A return here can subsequently be transferred to back to homebranch
2372
    # or holdingbranch.
2389
    # or holdingbranch.
2373
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2390
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2374
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2391
    ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch);
2375
    is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere');
2392
    is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to from anywhere');
2376
};
2393
};
2377
2394
2378
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
2395
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
2379
- 

Return to bug 7376