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

Return to bug 6427