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

(-)a/C4/Circulation.pm (-5 / +7 lines)
Lines 2094-2099 sub AddReturn { Link Here
2094
        }
2094
        }
2095
    }
2095
    }
2096
2096
2097
    if ( $item->withdrawn ) { # book has been cancelled
2098
        $messages->{'withdrawn'} = 1;
2099
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
2100
        return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2101
    }
2102
2103
2097
        # full item data, but no borrowernumber or checkout info (no issue)
2104
        # full item data, but no borrowernumber or checkout info (no issue)
2098
    my $hbr = GetBranchItemRule($item->homebranch, $itemtype)->{'returnbranch'} || "homebranch";
2105
    my $hbr = GetBranchItemRule($item->homebranch, $itemtype)->{'returnbranch'} || "homebranch";
2099
        # get the proper branch to which to return the item
2106
        # get the proper branch to which to return the item
Lines 2163-2173 sub AddReturn { Link Here
2163
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2170
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2164
    }
2171
    }
2165
2172
2166
    if ( $item->withdrawn ) { # book has been cancelled
2167
        $messages->{'withdrawn'} = 1;
2168
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
2169
    }
2170
2171
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2173
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2172
        $doreturn = 0;
2174
        $doreturn = 0;
2173
    }
2175
    }
(-)a/t/db_dependent/Circulation.t (-1 / +14 lines)
Lines 5470-5475 subtest "GetSoonestRenewDate tests" => sub { Link Here
5470
    );
5470
    );
5471
};
5471
};
5472
5472
5473
subtest 'Tests for BlockReturnOfWithdrawnItems' => sub {
5474
5475
    plan tests => 1;
5476
5477
    t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1);
5478
    my $item = $builder->build_sample_item();
5479
    $item->withdrawn(1)->itemlost(1)->store;
5480
    my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
5481
    is_deeply(
5482
        \@return,
5483
        [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "Item returned as withdrawn, no other messages");
5484
5485
};
5486
5473
$schema->storage->txn_rollback;
5487
$schema->storage->txn_rollback;
5474
C4::Context->clear_syspref_cache();
5488
C4::Context->clear_syspref_cache();
5475
$branches = Koha::Libraries->search();
5489
$branches = Koha::Libraries->search();
5476
- 

Return to bug 22042