|
Lines 693-711
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 693 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
693 |
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); |
| 694 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
694 |
C4::Context->set_preference('OPACFineNoRenewals','10'); |
| 695 |
my $fines_amount = 5; |
695 |
my $fines_amount = 5; |
| 696 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
696 |
my $account = Koha::Account->new({patron_id => $renewing_borrowernumber}); |
|
|
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; |
| 697 |
( $renewokay, $error ) = |
705 |
( $renewokay, $error ) = |
| 698 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
706 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
| 699 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
707 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 700 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
708 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); |
| 701 |
|
709 |
|
| 702 |
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; |
| 703 |
( $renewokay, $error ) = |
718 |
( $renewokay, $error ) = |
| 704 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
719 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
| 705 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
720 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 706 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
721 |
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); |
| 707 |
|
722 |
|
| 708 |
C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount ); |
723 |
$account->add_debit( |
|
|
724 |
{ |
| 725 |
amount => $fines_amount, |
| 726 |
type => 'fine', |
| 727 |
item_id => $item_to_auto_renew->{itemnumber}, |
| 728 |
description => "Some fines" |
| 729 |
} |
| 730 |
)->accounttype->('F')->store; |
| 709 |
( $renewokay, $error ) = |
731 |
( $renewokay, $error ) = |
| 710 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
732 |
CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} ); |
| 711 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
733 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |