View | Details | Raw Unified | Return to bug 22521
Collapse All | Expand All

(-)a/C4/Circulation.pm (-3 / +4 lines)
Lines 2329-2335 sub _FixOverduesOnReturn { Link Here
2329
        {
2329
        {
2330
            borrowernumber => $borrowernumber,
2330
            borrowernumber => $borrowernumber,
2331
            itemnumber     => $item,
2331
            itemnumber     => $item,
2332
            accounttype    => 'FU'
2332
            accounttype    => 'OVERDUE',
2333
            status         => 'UNRETURNED'
2333
        }
2334
        }
2334
    )->next();
2335
    )->next();
2335
    return 0 unless $accountline;    # no warning, there's just nothing to fix
2336
    return 0 unless $accountline;    # no warning, there's just nothing to fix
Lines 2337-2343 sub _FixOverduesOnReturn { Link Here
2337
    if ($exemptfine) {
2338
    if ($exemptfine) {
2338
        my $amountoutstanding = $accountline->amountoutstanding;
2339
        my $amountoutstanding = $accountline->amountoutstanding;
2339
2340
2340
        $accountline->accounttype('FFOR');
2341
        $accountline->status('FORGIVEN');
2341
        $accountline->amountoutstanding(0);
2342
        $accountline->amountoutstanding(0);
2342
2343
2343
        Koha::Account::Offset->new(
2344
        Koha::Account::Offset->new(
Lines 2352-2358 sub _FixOverduesOnReturn { Link Here
2352
            &logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item");
2353
            &logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item");
2353
        }
2354
        }
2354
    } else {
2355
    } else {
2355
        $accountline->accounttype('F');
2356
        $accountline->status('RETURNED');
2356
    }
2357
    }
2357
2358
2358
    return $accountline->store();
2359
    return $accountline->store();
(-)a/C4/Overdues.pm (-32 / +19 lines)
Lines 520-565 sub UpdateFine { Link Here
520
    }
520
    }
521
521
522
    my $dbh = C4::Context->dbh;
522
    my $dbh = C4::Context->dbh;
523
    # FIXME - What exactly is this query supposed to do? It looks up an
523
    my $overdues = Koha::Account::Lines->search(
524
    # entry in accountlines that matches the given item and borrower
524
        {
525
    # numbers, where the description contains $due, and where the
525
            borrowernumber    => $borrowernumber,
526
    # account type has one of several values, but what does this _mean_?
526
            accounttype       => [ 'OVERDUE', 'M' ],
527
    # Does it look up existing fines for this item?
527
            amountoutstanding => { '<>' => 0 }
528
    # FIXME - What are these various account types? ("FU", "O", "F", "M")
528
        }
529
    #   "L"   is LOST item
530
    #   "A"   is Account Management Fee
531
    #   "N"   is New Card
532
    #   "M"   is Sundry
533
    #   "F"   is Fine ??
534
    #   "FU"  is Fine UPDATE??
535
    #   "Pay" is Payment
536
    #   "REF" is Cash Refund
537
    my $sth = $dbh->prepare(
538
        "SELECT * FROM accountlines
539
        WHERE borrowernumber=? AND
540
        (( accounttype IN ('F','M') AND amountoutstanding<>0 ) OR
541
           accounttype = 'FU' )"
542
    );
529
    );
543
    $sth->execute( $borrowernumber );
530
544
    my $data;
531
    my $accountline;
545
    my $total_amount_other = 0.00;
532
    my $total_amount_other = 0.00;
546
    my $due_qr = qr/$due/;
533
    my $due_qr = qr/$due/;
547
    # Cycle through the fines and
534
    # Cycle through the fines and
548
    # - find line that relates to the requested $itemnum
535
    # - find line that relates to the requested $itemnum
549
    # - accumulate fines for other items
536
    # - accumulate fines for other items
550
    # so we can update $itemnum fine taking in account fine caps
537
    # so we can update $itemnum fine taking in account fine caps
551
    while (my $rec = $sth->fetchrow_hashref) {
538
    while (my $overdue = $overdues->next) {
552
        if ( $rec->{issue_id} == $issue_id && $rec->{accounttype} eq 'FU' ) {
539
        if ( $overdue->issue_id == $issue_id && $overdue->status eq 'UNRETURNED' ) {
553
            if ($data) {
540
            if ($accountline) {
554
                warn "Not a unique accountlines record for issue_id $issue_id";
541
                warn "Not a unique accountlines record for issue_id $issue_id";
555
                #FIXME Should we still count this one in total_amount ??
542
                #FIXME Should we still count this one in total_amount ??
556
            }
543
            }
557
            else {
544
            else {
558
                $data = $rec;
545
                $accountline = $overdue;
559
                next;
546
                next;
560
            }
547
            }
561
        }
548
        }
562
        $total_amount_other += $rec->{'amountoutstanding'};
549
        $total_amount_other += $overdue->amountoutstanding;
563
    }
550
    }
564
551
565
    if (my $maxfine = C4::Context->preference('MaxFine')) {
552
    if (my $maxfine = C4::Context->preference('MaxFine')) {
Lines 571-580 sub UpdateFine { Link Here
571
        }
558
        }
572
    }
559
    }
