|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 75; |
20 |
use Test::More tests => 77; |
| 21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
| 22 |
use Test::Warn; |
22 |
use Test::Warn; |
| 23 |
|
23 |
|
|
Lines 387-394
t::lib::Mocks::mock_preference('ConfirmFutureHolds', 7);
Link Here
|
| 387 |
($doreturn, $messages)= AddReturn('97531',$branch_1); |
387 |
($doreturn, $messages)= AddReturn('97531',$branch_1); |
| 388 |
is(exists $messages->{ResFound}?1:0, 1, 'AddReturn considers future reserve within ConfirmFutureHolds days'); |
388 |
is(exists $messages->{ResFound}?1:0, 1, 'AddReturn considers future reserve within ConfirmFutureHolds days'); |
| 389 |
|
389 |
|
|
|
390 |
my $now_holder = $builder->build_object({ class => 'Koha::Patrons', value => { |
| 391 |
branchcode => $branch_1, |
| 392 |
}}); |
| 393 |
my $now_reserve_id = AddReserve( |
| 394 |
{ |
| 395 |
branchcode => $branch_1, |
| 396 |
borrowernumber => $requesters{$branch_1}, |
| 397 |
biblionumber => $bibnum, |
| 398 |
priority => 2, |
| 399 |
reservation_date => output_pref(dt_from_string()), |
| 400 |
} |
| 401 |
); |
| 402 |
my $which_highest; |
| 403 |
($status,$which_highest)=CheckReserves($item->itemnumber,undef,3); |
| 404 |
is( $which_highest->{reserve_id}, $now_reserve_id, 'CheckReserves returns lower priority current reserve with insufficient lookahead'); |
| 405 |
($status, $which_highest)=CheckReserves($item->itemnumber,undef,4); |
| 406 |
is( $which_highest->{reserve_id}, $reserve_id, 'CheckReserves returns higher priority future reserve with sufficient lookahead'); |
| 407 |
ModReserve({ reserve_id => $now_reserve_id, rank => 'del', cancellation_reason => 'test reserve' }); |
| 408 |
|
| 409 |
|
| 390 |
# End of tests for bug 9761 (ConfirmFutureHolds) |
410 |
# End of tests for bug 9761 (ConfirmFutureHolds) |
| 391 |
|
411 |
|
|
|
412 |
|
| 392 |
# test marking a hold as captured |
413 |
# test marking a hold as captured |
| 393 |
my $hold_notice_count = count_hold_print_messages(); |
414 |
my $hold_notice_count = count_hold_print_messages(); |
| 394 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
415 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
|
Lines 521-546
is($p, 3, 'CalculatePriority should now return priority 3');
Link Here
|
| 521 |
# regression test for bug 12630 |
542 |
# regression test for bug 12630 |
| 522 |
# Now there are 2 reserves on $bibnum |
543 |
# Now there are 2 reserves on $bibnum |
| 523 |
t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); |
544 |
t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); |
| 524 |
my $borrowernumber_tmp_1 = AddMember( |
545 |
my $bor_tmp_1 = $builder->build_object({ class => 'Koha::Patrons',value =>{ |
| 525 |
firstname => 'my firstname tmp 1', |
546 |
firstname => 'my firstname tmp 1', |
| 526 |
surname => 'my surname tmp 1', |
547 |
surname => 'my surname tmp 1', |
| 527 |
categorycode => 'S', |
548 |
categorycode => 'S', |
| 528 |
branchcode => 'CPL', |
549 |
branchcode => 'CPL', |
| 529 |
); |
550 |
}}); |
| 530 |
my $borrowernumber_tmp_2 = AddMember( |
551 |
my $bor_tmp_2 = $builder->build_object({ class => 'Koha::Patrons',value =>{ |
| 531 |
firstname => 'my firstname tmp 2', |
552 |
firstname => 'my firstname tmp 2', |
| 532 |
surname => 'my surname tmp 2', |
553 |
surname => 'my surname tmp 2', |
| 533 |
categorycode => 'S', |
554 |
categorycode => 'S', |
| 534 |
branchcode => 'CPL', |
555 |
branchcode => 'CPL', |
| 535 |
); |
556 |
}}); |
|
|
557 |
my $borrowernumber_tmp_1 = $bor_tmp_1->borrowernumber; |
| 558 |
my $borrowernumber_tmp_2 = $bor_tmp_2->borrowernumber; |
| 536 |
my $date_in_future = dt_from_string(); |
559 |
my $date_in_future = dt_from_string(); |
| 537 |
$date_in_future = $date_in_future->add_duration(DateTime::Duration->new(days => 1)); |
560 |
$date_in_future = $date_in_future->add_duration(DateTime::Duration->new(days => 1)); |
| 538 |
AddReserve('CPL', $borrowernumber_tmp_1, $bibnum, undef, undef, 3, output_pref($date_in_future)); |
561 |
AddReserve({ |
| 539 |
AddReserve('CPL', $borrowernumber_tmp_2, $bibnum, undef, undef, 4); |
562 |
branch => 'CPL', |
| 540 |
my @r1 = GetReservesFromBorrowernumber( $borrowernumber_tmp_1 ); |
563 |
borrowernumber => $borrowernumber_tmp_1, |
| 541 |
my @r2 = GetReservesFromBorrowernumber( $borrowernumber_tmp_2 ); |
564 |
biblionumber => $bibnum, |
| 542 |
is( $r1[0]->{priority}, 3, 'priority for hold in future should be correct'); |
565 |
priority => 3, |
| 543 |
is( $r2[0]->{priority}, 4, 'priority for hold not in future should be correct'); |
566 |
reservation_date => output_pref($date_in_future) |
|
|
567 |
}); |
| 568 |
AddReserve({ |
| 569 |
branch => 'CPL', |
| 570 |
borrowernumber => $borrowernumber_tmp_2, |
| 571 |
biblionumber => $bibnum, |
| 572 |
priority => 4, |
| 573 |
reservation_date => output_pref($date_in_future) |
| 574 |
}); |
| 575 |
my @r1 = Koha::Holds->search({ borrowernumber => $borrowernumber_tmp_1 })->as_list; |
| 576 |
my @r2 = Koha::Holds->search({ borrowernumber => $borrowernumber_tmp_2 })->as_list; |
| 577 |
is( $r1[0]->priority, 3, 'priority for hold in future should be correct'); |
| 578 |
is( $r2[0]->priority, 4, 'priority for hold not in future should be correct'); |
| 544 |
# end of tests for bug 12630 |
579 |
# end of tests for bug 12630 |
| 545 |
|
580 |
|
| 546 |
# Tests for cancel reserves by users from OPAC. |
581 |
# Tests for cancel reserves by users from OPAC. |
| 547 |
- |
|
|