|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 65; |
20 |
use Test::More tests => 71; |
| 21 |
|
21 |
|
| 22 |
use MARC::Record; |
22 |
use MARC::Record; |
| 23 |
use DateTime::Duration; |
23 |
use DateTime::Duration; |
|
Lines 612-617
CancelReserve({ reserve_id => $bz14464_reserve, charge_cancel_fee => 1 });
Link Here
|
| 612 |
( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber ); |
612 |
( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber ); |
| 613 |
is( int( $bz14464_fines ), 42, 'Bug 14464 - Fine applied after cancelling reserve with charge desired and configured' ); |
613 |
is( int( $bz14464_fines ), 42, 'Bug 14464 - Fine applied after cancelling reserve with charge desired and configured' ); |
| 614 |
|
614 |
|
|
|
615 |
# tests for MoveReserve in relation to ConfirmFutureHolds (BZ 14526) |
| 616 |
# hold from A pos 1, today, no fut holds: MoveReserve should fill it |
| 617 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 618 |
C4::Context->set_preference('ConfirmFutureHolds', 0); |
| 619 |
C4::Context->set_preference('AllowHoldDateInFuture', 1); |
| 620 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 621 |
$constraint, $bibitems, 1, undef, $expdate, $notes, |
| 622 |
$title, $checkitem, ''); |
| 623 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 624 |
($status)=CheckReserves( $itemnumber ); |
| 625 |
is( $status, '', 'MoveReserve filled hold'); |
| 626 |
# hold from A waiting, today, no fut holds: MoveReserve should fill it |
| 627 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 628 |
$constraint, $bibitems, 1, undef, $expdate, $notes, |
| 629 |
$title, $checkitem, 'W'); |
| 630 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 631 |
($status)=CheckReserves( $itemnumber ); |
| 632 |
is( $status, '', 'MoveReserve filled waiting hold'); |
| 633 |
# hold from A pos 1, tomorrow, no fut holds: not filled |
| 634 |
$resdate= dt_from_string(); |
| 635 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
| 636 |
$resdate=output_pref($resdate); |
| 637 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 638 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 639 |
$title, $checkitem, ''); |
| 640 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 641 |
($status)=CheckReserves( $itemnumber, undef, 1 ); |
| 642 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold'); |
| 643 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 644 |
# hold from A pos 1, tomorrow, fut holds=2: MoveReserve should fill it |
| 645 |
C4::Context->set_preference('ConfirmFutureHolds', 2); |
| 646 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 647 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 648 |
$title, $checkitem, ''); |
| 649 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 650 |
($status)=CheckReserves( $itemnumber, undef, 2 ); |
| 651 |
is( $status, '', 'MoveReserve filled future hold now'); |
| 652 |
# hold from A waiting, tomorrow, fut holds=2: MoveReserve should fill it |
| 653 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 654 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 655 |
$title, $checkitem, 'W'); |
| 656 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 657 |
($status)=CheckReserves( $itemnumber, undef, 2 ); |
| 658 |
is( $status, '', 'MoveReserve filled future waiting hold now'); |
| 659 |
# hold from A pos 1, today+3, fut holds=2: MoveReserve should not fill it |
| 660 |
$resdate= dt_from_string(); |
| 661 |
$resdate->add_duration(DateTime::Duration->new(days => 3)); |
| 662 |
$resdate=output_pref($resdate); |
| 663 |
AddReserve('CPL', $borrowernumber, $item_bibnum, |
| 664 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
| 665 |
$title, $checkitem, ''); |
| 666 |
MoveReserve( $itemnumber, $borrowernumber ); |
| 667 |
($status)=CheckReserves( $itemnumber, undef, 3 ); |
| 668 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
| 669 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 670 |
|
| 671 |
# we reached the finish |
| 615 |
$dbh->rollback; |
672 |
$dbh->rollback; |
| 616 |
|
673 |
|
| 617 |
sub count_hold_print_messages { |
674 |
sub count_hold_print_messages { |
| 618 |
- |
|
|