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

(-)a/C4/Overdues.pm (-1 / +1 lines)
Lines 587-593 sub UpdateFine { Link Here
587
                    user_id     => undef,
587
                    user_id     => undef,
588
                    interface   => C4::Context->interface,
588
                    interface   => C4::Context->interface,
589
                    library_id  => undef, #FIXME: Should we grab the checkout or circ-control branch here perhaps?
589
                    library_id  => undef, #FIXME: Should we grab the checkout or circ-control branch here perhaps?
590
                    type        => 'overdue',
590
                    type        => 'OVERDUE',
591
                    item_id     => $itemnum,
591
                    item_id     => $itemnum,
592
                    issue_id    => $issue_id,
592
                    issue_id    => $issue_id,
593
                }
593
                }
(-)a/Koha/Account.pm (-4 / +4 lines)
Lines 450-456 $debit_type can be any of: Link Here
450
  - LOST
450
  - LOST
451
  - sundry
451
  - sundry
452
  - new_card
452
  - new_card
453
  - overdue
453
  - OVERDUE
454
  - PROCESSING
454
  - PROCESSING
455
  - RENT
455
  - RENT
456
  - RENT_DAILY
456
  - RENT_DAILY
Lines 516-522 sub add_debit { Link Here
516
                    itemnumber        => $item_id,
516
                    itemnumber        => $item_id,
517
                    issue_id          => $issue_id,
517
                    issue_id          => $issue_id,
518
                    branchcode        => $library_id,
518
                    branchcode        => $library_id,
519
                    ( $type eq 'overdue' ? ( status => 'UNRETURNED' ) : () ),
519
                    ( $type eq 'OVERDUE' ? ( status => 'UNRETURNED' ) : () ),
520
                }
520
                }
521
            )->store();
521
            )->store();
