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