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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/browser-strings.inc (+34 lines)
Line 0 Link Here
1
[% USE AuthorisedValues %]
2
<script type="text/javascript">
3
//<![CDATA[
4
    var BROWSER_RETURN_TO_SEARCH = _("Return to results");
5
    var BROWSER_PREVIOUS = _("Previous");
6
    var BROWSER_NEXT = _("Next");
7
8
    var STRINGS = {
9
        "DebitTypes": {
10
            "FINE"                      : _("Fine"),
11
            "ACCOUNT_MANAGEMENT_FEE"    : _("Account management fee"),
12
            "SUNDRY"                    : _("Sundry"),
13
            "LOST"                      : _("Lost item"),
14
            "HOLD"                      : _("Hold fee"),
15
            "RENTAL"                    : _("Rental fee"),
16
            "NEW_CARD"                  : _("New card"),
17
            [% FOREACH a IN AuthorisedValues.Get('MANUAL_INV') %]
18
                "[% a.authorised_value %]" : "[% a.lib %]",
19
            [% END %]
20
        },
21
22
        "CreditTypes": {
23
            "CREDIT"                    : _("Credit"),
24
            "PAYMENT"                   : _("Payment"),
25
            "WRITEOFF"                  : _("Writeoff"),
26
            "FOUND"                     : _("Lost item found"),
27
            "FORGIVEN"                  : _("Forgiven"),
28
            [% FOREACH a IN AuthorisedValues.Get('MANUAL_CREDIT') %]
29
                "[% a.authorised_value %]" : "[% a.lib %]",
30
            [% END %]
31
        }
32
    }