522
522
Lines 717-723 our $offset_type = { Link Here
717
    'RENT_DAILY'       => 'Rental Fee',
717
    'RENT_DAILY'       => 'Rental Fee',
718
    'RENT_RENEW'       => 'Rental Fee',
718
    'RENT_RENEW'       => 'Rental Fee',
719
    'RENT_DAILY_RENEW' => 'Rental Fee',
719
    'RENT_DAILY_RENEW' => 'Rental Fee',
720
    'overdue'          => 'OVERDUE',
720
    'OVERDUE'          => 'OVERDUE',
721
    'RESERVE_EXPIRED'  => 'Hold Expired'
721
    'RESERVE_EXPIRED'  => 'Hold Expired'
722
};
722
};
723
723
Lines 743-749 our $account_type_debit = { Link Here
743
    'RESERVE_EXPIRED'  => 'RESERVE_EXPIRED',
743
    'RESERVE_EXPIRED'  => 'RESERVE_EXPIRED',
744
    'LOST_ITEM'        => 'LOST',
744
    'LOST_ITEM'        => 'LOST',
745
    'new_card'         => 'N',
745
    'new_card'         => 'N',
746
    'overdue'          => 'OVERDUE',
746
    'OVERDUE'          => 'OVERDUE',
747
    'PROCESSING'       => 'PROCESSING',
747
    'PROCESSING'       => 'PROCESSING',
748
    'RENT'             => 'RENT',
748
    'RENT'             => 'RENT',
749
    'RENT_DAILY'       => 'RENT_DAILY',
749
    'RENT_DAILY'       => 'RENT_DAILY',
(-)a/t/db_dependent/Circulation.t (-4 / +4 lines)
Lines 745-751 subtest "CanBookBeRenewed tests" => sub { Link Here
745
            {
745
            {
746
                amount      => $fines_amount,
746
                amount      => $fines_amount,
747
                interface   => 'test',
747
                interface   => 'test',
748
                type        => 'overdue',
748
                type        => 'OVERDUE',
749
                item_id     => $item_to_auto_renew->{itemnumber},
749
                item_id     => $item_to_auto_renew->{itemnumber},
750
                description => "Some fines"
750
                description => "Some fines"
751
            }
751
            }
Lines 759-765 subtest "CanBookBeRenewed tests" => sub { Link Here
759
            {
759
            {
760
                amount      => $fines_amount,
760
                amount      => $fines_amount,
761
                interface   => 'test',
761
                interface   => 'test',
762
                type        => 'overdue',
762
                type        => 'OVERDUE',
763
                item_id     => $item_to_auto_renew->{itemnumber},
763
                item_id     => $item_to_auto_renew->{itemnumber},
764
                description => "Some fines"
764
                description => "Some fines"
765
            }
765
            }
Lines 773-779 subtest "CanBookBeRenewed tests" => sub { Link Here
773
            {
773
            {
774
                amount      => $fines_amount,
774
                amount      => $fines_amount,
775
                interface   => 'test',
775
                interface   => 'test',
776
                type        => 'overdue',
776
                type        => 'OVERDUE',
777
                item_id     => $item_to_auto_renew->{itemnumber},
777
                item_id     => $item_to_auto_renew->{itemnumber},
778
                description => "Some fines"
778
                description => "Some fines"
779
            }
779
            }
Lines 2450-2456 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2450
        );
2450
        );
2451
2451
2452
        my $manual_debit_amount = 80;
2452
        my $manual_debit_amount = 80;
2453
        $account->add_debit( { amount => $manual_debit_amount, type => 'overdue', interface =>'test' } );
2453
        $account->add_debit( { amount => $manual_debit_amount, type => 'OVERDUE', interface =>'test' } );
2454
2454
2455
        is( $account->balance, $manual_debit_amount + $replacement_amount - $payment_amount, 'Manual debit applied' );
2455
        is( $account->balance, $manual_debit_amount + $replacement_amount - $payment_amount, 'Manual debit applied' );
2456
2456
(-)a/t/db_dependent/Koha/Account.t (-24 / +24 lines)
Lines 60-69 subtest 'outstanding_debits() tests' => sub { Link Here
60
    my $account = $patron->account;
60
    my $account = $patron->account;
61
61
62
    my @generated_lines;
62
    my @generated_lines;
63
    push @generated_lines, $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' });
63
    push @generated_lines, $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' });
64
    push @generated_lines, $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' });
64
    push @generated_lines, $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' });
65
    push @generated_lines, $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' });
65
    push @generated_lines, $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' });
66
    push @generated_lines, $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' });
66
    push @generated_lines, $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' });
67
67
68
    my $lines     = $account->outstanding_debits();
68
    my $lines     = $account->outstanding_debits();
69
    my @lines_arr = $account->outstanding_debits();
69
    my @lines_arr = $account->outstanding_debits();
Lines 405-414 subtest 'lines() tests' => sub { Link Here
405
    $account->add_credit({ amount => 4, interface => 'commandline' });
405
    $account->add_credit({ amount => 4, interface => 'commandline' });
406
406
407
    # Add Debits
407
    # Add Debits
408
    $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' });
408
    $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' });
409
    $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' });
409
    $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' });
410
    $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' });
410
    $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' });
411
    $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' });
411
    $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' });
412
412
413
    # Paid Off
413
    # Paid Off
414
    $account->add_credit( { amount => 1, interface => 'commandline' } )
414
    $account->add_credit( { amount => 1, interface => 'commandline' } )
Lines 441-450 subtest 'reconcile_balance' => sub { Link Here
441
        $account->add_credit({ amount => 5, interface => 'commandline' });
441
        $account->add_credit({ amount => 5, interface => 'commandline' });
442
442
443
        # Add Debits
443
        # Add Debits
444
        $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' });
444
        $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' });
445
        $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' });
445
        $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' });
446
        $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' });
446
        $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' });
447
        $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' });
447
        $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' });
448
448
449
        # Paid Off
449
        # Paid Off
450
        Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store;
450
        Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store;
Lines 479-488 subtest 'reconcile_balance' => sub { Link Here
479
        $account->add_credit({ amount => 4, interface => 'commandline' });
479
        $account->add_credit({ amount => 4, interface => 'commandline' });
480
480
481
        # Add Debits
481
        # Add Debits
482
        $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' });
482
        $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' });
483
        $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' });
483
        $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' });
484
        $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' });
484
        $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' });
485
        $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' });
485
        $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' });
486
486
487
        # Paid Off
487
        # Paid Off
488
        Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store;
488
        Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store;
Lines 517-527 subtest 'reconcile_balance' => sub { Link Here
517
        $account->add_credit({ amount => 4, interface => 'commandline' });
517
        $account->add_credit({ amount => 4, interface => 'commandline' });
518
518
519
        # Add Debits
519
        # Add Debits
520
        $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' });
520
        $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' });
521
        $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' });
521
        $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' });
522
        $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' });
522
        $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' });
523
        $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' });
523
        $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' });
524
        $account->add_debit({ amount => 5, interface => 'commandline', type => 'overdue' });
524
        $account->add_debit({ amount => 5, interface => 'commandline', type => 'OVERDUE' });
525
525
526
        # Paid Off
526
        # Paid Off
527
        Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store;
527
        Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store;
Lines 554-562 subtest 'reconcile_balance' => sub { Link Here
554
        $account->add_credit({ amount => 3, interface => 'commandline' });
554
        $account->add_credit({ amount => 3, interface => 'commandline' });
555
555
556
        # Add Debits
556
        # Add Debits
557
        my $debit_1 = $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' });
557
        my $debit_1 = $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' });
558
        my $debit_2 = $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' });
558
        my $debit_2 = $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' });
559
        my $debit_3 = $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' });
559
        my $debit_3 = $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' });
560
560
561
        is( $account->balance(), 2, "Account balance is 2" );
561
        is( $account->balance(), 2, "Account balance is 2" );
562
        is( $account->outstanding_debits->total_outstanding, 6, 'Outstanding debits sum 6' );
562
        is( $account->outstanding_debits->total_outstanding, 6, 'Outstanding debits sum 6' );
(-)a/t/db_dependent/Koha/Account/Lines.t (-2 / +1 lines)
Lines 497-503 subtest 'checkout() tests' => sub { Link Here
497
        interface => 'commandline',
497
        interface => 'commandline',
498
        item_id   => $item->itemnumber,
498
        item_id   => $item->itemnumber,
499
        issue_id  => $checkout->issue_id,
499
        issue_id  => $checkout->issue_id,
500
        type      => 'overdue',
500
        type      => 'OVERDUE',
501
    });
501
    });
502
502
503
    my $line_checkout = $line->checkout;
503
    my $line_checkout = $line->checkout;
504
- 

Return to bug 23049