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

(-)a/C4/Circulation.pm (-5 / +7 lines)
Lines 2082-2087 sub AddReturn { Link Here
2082
        }
2082
        }
2083
    }
2083
    }
2084
2084
2085
    if ( $item->withdrawn ) { # book has been cancelled
2086
        $messages->{'withdrawn'} = 1;
2087
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
2088
        return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2089
    }
2090
2091
2085
        # full item data, but no borrowernumber or checkout info (no issue)
2092
        # full item data, but no borrowernumber or checkout info (no issue)
2086
    my $hbr = GetBranchItemRule($item->homebranch, $itemtype)->{'returnbranch'} || "homebranch";
2093
    my $hbr = GetBranchItemRule($item->homebranch, $itemtype)->{'returnbranch'} || "homebranch";
2087
        # get the proper branch to which to return the item
2094
        # get the proper branch to which to return the item
Lines 2151-2161 sub AddReturn { Link Here
2151
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2158
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2152
    }
2159
    }
2153
2160
2154
    if ( $item->withdrawn ) { # book has been cancelled
2155
        $messages->{'withdrawn'} = 1;
2156
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
2157
    }
2158
2159
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2161
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2160
        $doreturn = 0;
2162
        $doreturn = 0;
2161
    }
2163
    }
(-)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 => 60;
21
use Test::More tests => 61;
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 5280-5285 subtest "GetSoonestRenewDate tests" => sub { Link Here
5280
    );
5280
    );
5281
};
5281
};
5282
5282
5283
subtest 'Tests for BlockReturnOfWithdrawnItems' => sub {
5284
5285
    plan tests => 1;
5286
5287
    t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1);
5288
    my $item = $builder->build_sample_item();
5289
    $item->withdrawn(1)->itemlost(1)->store;
5290
    my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
5291
    is_deeply(
5292
        \@return,
5293
        [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "Item returned as withdrawn, no other messages");
5294
5295
};
5296
5283
$schema->storage->txn_rollback;
5297
$schema->storage->txn_rollback;
5284
C4::Context->clear_syspref_cache();
5298
C4::Context->clear_syspref_cache();
5285
$branches = Koha::Libraries->search();
5299
$branches = Koha::Libraries->search();
5286
- 

Return to bug 22042