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 611-616
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
611 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
611 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
612 |
}; |
612 |
}; |
613 |
|
613 |
|
|
|
614 |
subtest "auto_too_much_oweing | OPACFineNoRenewalsBlockAutoRenew" => sub { |
615 |
plan tests => 6; |
616 |
my $item_to_auto_renew = $builder->build({ |
617 |
source => 'Item', |
618 |
value => { |
619 |
biblionumber => $biblionumber, |
620 |
homebranch => $branch, |
621 |
holdingbranch => $branch, |
622 |
} |
623 |
}); |
624 |
|
625 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
626 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
627 |
AddIssue( $renewing_borrower, $item_to_auto_renew->{barcode}, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); |
628 |
|
629 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 10, no_auto_renewal_after = 11'); |
630 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
631 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
632 |
my $fines_amount = 5; |
633 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
634 |
( $renewokay, $error ) = |
635 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
636 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
637 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
638 |
|
639 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
640 |
( $renewokay, $error ) = |
641 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
642 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
643 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
644 |
|
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_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' ); |
650 |
|
651 |
$dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber); |
652 |
}; |
653 |
|
614 |
subtest "GetLatestAutoRenewDate" => sub { |
654 |
subtest "GetLatestAutoRenewDate" => sub { |
615 |
plan tests => 5; |
655 |
plan tests => 5; |
616 |
my $item_to_auto_renew = $builder->build( |
656 |
my $item_to_auto_renew = $builder->build( |
617 |
- |
|
|