Lines 448-455
is(
Link Here
|
448 |
my $letter = ReserveSlip( { branchcode => $branch_1, reserve_id => $reserve_id } ); |
448 |
my $letter = ReserveSlip( { branchcode => $branch_1, reserve_id => $reserve_id } ); |
449 |
ok( defined($letter), 'can successfully generate hold slip (bug 10949)' ); |
449 |
ok( defined($letter), 'can successfully generate hold slip (bug 10949)' ); |
450 |
|
450 |
|
451 |
# Tests for bug 9788: Does Koha::Item->current_holds return a future wait? |
451 |
# Does Koha::Biblio->current_holds respect ConfirmFutureHolds for a next available hold? |
452 |
# 9788a: current_holds does not return future next available hold |
|
|
453 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, ($bibnum) ); |
452 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, ($bibnum) ); |
454 |
t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 ); |
453 |
t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 ); |
455 |
t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 1 ); |
454 |
t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 1 ); |
Lines 465-476
AddReserve(
Link Here
|
465 |
} |
464 |
} |
466 |
); |
465 |
); |
467 |
|
466 |
|
468 |
$holds = $item->current_holds; |
467 |
$holds = Koha::Biblios->find($bibnum)->current_holds; |
469 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
468 |
is( $holds->count, 1, 'current_holds returns a future next available hold' ); |
470 |
my $future_holds = $holds->search( { reservedate => { '>' => $dtf->format_date(dt_from_string) } } ); |
|
|
471 |
is( $future_holds->count, 0, 'current_holds does not return a future next available hold' ); |
472 |
|
469 |
|
473 |
# 9788b: current_holds does not return future item level hold |
470 |
# Does Koha::Item->current_holds respect ConfirmFutureHolds for a item level hold? |
474 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, ($bibnum) ); |
471 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, ($bibnum) ); |
475 |
AddReserve( |
472 |
AddReserve( |
476 |
{ |
473 |
{ |
Lines 482-497
AddReserve(
Link Here
|
482 |
itemnumber => $item->itemnumber, |
479 |
itemnumber => $item->itemnumber, |
483 |
} |
480 |
} |
484 |
); #item level hold |
481 |
); #item level hold |
485 |
$future_holds = $holds->search( { reservedate => { '>' => $dtf->format_date(dt_from_string) } } ); |
482 |
$holds = $item->current_holds; |
486 |
is( $future_holds->count, 0, 'current_holds does not return a future item level hold' ); |
483 |
is( $holds->count, 1, 'current_holds returns a future item level hold' ); |
487 |
|
484 |
|
488 |
# 9788c: current_holds returns future wait (confirmed future hold) |
485 |
# Does $item->current_holds return a future wait (confirmed future hold)? |
|
|
486 |
t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 1 ); |
489 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0 ); #confirm hold |
487 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0 ); #confirm hold |
490 |
$future_holds = $holds->search( { reservedate => { '>' => $dtf->format_date(dt_from_string) } } ); |
488 |
$holds = $item->current_holds; |
491 |
is( $future_holds->count, 1, 'current_holds returns a future wait (confirmed future hold)' ); |
489 |
is( $holds->count, 1, 'current_holds returns a future wait (confirmed future hold)' ); |
492 |
|
|
|
493 |
# End of tests for bug 9788 |
494 |
|
495 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, ($bibnum) ); |
490 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, ($bibnum) ); |
496 |
|
491 |
|
497 |
# Tests for CalculatePriority (bug 8918) |
492 |
# Tests for CalculatePriority (bug 8918) |
498 |
- |
|
|