Lines 659-677
my ( $reused_itemnumber_1, $reused_itemnumber_2 );
Link Here
|
659 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
659 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
660 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
660 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
661 |
my $fines_amount = 5; |
661 |
my $fines_amount = 5; |
662 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
662 |
my $account = Koha::Account->new({patron_id => $renewing_borrowernumber}); |
|
|
663 |
$account->add_debit( |
664 |
{ |
665 |
amount => $fines_amount, |
666 |
type => 'fine', |
667 |
item_id => $item_to_auto_renew->{itemnumber}, |
668 |
description => "Some fines" |
669 |
} |
670 |
)->accounttype->('F')->store; |
663 |
( $renewokay, $error ) = |
671 |
( $renewokay, $error ) = |
664 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
672 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
665 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
673 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
666 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
674 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
667 |
|
675 |
|
668 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
676 |
$account->add_debit( |
|
|
677 |
{ |
678 |
amount => $fines_amount, |
679 |
type => 'fine', |
680 |
item_id => $item_to_auto_renew->{itemnumber}, |
681 |
description => "Some fines" |
682 |
} |
683 |
)->accounttype->('F')->store; |
669 |
( $renewokay, $error ) = |
684 |
( $renewokay, $error ) = |
670 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
685 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
671 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
686 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
672 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
687 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
673 |
|
688 |
|
674 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
689 |
$account->add_debit( |
|
|
690 |
{ |
691 |
amount => $fines_amount, |
692 |
type => 'fine', |
693 |
item_id => $item_to_auto_renew->{itemnumber}, |
694 |
description => "Some fines" |
695 |
} |
696 |
)->accounttype->('F')->store; |
675 |
( $renewokay, $error ) = |
697 |
( $renewokay, $error ) = |
676 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
698 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
677 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
699 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |