|
Lines 497-503
subtest "GetIssuingCharges tests" => sub {
Link Here
|
| 497 |
|
497 |
|
| 498 |
my ( $reused_itemnumber_1, $reused_itemnumber_2 ); |
498 |
my ( $reused_itemnumber_1, $reused_itemnumber_2 ); |
| 499 |
subtest "CanBookBeRenewed tests" => sub { |
499 |
subtest "CanBookBeRenewed tests" => sub { |
| 500 |
plan tests => 117; |
500 |
plan tests => 121; |
| 501 |
|
501 |
|
| 502 |
C4::Context->set_preference( 'ItemsDeniedRenewal', '' ); |
502 |
C4::Context->set_preference( 'ItemsDeniedRenewal', '' ); |
| 503 |
|
503 |
|
|
Lines 1353-1359
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1353 |
); |
1353 |
); |
| 1354 |
C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' ); |
1354 |
C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' ); |
| 1355 |
C4::Context->set_preference( 'FineNoRenewals', '10' ); |
1355 |
C4::Context->set_preference( 'FineNoRenewals', '10' ); |
| 1356 |
C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredit', '1' ); |
1356 |
C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '1' ); |
| 1357 |
my $fines_amount = 5; |
1357 |
my $fines_amount = 5; |
| 1358 |
my $account = Koha::Account->new( { patron_id => $renewing_borrowernumber } ); |
1358 |
my $account = Koha::Account->new( { patron_id => $renewing_borrowernumber } ); |
| 1359 |
$account->add_debit( |
1359 |
$account->add_debit( |
|
Lines 1974-1979
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1974 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
1974 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1975 |
is( $renewokay, 0, 'Cannot renew, too much debt and FineNoRenewals=1' ); |
1975 |
is( $renewokay, 0, 'Cannot renew, too much debt and FineNoRenewals=1' ); |
| 1976 |
is( $error, 'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)' ); |
1976 |
is( $error, 'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)' ); |
|
|
1977 |
|
| 1978 |
# AllowFineOverrideRenewing should not affect CanBookBeRenewed behavior |
| 1979 |
# The preference only controls whether staff can override in the UI |
| 1980 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 1 ); |
| 1981 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1982 |
is( $renewokay, 0, 'Cannot renew, too much debt even with AllowFineOverrideRenewing enabled' ); |
| 1983 |
is( $error, 'too_much_oweing', 'Error code still too_much_oweing with AllowFineOverrideRenewing enabled' ); |
| 1984 |
|
| 1985 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 0 ); |
| 1986 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1987 |
is( $renewokay, 0, 'Cannot renew, too much debt with AllowFineOverrideRenewing disabled' ); |
| 1988 |
is( $error, 'too_much_oweing', 'Error code still too_much_oweing with AllowFineOverrideRenewing disabled' ); |
| 1989 |
|
| 1977 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
1990 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
| 1978 |
}; |
1991 |
}; |
| 1979 |
|
1992 |
|
| 1980 |
- |
|
|