573
560
574
    if ( $data ) {
561
575
        if ( $data->{'amount'} != $amount ) {
562
    if ( $accountline ) {
576
            my $accountline =
563
        if ( $accountline->amount != $amount ) {
577
              Koha::Account::Lines->find( $data->{accountlines_id} );
578
            $accountline->adjust(
564
            $accountline->adjust(
579
                {
565
                {
580
                    amount    => $amount,
566
                    amount    => $amount,
Lines 593-599 sub UpdateFine { Link Here
593
            my $desc = "$title $due";
579
            my $desc = "$title $due";
594
580
595
            my $account = Koha::Account->new({ patron_id => $borrowernumber });
581
            my $account = Koha::Account->new({ patron_id => $borrowernumber });
596
            my $accountline = $account->add_debit(
582
            $accountline = $account->add_debit(
597
                {
583
                {
598
                    amount      => $amount,
584
                    amount      => $amount,
599
                    description => $desc,
585
                    description => $desc,
Lines 738-744 sub GetOverduesForBranch { Link Here
738
    LEFT JOIN itemtypes   ON itemtypes.itemtype       = $itype_link
724
    LEFT JOIN itemtypes   ON itemtypes.itemtype       = $itype_link
739
    LEFT JOIN branches    ON  branches.branchcode     = issues.branchcode
725
    LEFT JOIN branches    ON  branches.branchcode     = issues.branchcode
740
    WHERE (accountlines.amountoutstanding  != '0.000000')
726
    WHERE (accountlines.amountoutstanding  != '0.000000')
741
      AND (accountlines.accounttype         = 'FU'      )
727
      AND (accountlines.accounttype         = 'OVERDUE' )
728
      AND (accountlines.status              = 'UNRETURNED' )
742
      AND (issues.branchcode =  ?   )
729
      AND (issues.branchcode =  ?   )
743
      AND (issues.date_due  < NOW())
730
      AND (issues.date_due  < NOW())
744
    ";
731
    ";
(-)a/Koha/Account.pm (-3 / +4 lines)
Lines 425-431 my $debit_line = Koha::Account->new({ patron_id => $patron_id })->add_debit( Link Here
425
);
425
);
426
426
427
$debit_type can be any of:
427
$debit_type can be any of:
428
  - fine
428
  - overdue
429
  - lost_item
429
  - lost_item
430
  - new_card
430
  - new_card
431
  - account
431
  - account
Lines 495-500 sub add_debit { Link Here
495
                    itemnumber        => $item_id,
495
                    itemnumber        => $item_id,
496
                    issue_id          => $issue_id,
496
                    issue_id          => $issue_id,
497
                    branchcode        => $library_id,
497
                    branchcode        => $library_id,
498
                    ( $type eq 'overdue' ? ( status => 'UNRETURNED' ) : ()),
498
                }
499
                }
499
            )->store();
500
            )->store();
500
501
Lines 696-702 our $offset_type = { Link Here
696
    'processing'       => 'Processing Fee',
697
    'processing'       => 'Processing Fee',
697
    'lost_item'        => 'Lost Item',
698
    'lost_item'        => 'Lost Item',
698
    'rent'             => 'Rental Fee',
699
    'rent'             => 'Rental Fee',
699
    'fine'             => 'Fine',
700
    'overdue'          => 'OVERDUE',
700
    'manual_debit'     => 'Manual Debit',
701
    'manual_debit'     => 'Manual Debit',
701
    'hold_expired'     => 'Hold Expired'
702
    'hold_expired'     => 'Hold Expired'
702
};
703
};
Lines 719-725 our $account_type_credit = { Link Here
719
720
720
our $account_type_debit = {
721
our $account_type_debit = {
721
    'account'       => 'A',
722
    'account'       => 'A',
722
    'fine'          => 'FU',
723
    'overdue'       => 'OVERDUE',
723
    'lost_item'     => 'L',
724
    'lost_item'     => 'L',
724
    'new_card'      => 'N',
725
    'new_card'      => 'N',
725
    'sundry'        => 'M',
726
    'sundry'        => 'M',
(-)a/Koha/Account/Line.pm (-9 / +19 lines)
Lines 236-242 This method allows updating a debit or credit on a patron's account Link Here
236
    );
236
    );
237
237
238
$update_type can be any of:
238
$update_type can be any of:
239
  - fine_update
239
  - overdue_update
240
240
241
Authors Note: The intention here is that this method is only used
241
Authors Note: The intention here is that this method is only used
242
to adjust accountlines where the final amount is not yet known/fixed.
242
to adjust accountlines where the final amount is not yet known/fixed.
Lines 259-269 sub adjust { Link Here
259
        );
259
        );
260
    }
260
    }
261
261
262
    my $account_type = $self->accounttype;
262
    my $account_type   = $self->accounttype;
263
    unless ( $Koha::Account::Line::allowed_update->{$update_type} eq $account_type ) {
263
    my $account_status = $self->status;
264
    unless (
265
        (
266
            exists(
267
                $Koha::Account::Line::allowed_update->{$update_type}
268
                  ->{$account_type}
269
            )
270
            && ( $Koha::Account::Line::allowed_update->{$update_type}
271
                ->{$account_type} eq $account_status )
272
        )
273
      )
274
    {
264
        Koha::Exceptions::Account::UnrecognisedType->throw(
275
        Koha::Exceptions::Account::UnrecognisedType->throw(
265
            error => 'Update type not allowed on this accounttype'
276
            error => 'Update type not allowed on this accounttype' );
266
        );
267
    }
277
    }
268
278
269
    my $schema = Koha::Database->new->schema;
279
    my $schema = Koha::Database->new->schema;
Lines 289-295 sub adjust { Link Here
289
                        description => 'Overpayment refund',
299
                        description => 'Overpayment refund',
290
                        type        => 'credit',
300
                        type        => 'credit',
291
                        interface   => $interface,
301
                        interface   => $interface,
292
                        ( $update_type eq 'fine_update' ? ( item_id => $self->itemnumber ) : ()),
302
                        ( $update_type eq 'overdue_update' ? ( item_id => $self->itemnumber ) : ()),
293
                    }
303
                    }
294
                );
304
                );
295
                $new_outstanding = 0;
305
                $new_outstanding = 0;
Lines 300-306 sub adjust { Link Here
300
                {
310
                {
301
                    date              => \'NOW()',
311
                    date              => \'NOW()',
302
                    amount            => $amount,
312
                    amount            => $amount,
303
                    amountoutstanding => $new_outstanding
313
                    amountoutstanding => $new_outstanding,
304
                }
314
                }
305
            )->store();
315
            )->store();
306
316
Lines 329-335 sub adjust { Link Here
329
                            manager_id        => undef,
339
                            manager_id        => undef,
330
                        }
340
                        }
331
                    )
341
                    )
