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

(-)a/C4/Accounts.pm (-1 / +1 lines)
Lines 91-97 sub chargelostitem{ Link Here
91
    my $existing_charges = $account->lines->search(
91
    my $existing_charges = $account->lines->search(
92
        {
92
        {
93
            itemnumber     => $itemnumber,
93
            itemnumber     => $itemnumber,
94
            accounttype    => 'L',
94
            accounttype    => 'LOST',
95
        }
95
        }
96
    )->count();
96
    )->count();
97
97
(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 2380-2386 sub _FixAccountForLostAndReturned { Link Here
2380
    my $accountlines = Koha::Account::Lines->search(
2380
    my $accountlines = Koha::Account::Lines->search(
2381
        {
2381
        {
2382
            itemnumber  => $itemnumber,
2382
            itemnumber  => $itemnumber,
2383
            accounttype => { -in => [ 'L', 'W' ] },
2383
            accounttype => { -in => [ 'LOST', 'W' ] },
2384
        },
2384
        },
2385
        {
2385
        {
2386
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
2386
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
(-)a/Koha/Account.pm (-2 / +2 lines)
Lines 106-112 sub pay { Link Here
106
        $fine->amountoutstanding($new_amountoutstanding)->store();
106
        $fine->amountoutstanding($new_amountoutstanding)->store();
107
        $balance_remaining = $balance_remaining - $amount_to_pay;
107
        $balance_remaining = $balance_remaining - $amount_to_pay;
108
108
109
        if ( $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'L' ) )
109
        if ( $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'LOST' ) )
110
        {
110
        {
111
            C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber );
111
            C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber );
112
        }
112
        }
Lines 697-703 our $account_type_credit = { Link Here
697
our $account_type_debit = {
697
our $account_type_debit = {
698
    'account'       => 'A',
698
    'account'       => 'A',
699
    'overdue'       => 'OVERDUE',
699
    'overdue'       => 'OVERDUE',
700
    'lost_item'     => 'L',
700
    'lost_item'     => 'LOST',
701
    'new_card'      => 'N',
701
    'new_card'      => 'N',
702
    'sundry'        => 'M',
702
    'sundry'        => 'M',
703
    'processing'    => 'PF',
703
    'processing'    => 'PF',
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc (-1 / +1 lines)
Lines 8-14 Link Here
8
        [%- CASE 'OVERDUE' -%]<span>Fine[%- PROCESS account_status_description account=account -%]</span>
8
        [%- CASE 'OVERDUE' -%]<span>Fine[%- PROCESS account_status_description account=account -%]</span>
9
        [%- CASE 'A'       -%]<span>Account management fee</span>
9
        [%- CASE 'A'       -%]<span>Account management fee</span>
10
        [%- CASE 'M'       -%]<span>Sundry</span>
10
        [%- CASE 'M'       -%]<span>Sundry</span>
11
        [%- CASE 'L'       -%]<span>Lost item</span>
11
        [%- CASE 'LOST'    -%]<span>Lost item</span>
12
        [%- CASE 'W'       -%]<span>Writeoff[%- PROCESS account_status_description account=account -%]</span>
12
        [%- CASE 'W'       -%]<span>Writeoff[%- PROCESS account_status_description account=account -%]</span>
13
        [%- CASE 'HE'      -%]<span>Hold waiting too long</span>
13
        [%- CASE 'HE'      -%]<span>Hold waiting too long</span>
14
        [%- CASE 'Rent'    -%]<span>Rental fee</span>
14
        [%- CASE 'Rent'    -%]<span>Rental fee</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-1 / +1 lines)
Lines 79-85 Link Here
79
    [% INCLUDE 'str/members-menu.inc' %]
79
    [% INCLUDE 'str/members-menu.inc' %]
80
    [% Asset.js("js/members-menu.js") | $raw %]
80
    [% Asset.js("js/members-menu.js") | $raw %]
81
    <script>
81
    <script>
82
        var type_fees = {'L':'','OVERDUE':'','A':'','N':'','M':''};
82
        var type_fees = {'LOST':'','OVERDUE':'','A':'','N':'','M':''};
83
        [% FOREACH invoice_types_loo IN invoice_types_loop %]
83
        [% FOREACH invoice_types_loo IN invoice_types_loop %]
84
            type_fees['[% invoice_types_loo.authorised_value | html %]'] = "[% invoice_types_loo.lib | html %]";
84
            type_fees['[% invoice_types_loo.authorised_value | html %]'] = "[% invoice_types_loo.lib | html %]";
85
        [% END %]
85
        [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt (-1 / +1 lines)
Lines 116-122 Link Here
116
                                            [%- CASE 'OVERDUE' -%]Fine[%- PROCESS account_status_description account=account -%]
116
                                            [%- CASE 'OVERDUE' -%]Fine[%- PROCESS account_status_description account=account -%]
117
                                            [%- CASE 'A'       -%]Account management fee
117
                                            [%- CASE 'A'       -%]Account management fee
118
                                            [%- CASE 'M'       -%]Sundry
118
                                            [%- CASE 'M'       -%]Sundry
119
                                            [%- CASE 'L'       -%]Lost item
119
                                            [%- CASE 'LOST'    -%]Lost item
120
                                            [%- CASE 'W'       -%]Writeoff[%- PROCESS account_status_description account=account -%]
120
                                            [%- CASE 'W'       -%]Writeoff[%- PROCESS account_status_description account=account -%]
121
                                            [%- CASE 'HE'      -%]Hold waiting too long
121
                                            [%- CASE 'HE'      -%]Hold waiting too long
122
                                            [%- CASE 'Rent'    -%]Rental fee
122
                                            [%- CASE 'Rent'    -%]Rental fee
(-)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       => [ 'OVERDUE', 'L' ],
199
                accounttype       => [ 'OVERDUE', 'LOST' ],
200
                itemnumber        => $issue->{itemnumber}
200
                itemnumber        => $issue->{itemnumber}
201
            },
201
            },
202
        );
202
        );
(-)a/t/db_dependent/Accounts.t (-20 / +20 lines)
Lines 76-82 my $item = $builder->build( { source => 'Item', value => { itype => $itemtype- Link Here
76
my $patron = $builder->build( { source => 'Borrower' } );
76
my $patron = $builder->build( { source => 'Borrower' } );
77
my $amount = '5.000000';
77
my $amount = '5.000000';
78
my $description = "Test fee!";
78
my $description = "Test fee!";
79
my $type = 'L';
79
my $type = 'LOST';
80
my $note = 'Test note!';
80
my $note = 'Test note!';
81
warning_like {
81
warning_like {
82
    C4::Accounts::manualinvoice( $patron->{borrowernumber},
82
    C4::Accounts::manualinvoice( $patron->{borrowernumber},
Lines 578-615 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
578
        t::lib::Mocks::mock_preference('useDefaultReplacementCost', '0');
578
        t::lib::Mocks::mock_preference('useDefaultReplacementCost', '0');
579
579
580
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
580
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
581
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' });
581
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
582
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
582
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
583
        ok( !$lostfine, "No lost fine if no replacementcost or default when pref off");
583
        ok( !$lostfine, "No lost fine if no replacementcost or default when pref off");
584
        ok( !$procfee,  "No processing fee if no processing fee");
584
        ok( !$procfee,  "No processing fee if no processing fee");
585
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
585
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
586
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' });
586
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
587
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
587
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
588
        ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set");
588
        ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set");
589
        ok( !$procfee,  "No processing fee if no processing fee");
589
        ok( !$procfee,  "No processing fee if no processing fee");
590
        $lostfine->delete();
590
        $lostfine->delete();
591
591
592
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
592
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
593
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' });
593
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
594
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
594
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
595
        ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
595
        ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
596
        ok( !$procfee,  "No processing fee if no processing fee");
596
        ok( !$procfee,  "No processing fee if no processing fee");
597
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
597
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
598
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' });
598
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
599
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
599
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
600
        ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
600
        ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
601
        ok( !$procfee,  "No processing fee if no processing fee");
601
        ok( !$procfee,  "No processing fee if no processing fee");
602
        $lostfine->delete();
602
        $lostfine->delete();
603
603
604
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
604
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
605
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' });
605
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
606
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
606
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
607
        ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off");
607
        ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off");
608
        ok( $procfee->amount == 8.16,  "Processing fee if processing fee");
608
        ok( $procfee->amount == 8.16,  "Processing fee if processing fee");
609
        is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
609
        is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
610
        $procfee->delete();
610
        $procfee->delete();
611
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
611
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
612
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' });
612
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
613
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
613
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
614
        ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set");
614
        ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set");
615
        ok( $procfee->amount == 8.16,  "Processing fee if processing fee");
615
        ok( $procfee->amount == 8.16,  "Processing fee if processing fee");
Lines 618-631 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
618
        $procfee->delete();
618
        $procfee->delete();
619
619
620
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
620
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
621
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' });
621
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
622
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
622
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
623
        ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
623
        ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
624
        ok( $procfee->amount == 2.04,  "Processing fee if processing fee");
624
        ok( $procfee->amount == 2.04,  "Processing fee if processing fee");
625
        is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
625
        is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
626
        $procfee->delete();
626
        $procfee->delete();
627
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
627
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
628
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' });
628
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
629
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
629
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
630
        ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
630
        ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
631
        ok( $procfee->amount == 2.04,  "Processing fee if processing fee");
631
        ok( $procfee->amount == 2.04,  "Processing fee if processing fee");
Lines 636-679 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
636
        t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1');
636
        t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1');
637
637
638
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
638
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
639
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' });
639
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
640
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
640
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
641
        ok( !$lostfine, "No lost fine if no replacementcost or default when pref on");
641
        ok( !$lostfine, "No lost fine if no replacementcost or default when pref on");
642
        ok( !$procfee,  "No processing fee if no processing fee");
642
        ok( !$procfee,  "No processing fee if no processing fee");
643
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
643
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
644
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' });
644
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
645
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
645
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
646
        is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
646
        is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
647
        ok( !$procfee,  "No processing fee if no processing fee");
647
        ok( !$procfee,  "No processing fee if no processing fee");
648
648
649
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
649
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
650
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' });
650
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
651
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
651
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
652
        is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on");
652
        is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on");
653
        ok( !$procfee,  "No processing fee if no processing fee");
653
        ok( !$procfee,  "No processing fee if no processing fee");
654
        $lostfine->delete();
654
        $lostfine->delete();
655
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
655
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
656
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' });
656
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
657
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
657
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
658
        is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set");
658
        is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set");
659
        ok( !$procfee,  "No processing fee if no processing fee");
659
        ok( !$procfee,  "No processing fee if no processing fee");
660
660
661
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
661
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
662
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' });
662
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
663
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
663
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
664
        ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on");
664
        ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on");
665
        is( $procfee->amount, "8.160000",  "Processing fee if processing fee");
665
        is( $procfee->amount, "8.160000",  "Processing fee if processing fee");
666
        is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
666
        is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
667
        $procfee->delete();
667
        $procfee->delete();
668
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
668
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
669
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' });
669
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
670
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
670
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
671
        is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
671
        is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
672
        is( $procfee->amount, "8.160000",  "Processing fee if processing fee");
672
        is( $procfee->amount, "8.160000",  "Processing fee if processing fee");
673
        is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
673
        is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
674
674
675
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
675
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
676
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' });
676
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
677
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
677
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
678
        is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on");
678
        is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on");
679
        is( $procfee->amount, "2.040000",  "Processing fee if processing fee");
679
        is( $procfee->amount, "2.040000",  "Processing fee if processing fee");
Lines 681-687 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
681
        $lostfine->delete();
681
        $lostfine->delete();
682
        $procfee->delete();
682
        $procfee->delete();
683
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
683
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
684
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' });
684
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
685
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
685
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
686
        is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set");
686
        is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set");
687
        is( $procfee->amount, "2.040000",  "Processing fee if processing fee");
687
        is( $procfee->amount, "2.040000",  "Processing fee if processing fee");
Lines 697-703 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
697
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, '1.99', "Perdedor");
697
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, '1.99', "Perdedor");
698
698
699
        # Lost Item Fee
699
        # Lost Item Fee
700
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' });
700
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
701
        ok($lostfine, "Lost fine created");
701
        ok($lostfine, "Lost fine created");
702
        is($lostfine->manager_id, $staff_id, "Lost fine manager_id set correctly");
702
        is($lostfine->manager_id, $staff_id, "Lost fine manager_id set correctly");
703
        is($lostfine->issue_id, $cli_issue_id_4, "Lost fine issue_id set correctly");
703
        is($lostfine->issue_id, $cli_issue_id_4, "Lost fine issue_id set correctly");
Lines 724-730 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
724
724
725
        t::lib::Mocks::mock_preference( 'FinesLog', 0 );
725
        t::lib::Mocks::mock_preference( 'FinesLog', 0 );
726
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
726
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
727
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' });
727
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
728
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
728
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
729
        is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' );
729
        is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' );
730
        $lostfine->delete();
730
        $lostfine->delete();
Lines 732-738 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
732
732
733
        t::lib::Mocks::mock_preference( 'FinesLog', 1 );
733
        t::lib::Mocks::mock_preference( 'FinesLog', 1 );
734
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
734
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
735
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' });
735
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
736
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
736
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
737
        is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' );
737
        is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' );
738
        $lostfine->delete();
738
        $lostfine->delete();
(-)a/t/db_dependent/Circulation.t (-6 / +5 lines)
Lines 2032-2038 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2032
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2032
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2033
2033
2034
        my $lost_fee_lines = Koha::Account::Lines->search(
2034
        my $lost_fee_lines = Koha::Account::Lines->search(
2035
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } );
2035
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
2036
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2036
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2037
        my $lost_fee_line = $lost_fee_lines->next;
2037
        my $lost_fee_line = $lost_fee_lines->next;
2038
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
2038
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
Lines 2092-2098 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2092
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2092
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2093
2093
2094
        my $lost_fee_lines = Koha::Account::Lines->search(
2094
        my $lost_fee_lines = Koha::Account::Lines->search(
2095
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } );
2095
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
2096
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2096
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2097
        my $lost_fee_line = $lost_fee_lines->next;
2097
        my $lost_fee_line = $lost_fee_lines->next;
2098
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
2098
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
Lines 2160-2166 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2160
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2160
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2161
2161
2162
        my $lost_fee_lines = Koha::Account::Lines->search(
2162
        my $lost_fee_lines = Koha::Account::Lines->search(
2163
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } );
2163
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
2164
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2164
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2165
        my $lost_fee_line = $lost_fee_lines->next;
2165
        my $lost_fee_line = $lost_fee_lines->next;
2166
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
2166
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
Lines 2211-2217 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2211
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2211
            $processfee_amount, 'The right PF amountoutstanding is generated' );
2212
2212
2213
        my $lost_fee_lines = Koha::Account::Lines->search(
2213
        my $lost_fee_lines = Koha::Account::Lines->search(
2214
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } );
2214
            { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
2215
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2215
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2216
        my $lost_fee_line = $lost_fee_lines->next;
2216
        my $lost_fee_line = $lost_fee_lines->next;
2217
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
2217
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
Lines 2312-2318 subtest '_FixAccountForLostAndReturned' => sub { Link Here
2312
        LostItem( $item_id, 1 );
2312
        LostItem( $item_id, 1 );
2313
2313
2314
        my $lost_fee_lines = Koha::Account::Lines->search(
2314
        my $lost_fee_lines = Koha::Account::Lines->search(
2315
            { borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'L' } );
2315
            { borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'LOST' } );
2316
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2316
        is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
2317
        my $lost_fee_line = $lost_fee_lines->next;
2317
        my $lost_fee_line = $lost_fee_lines->next;
2318
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
2318
        is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' );
2319
- 

Return to bug 22563