Lines 7448-7454
subtest 'Tests for RecordLocalUseOnReturn' => sub {
Link Here
|
7448 |
}; |
7448 |
}; |
7449 |
|
7449 |
|
7450 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
7450 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
7451 |
plan tests => 4; |
7451 |
plan tests => 16; |
7452 |
|
7452 |
|
7453 |
my $homebranch = $builder->build( { source => 'Branch' } ); |
7453 |
my $homebranch = $builder->build( { source => 'Branch' } ); |
7454 |
my $holdingbranch = $builder->build( { source => 'Branch' } ); |
7454 |
my $holdingbranch = $builder->build( { source => 'Branch' } ); |
Lines 7491-7516
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
Link Here
|
7491 |
reservation_date => dt_from_string, |
7491 |
reservation_date => dt_from_string, |
7492 |
expiration_date => dt_from_string, |
7492 |
expiration_date => dt_from_string, |
7493 |
itemnumber => $item->id, |
7493 |
itemnumber => $item->id, |
7494 |
found => 'W', |
|
|
7495 |
} |
7494 |
} |
7496 |
); |
7495 |
); |
7497 |
|
7496 |
|
|
|
7497 |
my $reserve_obj = Koha::Holds->find($reserve_id); |
7498 |
|
7498 |
set_userenv($holdingbranch); |
7499 |
set_userenv($holdingbranch); |
7499 |
|
7500 |
|
7500 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 0 ); |
7501 |
my $ignore_reserves = { |
|
|
7502 |
'pending' => 1, |
7503 |
'waiting' => 1, |
7504 |
'processing' => 1, |
7505 |
'transferred' => 1, |
7506 |
}; |
7507 |
|
7508 |
# Test pending hold |
7509 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7510 |
is( |
7511 |
keys(%$error) + keys(%$alerts), 0, |
7512 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7513 |
); |
7514 |
is( exists $question->{RESERVED}, 1, 'RESERVED should be set' ); |
7515 |
|
7516 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7517 |
is( |
7518 |
keys(%$error) + keys(%$alerts), 0, |
7519 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7520 |
); |
7521 |
isnt( exists $question->{RESERVED}, 1, 'RESERVED should not be set' ); |
7522 |
|
7523 |
# Test processing hold |
7524 |
$reserve_obj->set_processing(); |
7525 |
|
7526 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7527 |
is( |
7528 |
keys(%$error) + keys(%$alerts), 0, |
7529 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7530 |
); |
7531 |
is( exists $question->{PROCESSING}, 1, 'PROCESSING should be set' ); |
7532 |
|
7533 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7534 |
is( |
7535 |
keys(%$error) + keys(%$alerts), 0, |
7536 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7537 |
); |
7538 |
isnt( exists $question->{PROCESSING}, 1, 'PROCESSING should not be set' ); |
7539 |
|
7540 |
# Test transferred hold |
7541 |
$reserve_obj->set_transfer(); |
7542 |
|
7543 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7544 |
is( |
7545 |
keys(%$error) + keys(%$alerts), 0, |
7546 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7547 |
); |
7548 |
is( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should be set' ); |
7549 |
|
7550 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7501 |
is( |
7551 |
is( |
7502 |
keys(%$error) + keys(%$alerts), 0, |
7552 |
keys(%$error) + keys(%$alerts), 0, |
7503 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7553 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7504 |
); |
7554 |
); |
7505 |
is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is set' ); |
7555 |
isnt( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should not be set' ); |
|
|
7556 |
|
7557 |
# Test waiting hold |
7558 |
$reserve_obj->set_waiting(); |
7506 |
|
7559 |
|
7507 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 1 ); |
7560 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7508 |
is( |
7561 |
is( |
7509 |
keys(%$error) + keys(%$alerts), 0, |
7562 |
keys(%$error) + keys(%$alerts), 0, |
7510 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7563 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7511 |
); |
7564 |
); |
7512 |
isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is not set' ); |
7565 |
is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should be set' ); |
7513 |
|
7566 |
|
|
|
7567 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7568 |
is( |
7569 |
keys(%$error) + keys(%$alerts), 0, |
7570 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7571 |
); |
7572 |
isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should not be set' ); |
7514 |
}; |
7573 |
}; |
7515 |
|
7574 |
|
7516 |
subtest 'NoRefundOnLostFinesPaidAge' => sub { |
7575 |
subtest 'NoRefundOnLostFinesPaidAge' => sub { |
7517 |
- |
|
|