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

Return to bug 6427