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
                $debug and warn "Not a unique accountlines record for issue_id $issue_id";
541
                $debug and 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 185-191 if ( $pending_checkouts->count ) { # Useless test Link Here
185
            {
185
            {
186
                borrowernumber    => $patron->borrowernumber,
186
                borrowernumber    => $patron->borrowernumber,
187
                amountoutstanding => { '>' => 0 },
187
                amountoutstanding => { '>' => 0 },
188
                accounttype       => [ 'F', 'FU', 'L' ],
188
                accounttype       => [ 'F', 'L' ],
189
                itemnumber        => $issue->{itemnumber}
189
                itemnumber        => $issue->{itemnumber}
190
            },
190
            },
191
        );
191
        );
(-)a/t/db_dependent/Circulation.t (-13 / +17 lines)
Lines 507-514 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
507
507
508
    my $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } );
508
    my $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } );
509
    is( $fines->count, 2 );
509
    is( $fines->count, 2 );
510
    is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' );
510
    isnt( $fines->next->status, 'UNRETURNED', 'Fine on renewed item is closed out properly' );
511
    is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' );
511
    isnt( $fines->next->status, 'UNRETURNED', 'Fine on renewed item is closed out properly' );
512
    $fines->delete();
512
    $fines->delete();
513
513
514
514
Lines 694-700 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
694
                item_id     => $item_to_auto_renew->{itemnumber},
694
                item_id     => $item_to_auto_renew->{itemnumber},
695
                description => "Some fines"
695
                description => "Some fines"
696
            }
696
            }
697
        )->accounttype('F')->store;
697
        )->status('RETURNED')->store;
698
        ( $renewokay, $error ) =
698
        ( $renewokay, $error ) =
699
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
699
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
700
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
700
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
Lines 708-714 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
708
                item_id     => $item_to_auto_renew->{itemnumber},
708
                item_id     => $item_to_auto_renew->{itemnumber},
709
                description => "Some fines"
709
                description => "Some fines"
710
            }
710
            }
711
        )->accounttype('F')->store;
711
        )->status('RETURNED')->store;
712
        ( $renewokay, $error ) =
712
        ( $renewokay, $error ) =
713
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
713
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
714
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
714
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
Lines 722-728 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
722
                item_id     => $item_to_auto_renew->{itemnumber},
722
                item_id     => $item_to_auto_renew->{itemnumber},
723
                description => "Some fines"
723
                description => "Some fines"
724
            }
724
            }
725
        )->accounttype('F')->store;
725
        )->status('RETURNED')->store;
726
        ( $renewokay, $error ) =
726
        ( $renewokay, $error ) =
727
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
727
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
728
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
728
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
Lines 856-862 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
856
    );
856
    );
857
857
858
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
858
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
859
    is( $line->accounttype, 'FU', 'Account line type is FU' );
859
    is( $line->accounttype, 'OVERDUE', 'Account line type is OVERDUE' );
860
    is( $line->status, 'UNRETURNED', 'Account line status is UNRETURNED' );
860
    is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
861
    is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
861
    is( $line->amount, '15.000000', 'Account line amount is 15.00' );
862
    is( $line->amount, '15.000000', 'Account line amount is 15.00' );
862
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
863
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
Lines 871-877 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
871
    LostItem( $item_1->itemnumber, 'test', 1 );
872
    LostItem( $item_1->itemnumber, 'test', 1 );
872
873
873
    $line = Koha::Account::Lines->find($line->id);
874
    $line = Koha::Account::Lines->find($line->id);
874
    is( $line->accounttype, 'F', 'Account type correctly changed from FU to F' );
875
    is( $line->accounttype, 'OVERDUE', 'Account type remains as OVERDUE' );
876
    isnt( $line->status, 'UNRETURNED', 'Account status correctly changed from UNRETURNED to RETURNED' );
875
877
876
    my $item = Koha::Items->find($item_1->itemnumber);
878
    my $item = Koha::Items->find($item_1->itemnumber);
877
    ok( !$item->onloan(), "Lost item marked as returned has false onloan value" );
879
    ok( !$item->onloan(), "Lost item marked as returned has false onloan value" );
Lines 1988-1994 subtest 'AddReturn | is_overdue' => sub { Link Here
1988
    # specify dropbox date 5 days later => overdue, or... not
1990
    # specify dropbox date 5 days later => overdue, or... not
1989
    AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago
1991
    AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago
1990
    AddReturn( $item->{barcode}, $library->{branchcode}, $five_days_ago );
1992
    AddReturn( $item->{barcode}, $library->{branchcode}, $five_days_ago );
1991
    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
1993
    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
1992
    Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete;
1994
    Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete;
1993
};
1995
};
1994
1996
Lines 2370-2376 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2370
2372
2371
        is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PF - payment (CR)' );
2373
        is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PF - payment (CR)' );
2372
2374
2373
        my $manual_debit = Koha::Account::Lines->search({ borrowernumber => $patron->id, accounttype => 'FU' })->next;
2375
        my $manual_debit = Koha::Account::Lines->search({ borrowernumber => $patron->id, accounttype => 'OVERDUE', status => 'UNRETURNED' })->next;
2374
        is( $manual_debit->amountoutstanding + 0, $manual_debit_amount - $payment_amount, 'reconcile_balance was called' );
2376
        is( $manual_debit->amountoutstanding + 0, $manual_debit_amount - $payment_amount, 'reconcile_balance was called' );
2375
    };
2377
    };
2376
};
2378
};
Lines 2397-2403 subtest '_FixOverduesOnReturn' => sub { Link Here
2397
    my $accountline = Koha::Account::Line->new(
2399
    my $accountline = Koha::Account::Line->new(
2398
        {
2400
        {
2399
            borrowernumber => $patron->{borrowernumber},
2401
            borrowernumber => $patron->{borrowernumber},
2400
            accounttype    => 'FU',
2402
            accounttype    => 'OVERDUE',
2403
            status         => 'UNRETURNED',
2401
            itemnumber     => $item->itemnumber,
2404
            itemnumber     => $item->itemnumber,
2402
            amount => 99.00,
2405
            amount => 99.00,
2403
            amountoutstanding => 99.00,
2406
            amountoutstanding => 99.00,
Lines 2410-2422 subtest '_FixOverduesOnReturn' => sub { Link Here
2410
    $accountline->_result()->discard_changes();
2413
    $accountline->_result()->discard_changes();
2411
2414
2412
    is( $accountline->amountoutstanding, '99.000000', 'Fine has the same amount outstanding as previously' );
2415
    is( $accountline->amountoutstanding, '99.000000', 'Fine has the same amount outstanding as previously' );
2413
    is( $accountline->accounttype, 'F', 'Open fine ( account type FU ) has been closed out ( account type F )');
2416
    is( $accountline->status, 'RETURNED', 'Open fine ( account type OVERDUE ) has been closed out ( status RETURNED )');
2414
2417
2415
2418
2416
    ## Run again, with exemptfine enabled
2419
    ## Run again, with exemptfine enabled
2417
    $accountline->set(
2420
    $accountline->set(
2418
        {
2421
        {
2419
            accounttype    => 'FU',
2422
            accounttype    => 'OVERDUE',
2423
            status         => 'UNRETURNED',
2420
            amountoutstanding => 99.00,
2424
            amountoutstanding => 99.00,
2421
        }
2425
        }
2422
    )->store();
2426
    )->store();
Lines 2427-2433 subtest '_FixOverduesOnReturn' => sub { Link Here
2427
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next();
2431
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next();
2428
2432
2429
    is( $accountline->amountoutstanding + 0, 0, 'Fine has been reduced to 0' );
2433
    is( $accountline->amountoutstanding + 0, 0, 'Fine has been reduced to 0' );
2430
    is( $accountline->accounttype, 'FFOR', 'Open fine ( account type FU ) has been set to fine forgiven ( account type FFOR )');
2434
    is( $accountline->status, 'FORGIVEN', 'Open fine ( account type OVERDUE ) has been set to fine forgiven ( status FORGIVEN )');
2431
    is( ref $offset, "Koha::Account::Offset", "Found matching offset for fine reduction via forgiveness" );
2435
    is( ref $offset, "Koha::Account::Offset", "Found matching offset for fine reduction via forgiveness" );
2432
    is( $offset->amount, '-99.000000', "Amount of offset is correct" );
2436
    is( $offset->amount, '-99.000000', "Amount of offset is correct" );
2433
};
2437
};
(-)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