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

(-)a/C4/Circulation.pm (-4 / +7 lines)
Lines 2373-2379 sub _FixOverduesOnReturn { Link Here
2373
2373
2374
  &_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]);
2374
  &_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]);
2375
2375
2376
Calculates the charge for a book lost and returned.
2376
Finds the most recent lost item charge for this item and refunds the borrower
2377
appropriatly, taking into account any payments or writeoffs already applied
2378
against the charge.
2377
2379
2378
Internal function, not exported, called only by AddReturn.
2380
Internal function, not exported, called only by AddReturn.
2379
2381
Lines 2390-2396 sub _FixAccountForLostAndReturned { Link Here
2390
    my $accountlines = Koha::Account::Lines->search(
2392
    my $accountlines = Koha::Account::Lines->search(
2391
        {
2393
        {
2392
            itemnumber  => $itemnumber,
2394
            itemnumber  => $itemnumber,
2393
            accounttype => { -in => [ 'LOST', 'W' ] },
2395
            accounttype => 'LOST',
2396
            status      => [ undef, { '<>' => 'RETURNED' } ]
2394
        },
2397
        },
2395
        {
2398
        {
2396
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
2399
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
Lines 2436-2443 sub _FixAccountForLostAndReturned { Link Here
2436
        $credit->apply( { debits => $accountlines->reset } );
2439
        $credit->apply( { debits => $accountlines->reset } );
2437
    }
2440
    }
2438
2441
2439
    # Manually set the accounttype
2442
    # Update the account status
2440
    $accountline->discard_changes->accounttype('LR');
2443
    $accountline->discard_changes->status('RETURNED');
2441
    $accountline->store;
2444
    $accountline->store;
2442
2445
2443
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
2446
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
(-)a/Koha/Account.pm (-1 / +1 lines)
Lines 709-715 our $offset_type = { Link Here
709
our $account_type_credit = {
709
our $account_type_credit = {
710
    'credit'           => 'C',
710
    'credit'           => 'C',
711
    'forgiven'         => 'FOR',
711
    'forgiven'         => 'FOR',
712
    'lost_item_return' => 'CR',
712
    'lost_item_return' => 'LOST_RETURN',
713
    'payment'          => 'Pay',
713
    'payment'          => 'Pay',
714
    'writeoff'         => 'W'
714
    'writeoff'         => 'W'
715
};
715
};
(-)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