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 / +14 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 => 64;
21
use Test::More tests => 65;
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 5740-5745 subtest "CanBookBeIssued + needsconfirmation message" => sub { Link Here
5740
    is($needsconfirmation->{resbranchcode}, $hold->branchcode, "Branchcodes match when hold is being processed.");
5740
    is($needsconfirmation->{resbranchcode}, $hold->branchcode, "Branchcodes match when hold is being processed.");
5741
};
5741
};
5742
5742
5743
subtest 'Tests for BlockReturnOfWithdrawnItems' => sub {
5744
5745
    plan tests => 1;
5746
5747
    t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1);
5748
    my $item = $builder->build_sample_item();
5749
    $item->withdrawn(1)->itemlost(1)->store;
5750
    my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
5751
    is_deeply(
5752
        \@return,
5753
        [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "Item returned as withdrawn, no other messages");
5754
};
5755
5743
$schema->storage->txn_rollback;
5756
$schema->storage->txn_rollback;
5744
C4::Context->clear_syspref_cache();
5757
C4::Context->clear_syspref_cache();
5745
$branches = Koha::Libraries->search();
5758
$branches = Koha::Libraries->search();
5746
- 

Return to bug 22042