|
Lines 498-504
subtest "GetIssuingCharges tests" => sub {
Link Here
|
| 498 |
|
498 |
|
| 499 |
my ( $reused_itemnumber_1, $reused_itemnumber_2 ); |
499 |
my ( $reused_itemnumber_1, $reused_itemnumber_2 ); |
| 500 |
subtest "CanBookBeRenewed tests" => sub { |
500 |
subtest "CanBookBeRenewed tests" => sub { |
| 501 |
plan tests => 116; |
501 |
plan tests => 120; |
| 502 |
|
502 |
|
| 503 |
C4::Context->set_preference( 'ItemsDeniedRenewal', '' ); |
503 |
C4::Context->set_preference( 'ItemsDeniedRenewal', '' ); |
| 504 |
|
504 |
|
|
Lines 1354-1360
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1354 |
); |
1354 |
); |
| 1355 |
C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' ); |
1355 |
C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' ); |
| 1356 |
C4::Context->set_preference( 'FineNoRenewals', '10' ); |
1356 |
C4::Context->set_preference( 'FineNoRenewals', '10' ); |
| 1357 |
C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredit', '1' ); |
1357 |
C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '1' ); |
| 1358 |
my $fines_amount = 5; |
1358 |
my $fines_amount = 5; |
| 1359 |
my $account = Koha::Account->new( { patron_id => $renewing_borrowernumber } ); |
1359 |
my $account = Koha::Account->new( { patron_id => $renewing_borrowernumber } ); |
| 1360 |
$account->add_debit( |
1360 |
$account->add_debit( |
|
Lines 1905-1910
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1905 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
1905 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1906 |
is( $renewokay, 0, 'Cannot renew, too much debt and FineNoRenewals=1' ); |
1906 |
is( $renewokay, 0, 'Cannot renew, too much debt and FineNoRenewals=1' ); |
| 1907 |
is( $error, 'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)' ); |
1907 |
is( $error, 'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)' ); |
|
|
1908 |
|
| 1909 |
# AllowFineOverrideRenewing should not affect CanBookBeRenewed behavior |
| 1910 |
# The preference only controls whether staff can override in the UI |
| 1911 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 1 ); |
| 1912 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1913 |
is( $renewokay, 0, 'Cannot renew, too much debt even with AllowFineOverrideRenewing enabled' ); |
| 1914 |
is( $error, 'too_much_oweing', 'Error code still too_much_oweing with AllowFineOverrideRenewing enabled' ); |
| 1915 |
|
| 1916 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 0 ); |
| 1917 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1918 |
is( $renewokay, 0, 'Cannot renew, too much debt with AllowFineOverrideRenewing disabled' ); |
| 1919 |
is( $error, 'too_much_oweing', 'Error code still too_much_oweing with AllowFineOverrideRenewing disabled' ); |
| 1920 |
|
| 1908 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
1921 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
| 1909 |
}; |
1922 |
}; |
| 1910 |
|
1923 |
|
| 1911 |
- |
|
|