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 2211-2216
subtest 'AddIssue & illrequests.due_date' => sub {
Link Here
|
2211 |
is( $issue->date_due, $expected_date_due, 'Custom illrequest date due has been set for this issue'); |
2211 |
is( $issue->date_due, $expected_date_due, 'Custom illrequest date due has been set for this issue'); |
2212 |
}; |
2212 |
}; |
2213 |
|
2213 |
|
|
|
2214 |
subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { |
2215 |
plan tests => 6; |
2216 |
|
2217 |
my $homebranch = $builder->build( { source => 'Branch' } ); |
2218 |
my $otherbranch = $builder->build( { source => 'Branch' } ); |
2219 |
my $patron = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } ); |
2220 |
|
2221 |
my $item = $builder->build_sample_item( |
2222 |
{ |
2223 |
homebranch => $homebranch->{branchcode}, |
2224 |
holdingbranch => $homebranch->{branchcode}, |
2225 |
} |
2226 |
); |
2227 |
|
2228 |
t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); |
2229 |
set_userenv($homebranch); |
2230 |
my $issue = AddIssue( $patron, $item->barcode ); |
2231 |
my ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $otherbranch); |
2232 |
is ( 1 , $allowed , 'with AllowReturnToBranch = anywhere and no limits return to other is allowed'); |
2233 |
is ( undef , $message , 'without limits provides no message'); |
2234 |
|
2235 |
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' ); |
2236 |
t::lib::Mocks::mock_preference( 'BranchTransferLimitsType', 'itemtype' ); |
2237 |
|
2238 |
# set limit |
2239 |
my $limit = Koha::Item::Transfer::Limit->new({ |
2240 |
toBranch => $otherbranch->{branchcode}, |
2241 |
fromBranch => $item->homebranch, |
2242 |
itemtype => $item->effective_itemtype, |
2243 |
})->store(); |
2244 |
|
2245 |
($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $otherbranch); |
2246 |
is ( 0 , $allowed , 'With transfer limits cannot return to otherbranch'); |
2247 |
is ( $homebranch->{branchcode} , $message , 'With transfer limits asks return to homebranch'); |
2248 |
|
2249 |
($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $homebranch); |
2250 |
is ( 1 , $allowed , 'With transfer limits can return to homebranch'); |
2251 |
is ( undef , $message , 'With transfer limits and homebranch provides no message'); |
2252 |
}; |
2253 |
|
2214 |
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { |
2254 |
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { |
2215 |
plan tests => 8; |
2255 |
plan tests => 8; |
2216 |
|
2256 |
|
2217 |
- |
|
|