332
                ) if ( $update_type eq 'fine_update' );
342
                ) if ( $update_type eq 'overdue_update' );
333
            }
343
            }
334
        }
344
        }
335
    );
345
    );
Lines 381-387 sub _type { Link Here
381
391
382
=cut
392
=cut
383
393
384
our $allowed_update = { 'fine_update' => 'FU', };
394
our $allowed_update = { 'overdue_update' => { 'OVERDUE' => 'UNRETURNED' } };
385
395
386
=head1 AUTHORS
396
=head1 AUTHORS
387
397
(-)a/circ/branchoverdues.pl (-2 / +4 lines)
Lines 31-38 use Data::Dumper; Link Here
31
31
32
=head1 branchoverdues.pl
32
=head1 branchoverdues.pl
33
33
34
 this module is a new interface, allow to the librarian to check all items on overdues (based on the acountlines type 'FU' )
34
This view is used to display all overdue items to the librarian.
35
 this interface is filtered by branches (automatically), and by location (optional) ....
35
36
It is automatically filtered by branch and can optionally be filtered
37
by item location.
36
38
37
=cut
39
=cut
38
40
(-)a/misc/cronjobs/staticfines.pl (-2 / +2 lines)
Lines 229-236 for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { Link Here
229
229
230
            my $desc        = "staticfine";
230
            my $desc        = "staticfine";
231
            my $query       = "INSERT INTO accountlines
231
            my $query       = "INSERT INTO accountlines
232
                        (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding)
232
                        (borrowernumber,itemnumber,date,amount,description,accounttype,status,amountoutstanding)
233
                                VALUES (?,?,now(),?,?,'F',?)";
233
                                VALUES (?,?,now(),?,?,'OVERDUE','RETURNED',?)";
234
            my $sth2 = $dbh->prepare($query);
234
            my $sth2 = $dbh->prepare($query);
235
            $bigdebug and warn "query: $query\nw/ args: $borrowernumber, $itemnumber, $amount, $desc, $amount\n";
235
            $bigdebug and warn "query: $query\nw/ args: $borrowernumber, $itemnumber, $amount, $desc, $amount\n";
236
            $sth2->execute( $borrowernumber, $itemnumber, $amount, $desc, $amount );
236
            $sth2->execute( $borrowernumber, $itemnumber, $amount, $desc, $amount );
(-)a/opac/opac-user.pl (-1 / +1 lines)
Lines 196-202 if ( $pending_checkouts->count ) { # Useless test Link Here
196
            {
196
            {
197
                borrowernumber    => $patron->borrowernumber,
197
                borrowernumber    => $patron->borrowernumber,
198
                amountoutstanding => { '>' => 0 },
198
                amountoutstanding => { '>' => 0 },
199
                accounttype       => [ 'F', 'FU', 'L' ],
199
                accounttype       => [ 'F', 'L' ],
200
                itemnumber        => $issue->{itemnumber}
200
                itemnumber        => $issue->{itemnumber}
201
            },
201
            },
202
        );
202
        );
(-)a/t/db_dependent/Circulation.t (-13 / +17 lines)
Lines 502-509 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
502
502
503
    my $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } );
503
    my $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } );
504
    is( $fines->count, 2 );
504
    is( $fines->count, 2 );
505
    is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' );
505
    isnt( $fines->next->status, 'UNRETURNED', 'Fine on renewed item is closed out properly' );
506
    is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' );
506
    isnt( $fines->next->status, 'UNRETURNED', 'Fine on renewed item is closed out properly' );
507
    $fines->delete();
507
    $fines->delete();
508
508
509
509
Lines 689-695 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
689
                item_id     => $item_to_auto_renew->{itemnumber},
689
                item_id     => $item_to_auto_renew->{itemnumber},
690
                description => "Some fines"
690
                description => "Some fines"
691
            }
691
            }
692
        )->accounttype('F')->store;
692
        )->status('RETURNED')->store;
693
        ( $renewokay, $error ) =
693
        ( $renewokay, $error ) =
694
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
694
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
695
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
695
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
Lines 703-709 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
703
                item_id     => $item_to_auto_renew->{itemnumber},
703
                item_id     => $item_to_auto_renew->{itemnumber},
704
                description => "Some fines"
704
                description => "Some fines"
705
            }
705
            }
706
        )->accounttype('F')->store;
706
        )->status('RETURNED')->store;
707
        ( $renewokay, $error ) =
707
        ( $renewokay, $error ) =
