|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 58; |
20 |
use Test::More tests => 64; |
| 21 |
|
21 |
|
| 22 |
use MARC::Record; |
22 |
use MARC::Record; |
| 23 |
use DateTime::Duration; |
23 |
use DateTime::Duration; |
|
Lines 533-538
$dbh->do(
Link Here
|
| 533 |
); |
533 |
); |
| 534 |
ok( !C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() disallowed" ); |
534 |
ok( !C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() disallowed" ); |
| 535 |
|
535 |
|
|
|
536 |
# tests for MoveReserve in relation to ConfirmFutureHolds (BZ 14526) |
| 537 |
# hold from A pos 1, today, no fut holds: MoveReserve should fill it |
| 538 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 539 |
C4::Context->set_preference('ConfirmFutureHolds', 0); |
| 540 |
C4::Context->set_preference('AllowHoldDateInFuture', 1); |
| 541 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 542 |
$constraint, $bibitems, 1, undef, $expdate, $notes, |
| 543 |
$title, $checkitem, ''); |
| 544 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 545 |
($status)=CheckReserves( $itemnumber ); |
| 546 |
is( $status, '', 'MoveReserve filled hold'); |
| 547 |
# hold from A waiting, today, no fut holds: MoveReserve should fill it |
| 548 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 549 |
$constraint, $bibitems, 1, undef, $expdate, $notes, |
| 550 |
$title, $checkitem, 'W'); |
| 551 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 552 |
($status)=CheckReserves( $itemnumber ); |
| 553 |
is( $status, '', 'MoveReserve filled waiting hold'); |
| 554 |
# hold from A pos 1, tomorrow, no fut holds: not filled |
| 555 |
$resdate= dt_from_string(); |
| 556 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
| 557 |
$resdate=output_pref($resdate); |
| 558 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 559 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 560 |
$title, $checkitem, ''); |
| 561 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 562 |
($status)=CheckReserves( $itemnumber, undef, 1 ); |
| 563 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold'); |
| 564 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 565 |
# hold from A pos 1, tomorrow, fut holds=2: MoveReserve should fill it |
| 566 |
C4::Context->set_preference('ConfirmFutureHolds', 2); |
| 567 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 568 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 569 |
$title, $checkitem, ''); |
| 570 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 571 |
($status)=CheckReserves( $itemnumber, undef, 2 ); |
| 572 |
is( $status, '', 'MoveReserve filled future hold now'); |
| 573 |
# hold from A waiting, tomorrow, fut holds=2: MoveReserve should fill it |
| 574 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 575 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 576 |
$title, $checkitem, 'W'); |
| 577 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 578 |
($status)=CheckReserves( $itemnumber, undef, 2 ); |
| 579 |
is( $status, '', 'MoveReserve filled future waiting hold now'); |
| 580 |
# hold from A pos 1, today+3, fut holds=2: MoveReserve should not fill it |
| 581 |
$resdate= dt_from_string(); |
| 582 |
$resdate->add_duration(DateTime::Duration->new(days => 3)); |
| 583 |
$resdate=output_pref($resdate); |
| 584 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 585 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 586 |
$title, $checkitem, ''); |
| 587 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 588 |
($status)=CheckReserves( $itemnumber, undef, 3 ); |
| 589 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
| 590 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 591 |
|
| 592 |
# we reached the finish |
| 536 |
$dbh->rollback; |
593 |
$dbh->rollback; |
| 537 |
|
594 |
|
| 538 |
sub count_hold_print_messages { |
595 |
sub count_hold_print_messages { |
| 539 |
- |
|
|