|
Lines 1325-1331
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1325 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
1325 |
is( $error, 'auto_renew', 'Cannot renew, renew is automatic' ); |
| 1326 |
}; |
1326 |
}; |
| 1327 |
|
1327 |
|
| 1328 |
subtest "auto_too_much_oweing | OPACFineNoRenewalsBlockAutoRenew & OPACFineNoRenewalsIncludeCredits" => sub { |
1328 |
subtest "auto_too_much_owing | OPACFineNoRenewalsBlockAutoRenew & OPACFineNoRenewalsIncludeCredits" => sub { |
| 1329 |
plan tests => 10; |
1329 |
plan tests => 10; |
| 1330 |
my $item_to_auto_renew = $builder->build_sample_item( |
1330 |
my $item_to_auto_renew = $builder->build_sample_item( |
| 1331 |
{ |
1331 |
{ |
|
Lines 1393-1400
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1393 |
} |
1393 |
} |
| 1394 |
)->status('RETURNED')->store; |
1394 |
)->status('RETURNED')->store; |
| 1395 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
1395 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
| 1396 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
1396 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 1397 |
is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' ); |
1397 |
is( $error, 'auto_too_much_owing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' ); |
| 1398 |
|
1398 |
|
| 1399 |
$account->add_credit( |
1399 |
$account->add_credit( |
| 1400 |
{ |
1400 |
{ |
|
Lines 1415-1421
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1415 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
1415 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); |
| 1416 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
1416 |
is( $renewokay, 0, 'Do not renew, renewal is automatic' ); |
| 1417 |
is( |
1417 |
is( |
| 1418 |
$error, 'auto_too_much_oweing', |
1418 |
$error, 'auto_too_much_owing', |
| 1419 |
'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit' |
1419 |
'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit' |
| 1420 |
); |
1420 |
); |
| 1421 |
|
1421 |
|
|
Lines 1903-1922
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 1903 |
# Too much debt |
1903 |
# Too much debt |
| 1904 |
t::lib::Mocks::mock_preference( 'FineNoRenewals', 1 ); |
1904 |
t::lib::Mocks::mock_preference( 'FineNoRenewals', 1 ); |
| 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_owing', 'Cannot renew, debt not allowed (returned code is too_much_owing)' ); |
| 1908 |
|
1908 |
|
| 1909 |
# AllowFineOverrideRenewing should not affect CanBookBeRenewed behavior |
1909 |
# AllowFineOverrideRenewing should not affect CanBookBeRenewed behavior |
| 1910 |
# The preference only controls whether staff can override in the UI |
1910 |
# The preference only controls whether staff can override in the UI |
| 1911 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 1 ); |
1911 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 1 ); |
| 1912 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
1912 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1913 |
is( $renewokay, 0, 'Cannot renew, too much debt even with AllowFineOverrideRenewing enabled' ); |
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' ); |
1914 |
is( $error, 'too_much_owing', 'Error code still too_much_owing with AllowFineOverrideRenewing enabled' ); |
| 1915 |
|
1915 |
|
| 1916 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 0 ); |
1916 |
t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 0 ); |
| 1917 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
1917 |
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 ); |
| 1918 |
is( $renewokay, 0, 'Cannot renew, too much debt with AllowFineOverrideRenewing disabled' ); |
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' ); |
1919 |
is( $error, 'too_much_owing', 'Error code still too_much_owing with AllowFineOverrideRenewing disabled' ); |
| 1920 |
|
1920 |
|
| 1921 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
1921 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
| 1922 |
}; |
1922 |
}; |
| 1923 |
- |
|
|