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

(-)a/C4/Circulation.pm (-5 / +10 lines)
Lines 2097-2102 sub AddReturn { Link Here
2097
        }
2097
        }
2098
    }
2098
    }
2099
2099
2100
    if ( $item->withdrawn ) { # book has been cancelled
2101
        $messages->{'withdrawn'} = 1;
2102
2103
        # In the case where we block return of withdrawn, we should completely block the return
2104
        # without updating item statuses, so we exit early
2105
        return ( 0, $messages, $issue, ( $patron ? $patron->unblessed : {} ))
2106
            if C4::Context->preference("BlockReturnOfWithdrawnItems");
2107
    }
2108
2109
2100
        # full item data, but no borrowernumber or checkout info (no issue)
2110
        # full item data, but no borrowernumber or checkout info (no issue)
2101
    my $hbr = Koha::CirculationRules->get_return_branch_policy($item);
2111
    my $hbr = Koha::CirculationRules->get_return_branch_policy($item);
2102
        # get the proper branch to which to return the item
2112
        # get the proper branch to which to return the item
Lines 2166-2176 sub AddReturn { Link Here
2166
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2176
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2167
    }
2177
    }
2168
2178
2169
    if ( $item->withdrawn ) { # book has been cancelled
2170
        $messages->{'withdrawn'} = 1;
2171
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
2172
    }
2173
2174
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2179
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2175
        $doreturn = 0;
2180
        $doreturn = 0;
2176
    }
2181
    }
(-)a/t/db_dependent/Circulation.t (-2 / +15 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 63;
21
use Test::More tests => 64;
22
use Test::Exception;
22
use Test::Exception;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
Lines 5693-5698 subtest "GetSoonestRenewDate tests" => sub { Link Here
5693
    );
5693
    );
5694
};
5694
};
5695
5695
5696
subtest 'Tests for BlockReturnOfWithdrawnItems' => sub {
5697
5698
    plan tests => 1;
5699
5700
    t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1);
5701
    my $item = $builder->build_sample_item();
5702
    $item->withdrawn(1)->itemlost(1)->store;
5703
    my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
5704
    is_deeply(
5705
        \@return,
5706
        [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "Item returned as withdrawn, no other messages");
5707
5708
};
5709
5696
$schema->storage->txn_rollback;
5710
$schema->storage->txn_rollback;
5697
C4::Context->clear_syspref_cache();
5711
C4::Context->clear_syspref_cache();
5698
$branches = Koha::Libraries->search();
5712
$branches = Koha::Libraries->search();
5699
- 

Return to bug 22042