|
Lines 2337-2343
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {
Link Here
|
| 2337 |
|
2337 |
|
| 2338 |
|
2338 |
|
| 2339 |
subtest 'AddReturn | is_overdue' => sub { |
2339 |
subtest 'AddReturn | is_overdue' => sub { |
| 2340 |
plan tests => 5; |
2340 |
plan tests => 6; |
| 2341 |
|
2341 |
|
| 2342 |
t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'batchmod|moredetail|cronjob|additem|pendingreserves|onpayment'); |
2342 |
t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'batchmod|moredetail|cronjob|additem|pendingreserves|onpayment'); |
| 2343 |
t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1); |
2343 |
t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1); |
|
Lines 2432-2438
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
| 2432 |
AddReturn( $item->{barcode}, $library->{branchcode} ); |
2432 |
AddReturn( $item->{barcode}, $library->{branchcode} ); |
| 2433 |
is( int( $patron->account->balance() ), |
2433 |
is( int( $patron->account->balance() ), |
| 2434 |
17, "Should have a single 10 days overdue fine and lost charge" ); |
2434 |
17, "Should have a single 10 days overdue fine and lost charge" ); |
| 2435 |
} |
2435 |
|
|
|
2436 |
# Cleanup |
| 2437 |
Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; |
| 2438 |
}; |
| 2439 |
|
| 2440 |
subtest 'bug 25417 | backdated return + exemptfine' => sub { |
| 2441 |
|
| 2442 |
plan tests => 6; |
| 2443 |
|
| 2444 |
t::lib::Mocks::mock_preference('CalculateFinesOnBackdate', 1); |
| 2445 |
|
| 2446 |
my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $one_day_ago ); # date due was 1d ago |
| 2447 |
|
| 2448 |
# Fake fines cronjob on this checkout |
| 2449 |
my ($fine) = |
| 2450 |
CalcFine( $item, $patron->categorycode, $library->{branchcode}, |
| 2451 |
$one_day_ago, $now ); |
| 2452 |
UpdateFine( |
| 2453 |
{ |
| 2454 |
issue_id => $issue->issue_id, |
| 2455 |
itemnumber => $item->{itemnumber}, |
| 2456 |
borrowernumber => $patron->borrowernumber, |
| 2457 |
amount => $fine, |
| 2458 |
due => output_pref($one_day_ago) |
| 2459 |
} |
| 2460 |
); |
| 2461 |
is( int( $patron->account->balance() ), |
| 2462 |
1, "Overdue fine of 1 day overdue" ); |
| 2463 |
|
| 2464 |
# Backdated return (dropbox mode example - charge should exist but be zero) |
| 2465 |
AddReturn( $item->{barcode}, $library->{branchcode}, 1, $one_day_ago ); |
| 2466 |
is( int( $patron->account->balance() ), |
| 2467 |
0, "Overdue fine should be annulled" ); |
| 2468 |
my $lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber }); |
| 2469 |
is( $lines->count, 1, "Overdue fine accountlines still exists"); |
| 2470 |
my $line = $lines->next; |
| 2471 |
is($line->amount+0,0, "Overdue fine amount has been reduced to 0"); |
| 2472 |
is($line->amountoutstanding+0,0, "Overdue fine amount outstanding has been reduced to 0"); |
| 2473 |
is($line->status,'RETURNED', "Overdue fine was fixed"); |
| 2474 |
|
| 2475 |
# Cleanup |
| 2476 |
Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; |
| 2477 |
}; |
| 2436 |
}; |
2478 |
}; |
| 2437 |
|
2479 |
|
| 2438 |
subtest '_FixAccountForLostAndFound' => sub { |
2480 |
subtest '_FixAccountForLostAndFound' => sub { |
|
Lines 2891-2898
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
| 2891 |
is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); |
2933 |
is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); |
| 2892 |
is( $credit->amount + 0, -99, "Credit amount is set correctly" ); |
2934 |
is( $credit->amount + 0, -99, "Credit amount is set correctly" ); |
| 2893 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
2935 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
| 2894 |
|
2936 |
|
| 2895 |
# Bug 25417 - Only forgive fines where there is an amount oustanding to forgive |
2937 |
# Bug 25417 - Only forgive fines where there is an amount outstanding to forgive |
| 2896 |
$accountline->set( |
2938 |
$accountline->set( |
| 2897 |
{ |
2939 |
{ |
| 2898 |
debit_type_code => 'OVERDUE', |
2940 |
debit_type_code => 'OVERDUE', |
| 2899 |
- |
|
|