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

(-)a/C4/Circulation.pm (-4 / +7 lines)
Lines 2391-2397 sub _FixOverduesOnReturn { Link Here
2391
2391
2392
  &_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]);
2392
  &_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]);
2393
2393
2394
Calculates the charge for a book lost and returned.
2394
Finds the most recent lost item charge for this item and refunds the borrower
2395
appropriatly, taking into account any payments or writeoffs already applied
2396
against the charge.
2395
2397
2396
Internal function, not exported, called only by AddReturn.
2398
Internal function, not exported, called only by AddReturn.
2397
2399
Lines 2408-2414 sub _FixAccountForLostAndReturned { Link Here
2408
    my $accountlines = Koha::Account::Lines->search(
2410
    my $accountlines = Koha::Account::Lines->search(
2409
        {
2411
        {
2410
            itemnumber  => $itemnumber,
2412
            itemnumber  => $itemnumber,
2411
            accounttype => { -in => [ 'LOST', 'W' ] },
2413
            accounttype => 'LOST',
2414
            status      => [ undef, { '<>' => 'RETURNED' } ]
2412
        },
2415
        },
2413
        {
2416
        {
2414
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
2417
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
Lines 2454-2461 sub _FixAccountForLostAndReturned { Link Here
2454
        $credit->apply( { debits => $accountlines->reset } );
2457
        $credit->apply( { debits => $accountlines->reset } );
2455
    }
2458
    }
2456
2459
2457
    # Manually set the accounttype
2460
    # Update the account status
2458
    $accountline->discard_changes->accounttype('LR');
2461
    $accountline->discard_changes->status('RETURNED');
2459
    $accountline->store;
2462
    $accountline->store;
2460
2463
2461
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
2464
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
(-)a/Koha/Account.pm (-1 / +1 lines)
Lines 721-727 our $offset_type = { Link Here
721
our $account_type_credit = {
721
our $account_type_credit = {
722
    'credit'           => 'C',
722
    'credit'           => 'C',
723
    'forgiven'         => 'FOR',
723
    'forgiven'         => 'FOR',
724
    'lost_item_return' => 'CR',
724
    'lost_item_return' => 'LOST_RETURN',
725
    'payment'          => 'Pay',
725
    'payment'          => 'Pay',
726
    'writeoff'         => 'W'
726
    'writeoff'         => 'W'
727
};
727
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc (-21 / +20 lines)
Lines 1-26 Link Here
1
[%- BLOCK account_type_description -%]
1
[%- BLOCK account_type_description -%]
2
    [%- SWITCH account.accounttype -%]
2
    [%- SWITCH account.accounttype -%]
3
        [%- CASE 'Pay'     -%]<span>Payment
3
        [%- CASE 'Pay'         -%]<span>Payment
4
        [%- CASE 'Pay00'   -%]<span>Payment (cash via SIP2)
4
        [%- CASE 'Pay00'       -%]<span>Payment (cash via SIP2)
5
        [%- CASE 'Pay01'   -%]<span>Payment (VISA via SIP2)
5
        [%- CASE 'Pay01'       -%]<span>Payment (VISA via SIP2)
6
        [%- CASE 'Pay02'   -%]<span>Payment (credit card via SIP2)
6
        [%- CASE 'Pay02'       -%]<span>Payment (credit card via SIP2)
7
        [%- CASE 'N'       -%]<span>New card
7
        [%- CASE 'N'           -%]<span>New card
8
        [%- CASE 'OVERDUE' -%]<span>Fine
8
        [%- CASE 'OVERDUE'     -%]<span>Fine
9
        [%- CASE 'A'       -%]<span>Account management fee
9
        [%- CASE 'A'           -%]<span>Account management fee
10
        [%- CASE 'M'       -%]<span>Sundry
10
        [%- CASE 'M'           -%]<span>Sundry
11
        [%- CASE 'LOST'    -%]<span>Lost item
11
        [%- CASE 'LOST'        -%]<span>Lost item
12
        [%- CASE 'W'       -%]<span>Writeoff
12
        [%- CASE 'W'           -%]<span>Writeoff
13
        [%- CASE 'HE'      -%]<span>Hold waiting too long
13
        [%- CASE 'HE'          -%]<span>Hold waiting too long
14
        [%- CASE 'Rent'    -%]<span>Rental fee
14
        [%- CASE 'Rent'        -%]<span>Rental fee
15
        [%- CASE 'FOR'     -%]<span>Forgiven
15
        [%- CASE 'FOR'         -%]<span>Forgiven
16
        [%- CASE 'LR'      -%]<span>Lost item fee refund
16
        [%- CASE 'PF'          -%]<span>Lost item processing fee
17
        [%- CASE 'PF'      -%]<span>Lost item processing fee
17
        [%- CASE 'PAY'         -%]<span>Payment
18
        [%- CASE 'PAY'     -%]<span>Payment
18
        [%- CASE 'WO'          -%]<span>Writeoff
19
        [%- CASE 'WO'      -%]<span>Writeoff
19
        [%- CASE 'C'           -%]<span>Credit
20
        [%- CASE 'C'       -%]<span>Credit
20
        [%- CASE 'LOST_RETURN' -%]<span>Lost item fee refund
21
        [%- CASE 'CR'      -%]<span>Credit
21
        [%- CASE 'Res'         -%]<span>Hold fee
22
        [%- CASE 'Res'     -%]<span>Hold fee
22
        [%- CASE               -%]<span>[% account.accounttype | html %]
23
        [%- CASE           -%]<span>[% account.accounttype | html %]
24
    [%- END -%]
23
    [%- END -%]
25
    [%- PROCESS account_status_description account=account -%]</span>
24
    [%- PROCESS account_status_description account=account -%]</span>
26
[%- END -%]
25
[%- END -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt (-1 / +1 lines)
Lines 211-217 Link Here
211
                        <span>Account management fee</span>
211
                        <span>Account management fee</span>
212
                    [% ELSIF loopresul.accounttype == "M" %]
212
                    [% ELSIF loopresul.accounttype == "M" %]
213
                        <span>Sundry</span>
213
                        <span>Sundry</span>
214
                    [% ELSIF loopresul.accounttype == "L" || loopresul.accounttype == "LR" %]
214
                    [% ELSIF loopresul.accounttype == "LOST" %]
215
                        <span>Lost item</span>
215
                        <span>Lost item</span>
216
                    [% ELSIF loopresul.accounttype == "N" %]
216
                    [% ELSIF loopresul.accounttype == "N" %]
217
                        <span>New card</span>
217
                        <span>New card</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (-2 / +1 lines)
Lines 43-54 Link Here
43
                        [% CASE 'HE' %]Hold waiting too long
43
                        [% CASE 'HE' %]Hold waiting too long
44
                        [% CASE 'Rent' %]Rental fee
44
                        [% CASE 'Rent' %]Rental fee
45
                        [% CASE 'FOR' %]Forgiven
45
                        [% CASE 'FOR' %]Forgiven
46
                        [% CASE 'LR' %]Lost item fee refund
47
                        [% CASE 'PF' %]Lost item processing fee
46
                        [% CASE 'PF' %]Lost item processing fee
48
                        [% CASE 'PAY' %]Payment
47
                        [% CASE 'PAY' %]Payment
49
                        [% CASE 'WO' %]Writeoff
48
                        [% CASE 'WO' %]Writeoff
50
                        [% CASE 'C' %]Credit
49
                        [% CASE 'C' %]Credit
51
                        [% CASE 'CR' %]Credit
50
                        [% CASE 'LOST_RETURN' %]Lost item fee refund
52
                        [%-CASE 'Res' %]Hold fee
51
                        [%-CASE 'Res' %]Hold fee
53
                        [% CASE %][% ACCOUNT_LINE.accounttype | html %]
52
                        [% CASE %][% ACCOUNT_LINE.accounttype | html %]
54
                        [%- END -%]
53
                        [%- END -%]
(-)a/reports/cash_register_stats.pl (-3 / +2 lines)
Lines 118-128 if ($do_it) { Link Here
118
            $row->{date} = dt_from_string($row->{date}, 'sql');
118
            $row->{date} = dt_from_string($row->{date}, 'sql');
119
119
120
            push (@loopresult, $row);
120
            push (@loopresult, $row);
121
            if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^LR$|^Pay$/)){
121
            if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^Pay$/)){
122
                pop @loopresult;
122
                pop @loopresult;
123
                next;
123
                next;
124
            }
124
            }
125
            if($row->{accounttype} =~ /^C$|^CR$|^LR$/){
125
            if($row->{accounttype} =~ /^C$|^CR$/){
126
                $grantotal -= abs($row->{amount});
126
                $grantotal -= abs($row->{amount});
127
                $row->{amount} = '-' . $row->{amount};
127
                $row->{amount} = '-' . $row->{amount};
128
            }elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
128
            }elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
129
- 

Return to bug 22563