Lines 680-698
my ( $reused_itemnumber_1, $reused_itemnumber_2 );
Link Here
|
680 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
680 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
681 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
681 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
682 |
my $fines_amount = 5; |
682 |
my $fines_amount = 5; |
683 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
683 |
my $account = Koha::Account->new({patron_id => $renewing_borrowernumber}); |
|
|
684 |
$account->add_debit( |
685 |
{ |
686 |
amount => $fines_amount, |
687 |
type => 'fine', |
688 |
item_id => $item_to_auto_renew->{itemnumber}, |
689 |
description => "Some fines" |
690 |
} |
691 |
)->accounttype->('F')->store; |
684 |
( $renewokay, $error ) = |
692 |
( $renewokay, $error ) = |
685 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
693 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
686 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
694 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
687 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
695 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
688 |
|
696 |
|
689 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
697 |
$account->add_debit( |
|
|
698 |
{ |
699 |
amount => $fines_amount, |
700 |
type => 'fine', |
701 |
item_id => $item_to_auto_renew->{itemnumber}, |
702 |
description => "Some fines" |
703 |
} |
704 |
)->accounttype->('F')->store; |
690 |
( $renewokay, $error ) = |
705 |
( $renewokay, $error ) = |
691 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
706 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
692 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
707 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
693 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
708 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
694 |
|
709 |
|
695 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
710 |
$account->add_debit( |
|
|
711 |
{ |
712 |
amount => $fines_amount, |
713 |
type => 'fine', |
714 |
item_id => $item_to_auto_renew->{itemnumber}, |
715 |
description => "Some fines" |
716 |
} |
717 |
)->accounttype->('F')->store; |
696 |
( $renewokay, $error ) = |
718 |
( $renewokay, $error ) = |
697 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
719 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
698 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
720 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |