Lines 7348-7354
subtest 'Tests for RecordLocalUseOnReturn' => sub {
Link Here
|
7348 |
}; |
7348 |
}; |
7349 |
|
7349 |
|
7350 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
7350 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
7351 |
plan tests => 4; |
7351 |
plan tests => 16; |
7352 |
|
7352 |
|
7353 |
my $homebranch = $builder->build( { source => 'Branch' } ); |
7353 |
my $homebranch = $builder->build( { source => 'Branch' } ); |
7354 |
my $holdingbranch = $builder->build( { source => 'Branch' } ); |
7354 |
my $holdingbranch = $builder->build( { source => 'Branch' } ); |
Lines 7391-7416
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
Link Here
|
7391 |
reservation_date => dt_from_string, |
7391 |
reservation_date => dt_from_string, |
7392 |
expiration_date => dt_from_string, |
7392 |
expiration_date => dt_from_string, |
7393 |
itemnumber => $item->id, |
7393 |
itemnumber => $item->id, |
7394 |
found => 'W', |
|
|
7395 |
} |
7394 |
} |
7396 |
); |
7395 |
); |
7397 |
|
7396 |
|
|
|
7397 |
my $reserve_obj = Koha::Holds->find($reserve_id); |
7398 |
|
7398 |
set_userenv($holdingbranch); |
7399 |
set_userenv($holdingbranch); |
7399 |
|
7400 |
|
7400 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 0 ); |
7401 |
my $ignore_reserves = { |
|
|
7402 |
'pending' => 1, |
7403 |
'waiting' => 1, |
7404 |
'processing' => 1, |
7405 |
'transferred' => 1, |
7406 |
}; |
7407 |
|
7408 |
# Test pending hold |
7409 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7410 |
is( |
7411 |
keys(%$error) + keys(%$alerts), 0, |
7412 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7413 |
); |
7414 |
is( exists $question->{RESERVED}, 1, 'RESERVED should be set' ); |
7415 |
|
7416 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7417 |
is( |
7418 |
keys(%$error) + keys(%$alerts), 0, |
7419 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7420 |
); |
7421 |
isnt( exists $question->{RESERVED}, 1, 'RESERVED should not be set' ); |
7422 |
|
7423 |
# Test processing hold |
7424 |
$reserve_obj->set_processing(); |
7425 |
|
7426 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7427 |
is( |
7428 |
keys(%$error) + keys(%$alerts), 0, |
7429 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7430 |
); |
7431 |
is( exists $question->{PROCESSING}, 1, 'PROCESSING should be set' ); |
7432 |
|
7433 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7434 |
is( |
7435 |
keys(%$error) + keys(%$alerts), 0, |
7436 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7437 |
); |
7438 |
isnt( exists $question->{PROCESSING}, 1, 'PROCESSING should not be set' ); |
7439 |
|
7440 |
# Test transferred hold |
7441 |
$reserve_obj->set_transfer(); |
7442 |
|
7443 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7444 |
is( |
7445 |
keys(%$error) + keys(%$alerts), 0, |
7446 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7447 |
); |
7448 |
is( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should be set' ); |
7449 |
|
7450 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7401 |
is( |
7451 |
is( |
7402 |
keys(%$error) + keys(%$alerts), 0, |
7452 |
keys(%$error) + keys(%$alerts), 0, |
7403 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7453 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7404 |
); |
7454 |
); |
7405 |
is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is set' ); |
7455 |
isnt( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should not be set' ); |
|
|
7456 |
|
7457 |
# Test waiting hold |
7458 |
$reserve_obj->set_waiting(); |
7406 |
|
7459 |
|
7407 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 1 ); |
7460 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7408 |
is( |
7461 |
is( |
7409 |
keys(%$error) + keys(%$alerts), 0, |
7462 |
keys(%$error) + keys(%$alerts), 0, |
7410 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7463 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7411 |
); |
7464 |
); |
7412 |
isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is not set' ); |
7465 |
is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should be set' ); |
7413 |
|
7466 |
|
|
|
7467 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7468 |
is( |
7469 |
keys(%$error) + keys(%$alerts), 0, |
7470 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7471 |
); |
7472 |
isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should not be set' ); |
7414 |
}; |
7473 |
}; |
7415 |
|
7474 |
|
7416 |
subtest 'NoRefundOnLostFinesPaidAge' => sub { |
7475 |
subtest 'NoRefundOnLostFinesPaidAge' => sub { |
7417 |
- |
|
|