Lines 7223-7229
subtest 'Tests for RecordLocalUseOnReturn' => sub {
Link Here
|
7223 |
}; |
7223 |
}; |
7224 |
|
7224 |
|
7225 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
7225 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
7226 |
plan tests => 4; |
7226 |
plan tests => 16; |
7227 |
|
7227 |
|
7228 |
my $homebranch = $builder->build( { source => 'Branch' } ); |
7228 |
my $homebranch = $builder->build( { source => 'Branch' } ); |
7229 |
my $holdingbranch = $builder->build( { source => 'Branch' } ); |
7229 |
my $holdingbranch = $builder->build( { source => 'Branch' } ); |
Lines 7266-7291
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
Link Here
|
7266 |
reservation_date => dt_from_string, |
7266 |
reservation_date => dt_from_string, |
7267 |
expiration_date => dt_from_string, |
7267 |
expiration_date => dt_from_string, |
7268 |
itemnumber => $item->id, |
7268 |
itemnumber => $item->id, |
7269 |
found => 'W', |
|
|
7270 |
} |
7269 |
} |
7271 |
); |
7270 |
); |
7272 |
|
7271 |
|
|
|
7272 |
my $reserve_obj = Koha::Holds->find($reserve_id); |
7273 |
|
7273 |
set_userenv($holdingbranch); |
7274 |
set_userenv($holdingbranch); |
7274 |
|
7275 |
|
7275 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 0 ); |
7276 |
my $ignore_reserves = { |
|
|
7277 |
'pending' => 1, |
7278 |
'waiting' => 1, |
7279 |
'processing' => 1, |
7280 |
'transferred' => 1, |
7281 |
}; |
7282 |
|
7283 |
# Test pending hold |
7284 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7285 |
is( |
7286 |
keys(%$error) + keys(%$alerts), 0, |
7287 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7288 |
); |
7289 |
is( exists $question->{RESERVED}, 1, 'RESERVED should be set' ); |
7290 |
|
7291 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7292 |
is( |
7293 |
keys(%$error) + keys(%$alerts), 0, |
7294 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7295 |
); |
7296 |
isnt( exists $question->{RESERVED}, 1, 'RESERVED should not be set' ); |
7297 |
|
7298 |
# Test processing hold |
7299 |
$reserve_obj->set_processing(); |
7300 |
|
7301 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7302 |
is( |
7303 |
keys(%$error) + keys(%$alerts), 0, |
7304 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7305 |
); |
7306 |
is( exists $question->{PROCESSING}, 1, 'PROCESSING should be set' ); |
7307 |
|
7308 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7309 |
is( |
7310 |
keys(%$error) + keys(%$alerts), 0, |
7311 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7312 |
); |
7313 |
isnt( exists $question->{PROCESSING}, 1, 'PROCESSING should not be set' ); |
7314 |
|
7315 |
# Test transferred hold |
7316 |
$reserve_obj->set_transfer(); |
7317 |
|
7318 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7319 |
is( |
7320 |
keys(%$error) + keys(%$alerts), 0, |
7321 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7322 |
); |
7323 |
is( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should be set' ); |
7324 |
|
7325 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7276 |
is( |
7326 |
is( |
7277 |
keys(%$error) + keys(%$alerts), 0, |
7327 |
keys(%$error) + keys(%$alerts), 0, |
7278 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7328 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7279 |
); |
7329 |
); |
7280 |
is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is set' ); |
7330 |
isnt( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should not be set' ); |
|
|
7331 |
|
7332 |
# Test waiting hold |
7333 |
$reserve_obj->set_waiting(); |
7281 |
|
7334 |
|
7282 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 1 ); |
7335 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef ); |
7283 |
is( |
7336 |
is( |
7284 |
keys(%$error) + keys(%$alerts), 0, |
7337 |
keys(%$error) + keys(%$alerts), 0, |
7285 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7338 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7286 |
); |
7339 |
); |
7287 |
isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is not set' ); |
7340 |
is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should be set' ); |
7288 |
|
7341 |
|
|
|
7342 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves ); |
7343 |
is( |
7344 |
keys(%$error) + keys(%$alerts), 0, |
7345 |
'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts ) |
7346 |
); |
7347 |
isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should not be set' ); |
7289 |
}; |
7348 |
}; |
7290 |
|
7349 |
|
7291 |
subtest 'NoRefundOnLostFinesPaidAge' => sub { |
7350 |
subtest 'NoRefundOnLostFinesPaidAge' => sub { |
7292 |
- |
|
|