|
Lines 1324-1330
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1324 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
1324 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
| 1325 |
}; |
1325 |
}; |
| 1326 |
|
1326 |
|
| 1327 |
subtest "auto_too_much_oweing | OPACFineNoRenewalsBlockAutoRenew & OPACFineNoRenewalsIncludeCredits" => sub { |
1327 |
subtest "auto_too_much_owing | OPACFineNoRenewalsBlockAutoRenew & OPACFineNoRenewalsIncludeCredits" => sub { |
| 1328 |
plan tests => 10; |
1328 |
plan tests => 10; |
| 1329 |
my $item_to_auto_renew = $builder->build_sample_item( |
1329 |
my $item_to_auto_renew = $builder->build_sample_item( |
| 1330 |
{ |
1330 |
{ |
|
Lines 1392-1399
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1392 |
} |
1392 |
} |
| 1393 |
)->status('RETURNED')->store; |
1393 |
)->status('RETURNED')->store; |
| 1394 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
1394 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
| 1395 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
1395 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 1396 |
is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' ); |
1396 |
is( $error, 'auto_too_much_owing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' ); |
| 1397 |
|
1397 |
|
| 1398 |
$account->add_credit( |
1398 |
$account->add_credit( |
| 1399 |
{ |
1399 |
{ |
|
Lines 1414-1420
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1414 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
1414 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
| 1415 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
1415 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 1416 |
is( |
1416 |
is( |
| 1417 |
$error, 'auto_too_much_oweing', |
1417 |
$error, 'auto_too_much_owing', |
| 1418 |
'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit' |
1418 |
'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit' |
| 1419 |
); |
1419 |
); |
| 1420 |
|
1420 |
|
|
Lines 1972-1991
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1972 |
# Too much debt |
1972 |
# Too much debt |
| 1973 |
t::lib::Mocks::mock_preference( 'FineNoRenewals', 1 ); |
1973 |
t::lib::Mocks::mock_preference( 'FineNoRenewals', 1 ); |
| 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_owing', 'Cannot renew, debt not allowed (returned code is too_much_owing)' ); |
| 1977 |
|
1977 |
|
| 1978 |
# AllowFineOverrideRenewing should not affect CanBookBeRenewed behavior |
1978 |
# AllowFineOverrideRenewing should not affect CanBookBeRenewed behavior |
| 1979 |
# The preference only controls whether staff can override in the UI |
1979 |
# The preference only controls whether staff can override in the UI |
| 1980 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 1 ); |
1980 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 1 ); |
| 1981 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
1981 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1982 |
is( $renewokay, 0, 'Cannot renew, too much debt even with AllowFineOverrideRenewing enabled' ); |
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' ); |
1983 |
is( $error, 'too_much_owing', 'Error code still too_much_owing with AllowFineOverrideRenewing enabled' ); |
| 1984 |
|
1984 |
|
| 1985 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 0 ); |
1985 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 0 ); |
| 1986 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
1986 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1987 |
is( $renewokay, 0, 'Cannot renew, too much debt with AllowFineOverrideRenewing disabled' ); |
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' ); |
1988 |
is( $error, 'too_much_owing', 'Error code still too_much_owing with AllowFineOverrideRenewing disabled' ); |
| 1989 |
|
1989 |
|
| 1990 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
1990 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
| 1991 |
}; |
1991 |
}; |
| 1992 |
- |
|
|