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

(-)a/installer/data/mysql/atomicupdate/bug_22563.perl (+34 lines)
Line 0 Link Here
1
$DBversion = 'XXX';    # will be replaced by the RM
2
if ( CheckVersion($DBversion) ) {
3
4
    my $sth = $dbh->prepare( "SELECT accountlines_id, issue_id, borrowernumber, itemnumber, amount, manager_id FROM accountlines WHERE accounttype = 'LR' AND amount < 0" );
5
    $sth->execute();
6
    while ( my $row = $sth->fetchrow_hashref ) {
7
        $dbh->do(
8
"INSERT INTO accountlines (accounttype, issue_id, borrowernumber, itemnumber, amount, manager_id) VALUES ( ?, ?, ?, ?, ?, ? );",
9
            {},
10
            (
11
                'CR',                   $row->{issue_id},
12
                $row->{borrowernumber}, $row->{itemnumber},
13
                $row->{amount},         $row->{manager_id}
14
            )
15
        );
16
        my $credit_id = $dbh->last_insert_id();
17
        my $amount = $row->{amount} * -1;
18
        $dbh->do("INSERT INTO account_offsets (credit_id, debit_id, type, amount) VALUES (?,?,?,?);",{},($credit_id, $row->{accountlines_id}, 'Lost Item', $amount));
19
        $dbh->do("UPDATE accountlines SET amount = '$amount' WHERE accountlines_id = '$row->{accountlines_id}';");
20
    }
21
22
    $dbh->do(qq{
23
        UPDATE
24
          accountlines
25
        SET
26
          accounttype = 'LOST',
27
          status = 'RETURNED'
28
        WHERE
29
          accounttype = 'LR';
30
    });
31
32
    SetVersion($DBversion);
33
    print "Upgrade to $DBversion done (Bug 22518 - Fix accounttypes for 'L' and 'LR')\n";
34
}
(-)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/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