33
//]]>
34
</script>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt (-55 / +356 lines)
Lines 1-9 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Currency %]
3
4
4
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your fines and charges
5
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your fines and charges
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
6
[% BLOCK cssinclude %][% END %]
7
[% BLOCK cssinclude %][% END %]
8
9
[% INCLUDE 'browser-strings.inc' %]
10
7
</head>
11
</head>
8
<body id="opac-account" class="scrollto">
12
<body id="opac-account" class="scrollto">
9
[% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
13
[% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
Lines 12-18 Link Here
12
<div class="main">
16
<div class="main">
13
    <ul class="breadcrumb">
17
    <ul class="breadcrumb">
14
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
18
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
15
        <li>[% FOREACH BORROWER_INF IN BORROWER_INFO %]<a href="/cgi-bin/koha/opac-user.pl">[% BORROWER_INF.firstname %] [% BORROWER_INF.surname %]</a>[% END %] <span class="divider">&rsaquo;</span></li>
19
        <li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
16
        <li><a href="#">Your fines and charges</a></li>
20
        <li><a href="#">Your fines and charges</a></li>
17
    </ul>
21
    </ul>
18
22
Lines 26-86 Link Here
26
            <div class="span10">
30
            <div class="span10">
27
                <div id="useraccount" class="maincontent">
31
                <div id="useraccount" class="maincontent">
28
                    <h3>Fines and charges</h3>
32
                    <h3>Fines and charges</h3>
33
                    [% IF credits || debits %]
34
35
                        <p>
36
                            <h3>Account balance: [% borrower.account_balance | $Currency %]</h3>
37
                        </p>
38
39
                        <div>
40
                            <div id="account-debits">
41
                                <a id="account-debits-switcher" href="#" onclick="return false">View payments</a>
42
                                <table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table">
43
                                    <thead>
44
                                        <tr>
45
                                            <th colspan="99">Fees</th>
46
                                        </tr>
47
                                        <tr>
48
                                            <th></th>
49
                                            <th>ID</th>
50
                                            <th>Description</th>
51
                                            <th>Type</th>
52
                                            <th>Amount</th>
53
                                            <th>Outstanding</th>
54
                                            <th>Created on</th>
55
                                            <th>Updated on</th>
56
                                        </tr>
57
                                    </thead>
58
                                    <tbody></tbody>
59
                                </table>
60
                            </div>
29
61
30
                    [% IF ( ACCOUNT_LINES ) %]
62
                            <div id="account-credits">
31
                        <table class="table table-bordered table-striped">
63
                                <a id="account-credits-switcher" href="#"  onclick="return false">View fees</a>
32
                            <thead>
64
                                <table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table">
33
                                <tr>
65
                                    <thead>
34
                                    <th>Date</th>
66
                                        <tr>
35
                                    <th>Description</th>
67
                                            <th colspan="99">Payments</th>
36
                                    <th>Fine amount</th>
68
                                        </tr>
37
                                    <th>Amount outstanding</th>
69
                                        <tr>
38
                                </tr>
70
                                            <th></th>
39
                            </thead>
71
                                            <th>ID</th>
40
72
                                            <th>Notes</th>
41
                            <tfoot>
73
                                            <th>Type</th>
42
                            <tr>
74
                                            <th>Amount</th>
43
                                <th class="sum" colspan="3">Total due</th>
75
                                            <th>Remaining</th>
44
                                <td class="sum">[% total %]</td>
76
                                            <th>Created on</th>
45
                            </tr>
77
                                            <th>Updated on</th>
46
                            </tfoot>
78
                                        </tr>
47
79
                                    </thead>
48
                            <tbody>
80
                                    <tbody></tbody>
49
                                [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
81
                                </table>
50
                                    [% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
82
                            </div>
51
                                        <td>[% ACCOUNT_LINE.date | $KohaDates %]</td>
83
                        </div>
52
                                        <td>
53
                                            [% SWITCH ACCOUNT_LINE.accounttype %]
54
                                            [% CASE 'Pay' %]Payment, thanks
55
                                            [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
56
                                            [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
57
                                            [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
58
                                            [% CASE 'N' %]New card
59
                                            [% CASE 'F' %]Fine
60
                                            [% CASE 'A' %]Account management fee
61
                                            [% CASE 'M' %]Sundry
62
                                            [% CASE 'L' %]Lost item
63
                                            [% CASE 'W' %]Writeoff
64
                                            [% CASE 'FU' %]Accruing fine
65
                                            [% CASE 'Rent' %]Rental fee
66
                                            [% CASE 'FOR' %]Forgiven
67
                                            [% CASE 'LR' %]Lost item fee refund
68
                                            [% CASE 'PAY' %]Payment
69
                                            [% CASE 'WO' %]Writeoff
70
                                            [% CASE 'C' %]Credit
71
                                            [% CASE 'CR' %]Credit
72
                                            [% CASE %][% ACCOUNT_LINE.accounttype %]
73
                                          [%- END -%]
74
                                          [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description %][% END %]
75
                                          [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title %])[% END %]
76
                                        </td>
77
                                        [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount %]</td>
78
                                        [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding %]</td>
79
                                    </tr>
80
                                [% END %]
81
                            </tbody>
82
83
                        </table>
84
                    [% ELSE %]
84
                    [% ELSE %]
85
                        <h4>You have no fines or charges</h4>
85
                        <h4>You have no fines or charges</h4>
86
                    [% END %]
86
                    [% END %]
Lines 91-94 Link Here
91
</div> <!-- / .main -->
91
</div> <!-- / .main -->
92
92
93
[% INCLUDE 'opac-bottom.inc' %]
93
[% INCLUDE 'opac-bottom.inc' %]
94
95
[% INCLUDE 'datatables.inc' %]
96
97
<script type="text/javascript">
98
//<![CDATA[
99
$(document).ready(function() {
100
    $('#account-credits').hide();
101
    $('#account-debits-switcher').click(function() {
102
         $('#account-debits').slideUp();
103
         $('#account-credits').slideDown();
104
    });
105
    $('#account-credits-switcher').click(function() {
106
         $('#account-credits').slideUp();
107
         $('#account-debits').slideDown();
108
    });
109
110
    var anOpen = [];
111
    var sImageUrl = "[% interface %]/[% theme %]/images/";
112
113
    var debitsTable = $('#debits-table').dataTable( {
114
        "bProcessing": true,
115
        "aoColumns": [
116
            {
117
                "mDataProp": null,
118
                "sClass": "control center",
119
                "sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">'
120
            },
121
            { "mDataProp": "debit_id" },
122
            { "mDataProp": "description" },
123
            {
124
                "mDataProp": "type",
125
                "fnRender": function ( o, val ) {
126
                    return STRINGS['DebitTypes'][val] || val;
127
                },
128
            },
129
            { "mDataProp": "amount_original" },
130
            { "mDataProp": "amount_outstanding" },
131
            { "mDataProp": "created_on" },
132
            { "mDataProp": "updated_on" }
133
        ],
134
        "aaData": [
135
            [% FOREACH d IN debits %]
136
                {
137
                    [% PROCESS format_data data=d highlight='debit' %]
138
139
                    // Data for related item if there is one linked
140
                    "title": "[% d.item.biblio.title || d.deleted_item.biblio.title || d.deleted_item.deleted_biblio.title %]",
141
                    "biblionumber": "[% d.item.biblio.biblionumber || d.deleted_item.biblio.biblionumber %]",
142
                    "barcode": "[% d.item.barcode || d.deleted_item.barcode %]",
143
                    "itemnumber": "[% d.item.itemnumber %]", //This way itemnumber will be undef if deleted
144
145
146
                    // Data for related issue if there is one linked
147
                    [% IF d.issue %]
148
                        [% SET table = 'issue' %]
149
                    [% ELSIF d.old_issue %]
150
                        [% SET table = 'old_issue' %]
151
                    [% END %]
152
153
                    [% IF table %]
154
                        "issue": {
155
                            [% PROCESS format_data data=d.$table %]
156
                        },
157
                    [% END %]
158
159
160
                    "account_offsets": [
161
                        [% FOREACH ao IN d.account_offsets %]
162
                            {
163
                                [% PROCESS format_data data=ao highlight='offset'%]
164
165
                                "credit": {
166
                                    [% PROCESS format_data data=ao.credit highlight='credit' %]
167
                                }
168
                            },
169
                        [% END %]
170
                    ]
171
172
                },
173
            [% END %]
174
        ]
175
    } );
176
177
    $('#debits-table td.control').live( 'click', function () {
178
        var nTr = this.parentNode;
179
        var i = $.inArray( nTr, anOpen );
180
181
        if ( i === -1 ) {
182
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
183
            var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' );
184
            $('div.innerDetails', nDetailsRow).slideDown();
185
            anOpen.push( nTr );
186
        }
187
        else {
188
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
189
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
190
                debitsTable.fnClose( nTr );
191
                anOpen.splice( i, 1 );
192
            } );
193
        }
194
    } );
195
196
    var creditsTable = $('#credits-table').dataTable( {
197
        "bProcessing": true,
198
        "aoColumns": [
199
            {
200
                "mDataProp": null,
201
                "sClass": "control center",
202
                "sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">'
203
            },
204
            { "mDataProp": "credit_id" },
205
            { "mDataProp": "notes" },
206
            { "mDataProp": "type" },
207
            { "mDataProp": "amount_paid" },
208
            { "mDataProp": "amount_remaining" },
209
            { "mDataProp": "created_on" },
210
            { "mDataProp": "updated_on" }
211
        ],
212
        "aaData": [
213
            [% FOREACH c IN credits %]
214
                {
215
                    [% PROCESS format_data data=c highlight='credit' %]
216
217
                    "account_offsets": [
218
                        [% FOREACH ao IN c.account_offsets %]
219
                            {
220
                                [% PROCESS format_data data=ao highlight='offset' %]
221
222
                                "debit": {
223
                                    [% PROCESS format_data data=ao.debit highlight='debit' %]
224
                                }
225
                            },
226
                        [% END %]
227
                    ]
228
229
                },
230
            [% END %]
231
        ]
232
    } );
233
234
    $('#credits-table td.control').live( 'click', function () {
235
        var nTr = this.parentNode;
236
        var i = $.inArray( nTr, anOpen );
237
238
        if ( i === -1 ) {
239
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
240
            var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' );
241
            $('div.innerDetails', nDetailsRow).slideDown();
242
            anOpen.push( nTr );
243
        }
244
        else {
245
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
246
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
247
                creditsTable.fnClose( nTr );
248
                anOpen.splice( i, 1 );
249
            } );
250
        }
251
    } );
252
253
} );
254
255
function fnFormatDebitDetails( debitsTable, nTr ) {
256
    var oData = debitsTable.fnGetData( nTr );
257
258
    var sOut = "<div class='innerDetails' style='display:none;'>";
259
260
    var account_offsets = oData.account_offsets;
261
262
    sOut += "<ul>";
263
    if ( oData.title ) {
264
        sOut += "<li>" + _("Title: ");
265
        if ( oData.biblionumber ) {
266
            sOut += "<a href='/cgi-bin/koha/opac-detail.pl?biblionumber=" + oData.biblionumber + "'>";
267
        }
268
269
        sOut += oData.title;
270
271
        if ( oData.biblionumber ) {
272
            sOut += "</a>";
273
        }
274
275
        sOut += "</li>";
276
    }
277
278
    if ( oData.barcode ) {
279
        sOut += "<li>" + _("Barcode: ") + oData.barcode + "</li>";
280
    }
281
282
    if ( oData.notes ) {
283
        sOut += "<li>" + _("Notes: ") + oData.notes + "</li>";
284
    }
285
286
    sOut += "</ul>";
287
288
    if ( account_offsets.length ) {
289
        sOut +=
290
            "<div class='innerDetails'>" +
291
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
292
                    "<thead>" +
293
                        "<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" +
294
                        "<tr>" +
295
                            "<th>" + _("ID") + "</th>" +
296
                            "<th>" + _("Created on") + "</th>" +
297
                            "<th>" + _("Payment amount") + "</th>" +
298
                            "<th>" + _("Applied amount") + "</th>" +
299
                            "<th>" + _("Type") + "</th>" +
300
                            "<th>" + _("Notes") + "</th>" +
301
                        "</tr>" +
302
                    "</thead>" +
303
                    "<tbody>";
304
305
        for ( var i = 0; i < account_offsets.length; i++ ) {
306
            ao = account_offsets[i];
307
            sOut +=
308
            "<tr>" +
309
                "<td>" + ao.credit_id + "</td>" +
310
                "<td>" + ao.created_on + "</td>" +
311
                "<td>" + ao.credit.amount_paid + "</td>" +
312
                "<td>" + ao.amount + "</td>" +
313
                "<td>" + ao.credit.type + "</td>" +
314
                "<td>" + ao.credit.notes + "</td>" +
315
            "</tr>";
316
        }
317
318
        sOut +=
319
            "</tbody>"+
320
            "</table>";
321
    }
322
323
    sOut +=
324
        "</div>";
325
326
    return sOut;
327
}
328
329
function fnFormatCreditDetails( creditsTable, nTr ) {
330
    var oData = creditsTable.fnGetData( nTr );
331
332
    var sOut = "<div class='innerDetails' style='display:none;'>";
333
334
    var account_offsets = oData.account_offsets;
335
336
    if ( account_offsets.length ) {
337
        sOut +=
338
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
339
                    "<thead>" +
340
                        "<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" +
341
                        "<tr>" +
342
                            "<th>" + _("ID") + "</th>" +
343
                            "<th>" + _("Description") + "</th>" +
344
                            "<th>" + _("Type") + "</th>" +
345
                            "<th>" + _("Amount") + "</th>" +
346
                            "<th>" + _("Remaining") + "</th>" +
347
                            "<th>" + _("Created on") + "</th>" +
348
                            "<th>" + _("Updated on") + "</th>" +
349
                            "<th>" + _("Notes") + "</th>" +
350
                        "</tr>" +
351
                    "</thead>" +
352
                    "<tbody>";
353
354
        for ( var i = 0; i < account_offsets.length; i++ ) {
355
            ao = account_offsets[i];
356
            sOut +=
357
            "<tr>" +
358
                "<td>" + ao.debit.debit_id + "</td>" +
359
                "<td>" + ao.debit.description + "</td>" +
360
                "<td>" + ao.debit.type + "</td>" +
361
                "<td>" + ao.debit.amount_original + "</td>" +
362
                "<td>" + ao.debit.amount_outstanding + "</td>" +
363
                "<td>" + ao.debit.created_on + "</td>" +
364
                "<td>" + ao.debit.updated_on + "</td>" +
365
                "<td>" + ao.debit.notes + "</td>" +
366
            "</tr>";
367
        }
368
369
        sOut +=
370
            "</tbody>"+
371
            "</table>";
372
    }
373
374
    sOut +=
375
        "</div>";
376
377
    return sOut;
378
}
379
380
//]]>
381
</script>
382
94
[% BLOCK jsinclude %][% END %]
383
[% BLOCK jsinclude %][% END %]
384
385
[% BLOCK format_data %]
386
    [% FOREACH key IN data.result_source.columns %]
387
        [% IF key.match('^amount') %]
388
            "[% key %]": "[% data.$key FILTER $Currency %]",
389
        [% ELSIF key.match('_on$') %]
390
            "[% key %]": "[% data.$key | $KohaDates %]",
391
        [% ELSE %]
392
            "[% key %]": "[% data.$key %]",
393
        [% END %]
394
    [% END %]
395
[% END %]
(-)a/opac/opac-account.pl (-33 / +13 lines)
Lines 18-24 Link Here
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
20
21
22
use strict;
21
use strict;
23
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
24
use C4::Members;
23
use C4::Members;
Lines 39-78 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
39
    }
38
    }