708
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
708
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
709
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
709
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
Lines 717-723 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
717
                item_id     => $item_to_auto_renew->{itemnumber},
717
                item_id     => $item_to_auto_renew->{itemnumber},
718
                description => "Some fines"
718
                description => "Some fines"
719
            }
719
            }
720
        )->accounttype('F')->store;
720
        )->status('RETURNED')->store;
721
        ( $renewokay, $error ) =
721
        ( $renewokay, $error ) =
722
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
722
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
723
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
723
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
Lines 851-857 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
851
    );
851
    );
852
852
853
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
853
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
854
    is( $line->accounttype, 'FU', 'Account line type is FU' );
854
    is( $line->accounttype, 'OVERDUE', 'Account line type is OVERDUE' );
855
    is( $line->status, 'UNRETURNED', 'Account line status is UNRETURNED' );
855
    is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
856
    is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
856
    is( $line->amount, '15.000000', 'Account line amount is 15.00' );
857
    is( $line->amount, '15.000000', 'Account line amount is 15.00' );
857
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
858
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
Lines 866-872 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
866
    LostItem( $item_1->itemnumber, 'test', 1 );
867
    LostItem( $item_1->itemnumber, 'test', 1 );
867
868
868
    $line = Koha::Account::Lines->find($line->id);
869
    $line = Koha::Account::Lines->find($line->id);
869
    is( $line->accounttype, 'F', 'Account type correctly changed from FU to F' );
870
    is( $line->accounttype, 'OVERDUE', 'Account type remains as OVERDUE' );
871
    isnt( $line->status, 'UNRETURNED', 'Account status correctly changed from UNRETURNED to RETURNED' );
870
872
871
    my $item = Koha::Items->find($item_1->itemnumber);
873
    my $item = Koha::Items->find($item_1->itemnumber);
872
    ok( !$item->onloan(), "Lost item marked as returned has false onloan value" );
874
    ok( !$item->onloan(), "Lost item marked as returned has false onloan value" );
Lines 1975-1981 subtest 'AddReturn | is_overdue' => sub { Link Here
1975
    # specify dropbox date 5 days later => overdue, or... not
1977
    # specify dropbox date 5 days later => overdue, or... not
1976
    AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago
1978
    AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago
1977
    AddReturn( $item->{barcode}, $library->{branchcode}, $five_days_ago );
1979
    AddReturn( $item->{barcode}, $library->{branchcode}, $five_days_ago );
1978
    is( int($patron->account->balance()), 0, 'AddReturn: pass return_date => no overdue in dropbox mode' ); # FIXME? This is weird, the FU fine is created ( _CalculateAndUpdateFine > C4::Overdues::UpdateFine ) then remove later (in _FixOverduesOnReturn). Looks like it is a feature
1980
    is( int($patron->account->balance()), 0, 'AddReturn: pass return_date => no overdue in dropbox mode' ); # FIXME? This is weird, the OVERDUE fine is created ( _CalculateAndUpdateFine > C4::Overdues::UpdateFine ) then remove later (in _FixOverduesOnReturn). Looks like it is a feature
1979
    Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete;
1981
    Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete;
1980
};
1982
};
1981
1983
Lines 2357-2363 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2357
2359
2358
        is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PF - payment (CR)' );
2360
        is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PF - payment (CR)' );
2359
2361
2360
        my $manual_debit = Koha::Account::Lines->search({ borrowernumber => $patron->id, accounttype => 'FU' })->next;
2362
        my $manual_debit = Koha::Account::Lines->search({ borrowernumber => $patron->id, accounttype => 'OVERDUE', status => 'UNRETURNED' })->next;
2361
        is( $manual_debit->amountoutstanding + 0, $manual_debit_amount - $payment_amount, 'reconcile_balance was called' );
