|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 92; |
20 |
use Test::More tests => 93; |
| 21 |
|
21 |
|
| 22 |
BEGIN { |
22 |
BEGIN { |
| 23 |
require_ok('C4::Circulation'); |
23 |
require_ok('C4::Circulation'); |
|
Lines 624-629
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 624 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
624 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
| 625 |
}; |
625 |
}; |
| 626 |
|
626 |
|
|
|
627 |
subtest "auto_too_much_oweing | OPACFineNoRenewalsBlockAutoRenew" => sub { |
| 628 |
plan tests => 6; |
| 629 |
my $item_to_auto_renew = $builder->build({ |
| 630 |
source => 'Item', |
| 631 |
value => { |
| 632 |
biblionumber => $biblionumber, |
| 633 |
homebranch => $branch, |
| 634 |
holdingbranch => $branch, |
| 635 |
} |
| 636 |
}); |
| 637 |
|
| 638 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
| 639 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
| 640 |
AddIssue( $renewing_borrower, $item_to_auto_renew->{barcode}, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); |
| 641 |
|
| 642 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 10, no_auto_renewal_after = 11'); |
| 643 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
| 644 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
| 645 |
my $fines_amount = 5; |
| 646 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
| 647 |
( $renewokay, $error ) = |
| 648 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
| 649 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 650 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
| 651 |
|
| 652 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
| 653 |
( $renewokay, $error ) = |
| 654 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
| 655 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 656 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
| 657 |
|
| 658 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
| 659 |
( $renewokay, $error ) = |
| 660 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
| 661 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 662 |
is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' ); |
| 663 |
|
| 664 |
$dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber); |
| 665 |
}; |
| 666 |
|
| 627 |
subtest "GetLatestAutoRenewDate" => sub { |
667 |
subtest "GetLatestAutoRenewDate" => sub { |
| 628 |
plan tests => 5; |
668 |
plan tests => 5; |
| 629 |
my $item_to_auto_renew = $builder->build( |
669 |
my $item_to_auto_renew = $builder->build( |
| 630 |
- |
|
|