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

(-)a/C4/Circulation.pm (-5 / +10 lines)
Lines 2095-2100 sub AddReturn { Link Here
2095
        }
2095
        }
2096
    }
2096
    }
2097
2097
2098
    if ( $item->withdrawn ) { # book has been cancelled
2099
        $messages->{'withdrawn'} = 1;
2100
2101
        # In the case where we block return of withdrawn, we should completely block the return
2102
        # without updating item statuses, so we exit early
2103
        return ( 0, $messages, $issue, ( $patron ? $patron->unblessed : {} ))
2104
            if C4::Context->preference("BlockReturnOfWithdrawnItems");
2105
    }
2106
2107
2098
        # full item data, but no borrowernumber or checkout info (no issue)
2108
        # full item data, but no borrowernumber or checkout info (no issue)
2099
    my $hbr = GetBranchItemRule($item->homebranch, $itemtype)->{'returnbranch'} || "homebranch";
2109
    my $hbr = GetBranchItemRule($item->homebranch, $itemtype)->{'returnbranch'} || "homebranch";
2100
        # get the proper branch to which to return the item
2110
        # get the proper branch to which to return the item
Lines 2164-2174 sub AddReturn { Link Here
2164
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2174
        return ( $doreturn, $messages, $issue, $patron_unblessed);
2165
    }
2175
    }
2166
2176
2167
    if ( $item->withdrawn ) { # book has been cancelled
2168
        $messages->{'withdrawn'} = 1;
2169
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
2170
    }
2171
2172
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2177
    if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) {
2173
        $doreturn = 0;
2178
        $doreturn = 0;
2174
    }
2179
    }
(-)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 => 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 5450-5455 subtest "GetSoonestRenewDate tests" => sub { Link Here
5450
    );
5450
    );
5451
};
5451
};
5452
5452
5453
subtest 'Tests for BlockReturnOfWithdrawnItems' => sub {
5454
5455
    plan tests => 1;
5456
5457
    t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1);
5458
    my $item = $builder->build_sample_item();
5459
    $item->withdrawn(1)->itemlost(1)->store;
5460
    my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
5461
    is_deeply(
5462
        \@return,
5463
        [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "Item returned as withdrawn, no other messages");
5464
};
5465
5453
$schema->storage->txn_rollback;
5466
$schema->storage->txn_rollback;
5454
C4::Context->clear_syspref_cache();
5467
C4::Context->clear_syspref_cache();
5455
$branches = Koha::Libraries->search();
5468
$branches = Koha::Libraries->search();
5456
- 

Return to bug 22042