2363
        is( $manual_debit->amountoutstanding + 0, $manual_debit_amount - $payment_amount, 'reconcile_balance was called' );
2362
    };
2364
    };
2363
};
2365
};
Lines 2384-2390 subtest '_FixOverduesOnReturn' => sub { Link Here
2384
    my $accountline = Koha::Account::Line->new(
2386
    my $accountline = Koha::Account::Line->new(
2385
        {
2387
        {
2386
            borrowernumber => $patron->{borrowernumber},
2388
            borrowernumber => $patron->{borrowernumber},
2387
            accounttype    => 'FU',
2389
            accounttype    => 'OVERDUE',
2390
            status         => 'UNRETURNED',
2388
            itemnumber     => $item->itemnumber,
2391
            itemnumber     => $item->itemnumber,
2389
            amount => 99.00,
2392
            amount => 99.00,
2390
            amountoutstanding => 99.00,
2393
            amountoutstanding => 99.00,
Lines 2397-2409 subtest '_FixOverduesOnReturn' => sub { Link Here
2397
    $accountline->_result()->discard_changes();
2400
    $accountline->_result()->discard_changes();
2398
2401
2399
    is( $accountline->amountoutstanding, '99.000000', 'Fine has the same amount outstanding as previously' );
2402
    is( $accountline->amountoutstanding, '99.000000', 'Fine has the same amount outstanding as previously' );
2400
    is( $accountline->accounttype, 'F', 'Open fine ( account type FU ) has been closed out ( account type F )');
2403
    is( $accountline->status, 'RETURNED', 'Open fine ( account type OVERDUE ) has been closed out ( status RETURNED )');
2401
2404
2402
2405
2403
    ## Run again, with exemptfine enabled
2406
    ## Run again, with exemptfine enabled
2404
    $accountline->set(
2407
    $accountline->set(
2405
        {
2408
        {
2406
            accounttype    => 'FU',
2409
            accounttype    => 'OVERDUE',
2410
            status         => 'UNRETURNED',
2407
            amountoutstanding => 99.00,
2411
            amountoutstanding => 99.00,
2408
        }
2412
        }
2409
    )->store();
2413
    )->store();
Lines 2414-2420 subtest '_FixOverduesOnReturn' => sub { Link Here
2414
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next();
2418
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next();
2415
2419
2416
    is( $accountline->amountoutstanding + 0, 0, 'Fine has been reduced to 0' );
2420
    is( $accountline->amountoutstanding + 0, 0, 'Fine has been reduced to 0' );
2417
    is( $accountline->accounttype, 'FFOR', 'Open fine ( account type FU ) has been set to fine forgiven ( account type FFOR )');
2421
    is( $accountline->status, 'FORGIVEN', 'Open fine ( account type OVERDUE ) has been set to fine forgiven ( status FORGIVEN )');
2418
    is( ref $offset, "Koha::Account::Offset", "Found matching offset for fine reduction via forgiveness" );
2422
    is( ref $offset, "Koha::Account::Offset", "Found matching offset for fine reduction via forgiveness" );
2419
    is( $offset->amount, '-99.000000', "Amount of offset is correct" );
2423
    is( $offset->amount, '-99.000000', "Amount of offset is correct" );
2420
};
2424
};
(-)a/t/db_dependent/Overdues.t (-2 / +1 lines)
Lines 251-257 subtest 'UpdateFine tests' => sub { Link Here
251
    is( $fine2->amount, '30.000000', "Second fine increased after partial payment of first" );
251
    is( $fine2->amount, '30.000000', "Second fine increased after partial payment of first" );
252
252
253
    # Fix fine 1, create third fine
253
    # Fix fine 1, create third fine
254
    $fine->accounttype('F')->store;
254
    $fine->status('RETURNED')->store;
255
    UpdateFine(
255
    UpdateFine(
256
        {
256
        {
257
            issue_id       => $checkout1->issue_id,
257
            issue_id       => $checkout1->issue_id,
258
- 

Return to bug 22521