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