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