40
);
39
);
41
40
42
# get borrower information ....
41
my @debits = Koha::Database->new()->schema->resultset('AccountDebit')->search(
43
my $borr = GetMemberDetails( $borrowernumber );
42
    { 'me.borrowernumber' => $borrowernumber },
44
my @bordat;
43
    { prefetch            => { account_offsets => 'credit' } }
45
$bordat[0] = $borr;
44
);
46
47
$template->param( BORROWER_INFO => \@bordat );
48
49
#get account details
50
my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
51
52
for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
53
    $accts->[$i]{'amount'} = sprintf( "%.2f", $accts->[$i]{'amount'} || '0.00');
54
    if ( $accts->[$i]{'amount'} >= 0 ) {
55
        $accts->[$i]{'amountcredit'} = 1;
56
    }
57
    $accts->[$i]{'amountoutstanding'} =
58
      sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} || '0.00' );
59
    if ( $accts->[$i]{'amountoutstanding'} >= 0 ) {
60
        $accts->[$i]{'amountoutstandingcredit'} = 1;
61
    }
62
}
63
45
64
# add the row parity
46
my @credits = Koha::Database->new()->schema->resultset('AccountCredit')->search(
65
my $num = 0;
47
    { 'me.borrowernumber' => $borrowernumber },
66
foreach my $row (@$accts) {
48
    { prefetch            => { account_offsets => 'debit' } }
67
    $row->{'even'} = 1 if $num % 2 == 0;
49
);
68
    $row->{'odd'}  = 1 if $num % 2 == 1;
69
    $num++;
70
}
71
50
72
$template->param (
51
$template->param(
73
    ACCOUNT_LINES => $accts,
52
    borrower    => GetMemberDetails($borrowernumber),
74
    total => sprintf( "%.2f", $total ),
53
    debits      => \@debits,
75
	accountview => 1
54
    credits     => \@credits,
55
    accountview => 1
76
);
56
);
77
57
78
output_html_with_http_headers $query, $cookie, $template->output;
58
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-user.pl (-14 / +4 lines)
Lines 36-41 use C4::Letters; Link Here
36
use C4::Branch; # GetBranches
36
use C4::Branch; # GetBranches
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Koha::Borrower::Debarments qw(IsDebarred);
38
use Koha::Borrower::Debarments qw(IsDebarred);
39
use Koha::Database;
39
40
40
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
41
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
41
42
Lines 46-51 use Date::Calc qw( Link Here
46
);
47
);
47
48
48
my $query = new CGI;
49
my $query = new CGI;
50
my $schema = Koha::Database->new()->schema();
49
51
50
BEGIN {
52
BEGIN {
51
    if (C4::Context->preference('BakerTaylorEnabled')) {
53
    if (C4::Context->preference('BakerTaylorEnabled')) {
Lines 165-170 my @overdues; Link Here
165
my @issuedat;
167
my @issuedat;
166
my $itemtypes = GetItemTypes();
168
my $itemtypes = GetItemTypes();
167
my $issues = GetPendingIssues($borrowernumber);
169
my $issues = GetPendingIssues($borrowernumber);
170
my $account_debit_rs = $schema->resultset('AccountDebit');
168
if ($issues){
171
if ($issues){
169
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
172
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
170
        # check for reserves
173
        # check for reserves
Lines 173-191 if ($issues){ Link Here
173
            $issue->{'reserved'} = 1;
176
            $issue->{'reserved'} = 1;
174
        }
177
        }
175
178
176
        my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
179
        $issue->{'charges'} = $account_debit_rs->search({ borrowernumber => $borrowernumber, itemnumber => $issue->{'itemnumber'} })->get_column('amount_outstanding')->sum();
177
        my $charges = 0;
178
        foreach my $ac (@$accts) {
179
            if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {
180
                $charges += $ac->{'amountoutstanding'}
181
                  if $ac->{'accounttype'} eq 'F';
182
                $charges += $ac->{'amountoutstanding'}
183
                  if $ac->{'accounttype'} eq 'FU';
184
                $charges += $ac->{'amountoutstanding'}
185
                  if $ac->{'accounttype'} eq 'L';
186
            }
187
        }
188
        $issue->{'charges'} = $charges;
189
        $issue->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($issue->{'biblionumber'}), GetFrameworkCode($issue->{'biblionumber'}));
180
        $issue->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($issue->{'biblionumber'}), GetFrameworkCode($issue->{'biblionumber'}));
190
        # check if item is renewable
181
        # check if item is renewable
191
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
182
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
192
- 

Return to bug 6427