|
Lines 2206-2212
subtest 'CanBookBeIssued | is_overdue' => sub {
Link Here
|
| 2206 |
my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $five_days_go ); # date due was 10d ago |
2206 |
my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $five_days_go ); # date due was 10d ago |
| 2207 |
my $actualissue = Koha::Checkouts->find( { itemnumber => $item->{itemnumber} } ); |
2207 |
my $actualissue = Koha::Checkouts->find( { itemnumber => $item->{itemnumber} } ); |
| 2208 |
is( output_pref({ str => $actualissue->date_due, dateonly => 1}), $five_days_go, "First issue works"); |
2208 |
is( output_pref({ str => $actualissue->date_due, dateonly => 1}), $five_days_go, "First issue works"); |
| 2209 |
my ($issuingimpossible, $needsconfirmation) = CanBookBeIssued($patron,$item->{barcode},$ten_days_go, undef, undef, undef); |
2209 |
my ($issuingimpossible, $needsconfirmation) = CanBookBeIssued($patron,$item->{barcode},$ten_days_go, undef, undef); |
| 2210 |
is( $needsconfirmation->{RENEW_ISSUE}, 1, "This is a renewal"); |
2210 |
is( $needsconfirmation->{RENEW_ISSUE}, 1, "This is a renewal"); |
| 2211 |
is( $needsconfirmation->{TOO_MANY}, undef, "Not too many, is a renewal"); |
2211 |
is( $needsconfirmation->{TOO_MANY}, undef, "Not too many, is a renewal"); |
| 2212 |
|
2212 |
|
|
Lines 2242-2248
subtest 'CanBookBeIssued | item-level_itypes=biblio' => sub {
Link Here
|
| 2242 |
} |
2242 |
} |
| 2243 |
)->store; |
2243 |
)->store; |
| 2244 |
|
2244 |
|
| 2245 |
my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); |
2245 |
my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef ); |
| 2246 |
is_deeply( $needsconfirmation, {}, 'Item can be issued to this patron' ); |
2246 |
is_deeply( $needsconfirmation, {}, 'Item can be issued to this patron' ); |
| 2247 |
is_deeply( $issuingimpossible, {}, 'Item can be issued to this patron' ); |
2247 |
is_deeply( $issuingimpossible, {}, 'Item can be issued to this patron' ); |
| 2248 |
}; |
2248 |
}; |
|
Lines 2287-2299
subtest 'CanBookBeIssued | notforloan' => sub {
Link Here
|
| 2287 |
|
2287 |
|
| 2288 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); # item |
2288 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); # item |
| 2289 |
# Is for loan at item type and item level |
2289 |
# Is for loan at item type and item level |
| 2290 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); |
2290 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef ); |
| 2291 |
is_deeply( $needsconfirmation, {}, 'Item can be issued to this patron' ); |
2291 |
is_deeply( $needsconfirmation, {}, 'Item can be issued to this patron' ); |
| 2292 |
is_deeply( $issuingimpossible, {}, 'Item can be issued to this patron' ); |
2292 |
is_deeply( $issuingimpossible, {}, 'Item can be issued to this patron' ); |
| 2293 |
|
2293 |
|
| 2294 |
# not for loan at item type level |
2294 |
# not for loan at item type level |
| 2295 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(1)->store; |
2295 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(1)->store; |
| 2296 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); |
2296 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef ); |
| 2297 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
2297 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
| 2298 |
is_deeply( |
2298 |
is_deeply( |
| 2299 |
$issuingimpossible, |
2299 |
$issuingimpossible, |
|
Lines 2304-2310
subtest 'CanBookBeIssued | notforloan' => sub {
Link Here
|
| 2304 |
# not for loan at item level |
2304 |
# not for loan at item level |
| 2305 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(undef)->store; |
2305 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(undef)->store; |
| 2306 |
$item->notforloan( 1 )->store; |
2306 |
$item->notforloan( 1 )->store; |
| 2307 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); |
2307 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef ); |
| 2308 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
2308 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
| 2309 |
is_deeply( |
2309 |
is_deeply( |
| 2310 |
$issuingimpossible, |
2310 |
$issuingimpossible, |
|
Lines 2329-2341
subtest 'CanBookBeIssued | notforloan' => sub {
Link Here
|
| 2329 |
# for loan at item type and item level |
2329 |
# for loan at item type and item level |
| 2330 |
$item->notforloan(undef)->store; |
2330 |
$item->notforloan(undef)->store; |
| 2331 |
$item->biblioitem->itemtype($itemtype->{itemtype})->store; |
2331 |
$item->biblioitem->itemtype($itemtype->{itemtype})->store; |
| 2332 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); |
2332 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef ); |
| 2333 |
is_deeply( $needsconfirmation, {}, 'Item can be issued to this patron' ); |
2333 |
is_deeply( $needsconfirmation, {}, 'Item can be issued to this patron' ); |
| 2334 |
is_deeply( $issuingimpossible, {}, 'Item can be issued to this patron' ); |
2334 |
is_deeply( $issuingimpossible, {}, 'Item can be issued to this patron' ); |
| 2335 |
|
2335 |
|
| 2336 |
# not for loan at item type level |
2336 |
# not for loan at item type level |
| 2337 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(1)->store; |
2337 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(1)->store; |
| 2338 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); |
2338 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef ); |
| 2339 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
2339 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
| 2340 |
is_deeply( |
2340 |
is_deeply( |
| 2341 |
$issuingimpossible, |
2341 |
$issuingimpossible, |
|
Lines 2346-2352
subtest 'CanBookBeIssued | notforloan' => sub {
Link Here
|
| 2346 |
# not for loan at item level |
2346 |
# not for loan at item level |
| 2347 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(undef)->store; |
2347 |
Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(undef)->store; |
| 2348 |
$item->notforloan( 1 )->store; |
2348 |
$item->notforloan( 1 )->store; |
| 2349 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); |
2349 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef ); |
| 2350 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
2350 |
is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); |
| 2351 |
is_deeply( |
2351 |
is_deeply( |
| 2352 |
$issuingimpossible, |
2352 |
$issuingimpossible, |