|
Lines 2214-2220
sub host_record {
Link Here
|
| 2214 |
} |
2214 |
} |
| 2215 |
|
2215 |
|
| 2216 |
subtest 'check_booking tests' => sub { |
2216 |
subtest 'check_booking tests' => sub { |
| 2217 |
plan tests => 6; |
2217 |
plan tests => 7; |
| 2218 |
|
2218 |
|
| 2219 |
$schema->storage->txn_begin; |
2219 |
$schema->storage->txn_begin; |
| 2220 |
|
2220 |
|
|
Lines 2396-2400
subtest 'check_booking tests' => sub {
Link Here
|
| 2396 |
|
2396 |
|
| 2397 |
is( $check_booking, 1, "Koha::Biblio->check_booking returns true when we can book on an item" ); |
2397 |
is( $check_booking, 1, "Koha::Biblio->check_booking returns true when we can book on an item" ); |
| 2398 |
|
2398 |
|
|
|
2399 |
subtest 'checkouts on non-bookable items do not cause false clashes' => sub { |
| 2400 |
plan tests => 2; |
| 2401 |
|
| 2402 |
my $nb_biblio = $builder->build_sample_biblio(); |
| 2403 |
my $bookable_item = $builder->build_sample_item( { biblionumber => $nb_biblio->biblionumber, bookable => 1 } ); |
| 2404 |
my $non_bookable_item = |
| 2405 |
$builder->build_sample_item( { biblionumber => $nb_biblio->biblionumber, bookable => 0 } ); |
| 2406 |
|
| 2407 |
my $nb_patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 2408 |
|
| 2409 |
# Check out the non-bookable item |
| 2410 |
AddIssue( $nb_patron, $non_bookable_item->barcode ); |
| 2411 |
|
| 2412 |
my $nb_start = dt_from_string()->truncate( to => 'day' ); |
| 2413 |
my $nb_end = $nb_start->clone->add( days => 7 ); |
| 2414 |
|
| 2415 |
my $can_book = $nb_biblio->check_booking( |
| 2416 |
{ |
| 2417 |
start_date => $nb_start, |
| 2418 |
end_date => $nb_end, |
| 2419 |
} |
| 2420 |
); |
| 2421 |
is( |
| 2422 |
$can_book, 1, |
| 2423 |
"Checkout on non-bookable item does not reduce availability" |
| 2424 |
); |
| 2425 |
|
| 2426 |
# Now also check out the bookable item to confirm it |
| 2427 |
# correctly detects unavailability |
| 2428 |
AddIssue( $nb_patron, $bookable_item->barcode ); |
| 2429 |
|
| 2430 |
$can_book = $nb_biblio->check_booking( |
| 2431 |
{ |
| 2432 |
start_date => $nb_start, |
| 2433 |
end_date => $nb_end, |
| 2434 |
} |
| 2435 |
); |
| 2436 |
is( |
| 2437 |
$can_book, 0, |
| 2438 |
"Checkout on bookable item correctly reduces availability" |
| 2439 |
); |
| 2440 |
}; |
| 2441 |
|
| 2399 |
$schema->storage->txn_rollback; |
2442 |
$schema->storage->txn_rollback; |
| 2400 |
}; |
2443 |
}; |
| 2401 |
- |
|
|