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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/browser-strings.inc (+27 lines)
Lines 1-7 Link Here
1
[% USE KohaAuthorisedValues %]
1
<script type="text/javascript">
2
<script type="text/javascript">
2
//<![CDATA[
3
//<![CDATA[
3
    var BROWSER_RETURN_TO_SEARCH = _("Return to results");
4
    var BROWSER_RETURN_TO_SEARCH = _("Return to results");
4
    var BROWSER_PREVIOUS = _("Previous");
5
    var BROWSER_PREVIOUS = _("Previous");
5
    var BROWSER_NEXT = _("Next");
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
    }
6
//]]>
33
//]]>
7
</script>
34
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt (+429 lines)
Line 0 Link Here
1
[% SET accounts_view = 1 %]
2
[% USE KohaDates %]
3
[% USE Currency %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' %]</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
8
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
9
<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/strings.js"></script>
10
[% INCLUDE 'datatables.inc' %]
11
[% INCLUDE 'browser-strings.inc' %]
12
13
<script type="text/javascript">
14
//<![CDATA[
15
$(document).ready(function() {
16
    $('#account-credits').hide();
17
    $('#account-debits-switcher').click(function() {
18
         $('#account-debits').slideUp();
19
         $('#account-credits').slideDown();
20
    });
21
    $('#account-credits-switcher').click(function() {
22
         $('#account-credits').slideUp();
23
         $('#account-debits').slideDown();
24
    });
25
26
    var anOpen = [];
27
    var sImageUrl = "[% interface %]/[% theme %]/img/";
28
29
    var debitsTable = $('#debits-table').dataTable( {
30
        "bProcessing": true,
31
        "aoColumns": [
32
            {
33
                "mDataProp": null,
34
                "sClass": "control center",
35
                "sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">'
36
            },
37
            { "mDataProp": "debit_id" },
38
            { "mDataProp": "description" },
39
            {
40
                "mDataProp": "type",
41
                "fnRender": function ( o, val ) {
42
                    return STRINGS['DebitTypes'][val];
43
                },
44
            },
45
            { "mDataProp": "amount_original" },
46
            { "mDataProp": "amount_outstanding" },
47
            { "mDataProp": "created_on" },
48
            { "mDataProp": "updated_on" }
49
        ],
50
        "aaData": [
51
            [% FOREACH d IN debits %]
52
                {
53
                    [% PROCESS format_data data=d highlight='debit' %]
54
55
                    // Data for related item if there is one linked
56
                    "title": "[% d.item.biblio.title || d.deleted_item.biblio.title || d.deleted_item.deleted_biblio.title %]",
57
                    "biblionumber": "[% d.item.biblio.biblionumber || d.deleted_item.biblio.biblionumber %]",
58
                    "barcode": "[% d.item.barcode || d.deleted_item.barcode %]",
59
                    "itemnumber": "[% d.item.itemnumber %]", //This way itemnumber will be undef if deleted
60
61
62
                    // Data for related issue if there is one linked
63
                    [% IF d.issue %]
64
                        [% SET table = 'issue' %]
65
                    [% ELSIF d.old_issue %]
66
                        [% SET table = 'old_issue' %]
67
                    [% END %]
68
69
                    [% IF table %]
70
                        "issue": {
71
                            [% PROCESS format_data data=d.$table %]
72
                        },
73
                    [% END %]
74
75
76
                    "account_offsets": [
77
                        [% FOREACH ao IN d.account_offsets %]
78
                            {
79
                                [% PROCESS format_data data=ao highlight='offset'%]
80
81
                                "credit": {
82
                                    [% PROCESS format_data data=ao.credit highlight='credit' %]
83
                                }
84
                            },
85
                        [% END %]
86
                    ]
87
88
                },
89
            [% END %]
90
        ]
91
    } );
92
93
    $('#debits-table td.control').live( 'click', function () {
94
        var nTr = this.parentNode;
95
        var i = $.inArray( nTr, anOpen );
96
97
        if ( i === -1 ) {
98
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
99
            var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' );
100
            $('div.innerDetails', nDetailsRow).slideDown();
101
            anOpen.push( nTr );
102
        }
103
        else {
104
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
105
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
106
                debitsTable.fnClose( nTr );
107
                anOpen.splice( i, 1 );
108
            } );
109
        }
110
    } );
111
112
    var creditsTable = $('#credits-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": "credit_id" },
121
            { "mDataProp": "notes" },
122
            {
123
                "mDataProp": "type",
124
                "fnRender": function ( o, val ) {
125
                    return STRINGS['CreditTypes'][val];
126
                },
127
            },
128
            { "mDataProp": "amount_paid" },
129
            { "mDataProp": "amount_remaining" },
130
            { "mDataProp": "created_on" },
131
            { "mDataProp": "updated_on" }
132
        ],
133
        "aaData": [
134
            [% FOREACH c IN credits %]
135
                {
136
                    [% PROCESS format_data data=c highlight='credit' %]
137
138
                    "account_offsets": [
139
                        [% FOREACH ao IN c.account_offsets %]
140
                            {
141
                                [% PROCESS format_data data=ao highlight='offset' %]
142
143
                                "debit": {
144
                                    [% PROCESS format_data data=ao.debit highlight='debit' %]
145
                                }
146
                            },
147
                        [% END %]
148
                    ]
149
150
                },
151
            [% END %]
152
        ]
153
    } );
154
155
    $('#credits-table td.control').live( 'click', function () {
156
        var nTr = this.parentNode;
157
        var i = $.inArray( nTr, anOpen );
158
159
        if ( i === -1 ) {
160
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
161
            var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' );
162
            $('div.innerDetails', nDetailsRow).slideDown();
163
            anOpen.push( nTr );
164
        }
165
        else {
166
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
167
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
168
                creditsTable.fnClose( nTr );
169
                anOpen.splice( i, 1 );
170
            } );
171
        }
172
    } );
173
174
} );
175
176
function fnFormatDebitDetails( debitsTable, nTr ) {
177
    var oData = debitsTable.fnGetData( nTr );
178
179
    var sOut = "<div class='innerDetails' style='display:none;'>";
180
181
    var account_offsets = oData.account_offsets;
182
183
    sOut += "<a class='debit_print btn btn-small' style='margin:5px;' onclick='accountPrint(\"debit\"," + oData.debit_id + ")'>" +
184
                "<i class='icon-print'></i> " + _("Print receipt") +
185
            "</a>";
186
187
    sOut += "<ul>";
188
    if ( oData.title ) {
189
        sOut += "<li>" + _("Title: ");
190
        if ( oData.biblionumber ) {
191
            sOut += "<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + oData.biblionumber + "'>";
192
        }
193
194
        sOut += oData.title;
195
196
        if ( oData.biblionumber ) {
197
            sOut += "</a>";
198
        }
199
200
        sOut += "</li>";
201
    }
202
203
    if ( oData.barcode ) {
204
        sOut += "<li>" + _("Barcode: ");
205
        if ( oData.itemnumber ) {
206
            sOut += "<a href='/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=11&biblionumber=" + oData.biblionumber + "&bi=" + oData.biblionumber + "#item" + oData.itemnumber + "" + oData.biblionumber + "'>";
207
        }
208
209
        sOut += oData.barcode;
210
211
        if ( oData.itemnumber ) {
212
            sOut += "</a>";
213
        }
214
215
        sOut += "</li>";
216
    }
217
218
    if ( oData.notes ) {
219
        sOut += "<li>" + _("Notes: ") + oData.notes + "</li>";
220
    }
221
222
    sOut += "</ul>";
223
224
    if ( account_offsets.length ) {
225
        sOut +=
226
            "<div class='innerDetails'>" +
227
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
228
                    "<thead>" +
229
                        "<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" +
230
                        "<tr>" +
231
                            "<th>" + _("ID") + "</th>" +
232
                            "<th>" + _("Created on") + "</th>" +
233
                            "<th>" + _("Payment amount") + "</th>" +
234
                            "<th>" + _("Applied amount") + "</th>" +
235
                            "<th>" + _("Type") + "</th>" +
236
                            "<th>" + _("Notes") + "</th>" +
237
                        "</tr>" +
238
                    "</thead>" +
239
                    "<tbody>";
240
241
        for ( var i = 0; i < account_offsets.length; i++ ) {
242
            ao = account_offsets[i];
243
            sOut +=
244
            "<tr>" +
245
                "<td>" + ao.credit_id + "</td>" +
246
                "<td>" + ao.created_on + "</td>" +
247
                "<td>" + ao.credit.amount_paid + "</td>" +
248
                "<td>" + ao.amount + "</td>" +
249
                "<td>" + STRINGS["CreditTypes"][ao.credit.type] + "</td>" +
250
                "<td>" + ao.credit.notes + "</td>" +
251
            "</tr>";
252
        }
253
254
        sOut +=
255
            "</tbody>"+
256
            "</table>";
257
    }
258
259
    sOut +=
260
        "</div>";
261
262
    return sOut;
263
}
264
265
function fnFormatCreditDetails( creditsTable, nTr ) {
266
    var oData = creditsTable.fnGetData( nTr );
267
268
    var sOut = "<div class='innerDetails' style='display:none;'>";
269
270
    sOut += "<button class='credit_print btn btn-small' style='margin:5px;' onclick='accountPrint(\"credit\"," + oData.credit_id + ")'>" +
271
                "<i class='icon-print'></i> " + _("Print receipt") +
272
            "</button>";
273
274
    var account_offsets = oData.account_offsets;
275
276
    if ( account_offsets.length ) {
277
        sOut +=
278
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
279
                    "<thead>" +
280
                        "<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" +
281
                        "<tr>" +
282
                            "<th>" + _("ID") + "</th>" +
283
                            "<th>" + _("Description") + "</th>" +
284
                            "<th>" + _("Type") + "</th>" +
285
                            "<th>" + _("Amount") + "</th>" +
286
                            "<th>" + _("Remaining") + "</th>" +
287
                            "<th>" + _("Created on") + "</th>" +
288
                            "<th>" + _("Updated on") + "</th>" +
289
                            "<th>" + _("Notes") + "</th>" +
290
                        "</tr>" +
291
                    "</thead>" +
292
                    "<tbody>";
293
294
        for ( var i = 0; i < account_offsets.length; i++ ) {
295
            ao = account_offsets[i];
296
            sOut +=
297
            "<tr>" +
298
                "<td>" + ao.debit.debit_id + "</td>" +
299
                "<td>" + ao.debit.description + "</td>" +
300
                "<td>" + STRINGS["DebitTypes"][ao.debit.type] + "</td>" +
301
                "<td>" + ao.debit.amount_original + "</td>" +
302
                "<td>" + ao.debit.amount_outstanding + "</td>" +
303
                "<td>" + ao.debit.created_on + "</td>" +
304
                "<td>" + ao.debit.updated_on + "</td>" +
305
                "<td>" + ao.debit.notes + "</td>" +
306
            "</tr>";
307
        }
308
309
        sOut +=
310
            "</tbody>"+
311
            "</table>";
312
    }
313
314
    sOut +=
315
        "</div>";
316
317
    return sOut;
318
}
319
320
function accountPrint( type, id ) {
321
    window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id );
322
}
323
//]]>
324
</script>
325
</head>
326
<body>
327
[% INCLUDE 'header.inc' %]
328
[% INCLUDE 'patron-search.inc' %]
329
330
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Account for [% INCLUDE 'patron-title.inc' %]</div>
331
332
<div id="doc3" class="yui-t2">
333
    <div id="bd">
334
           <div id="yui-main">
335
                <div class="yui-b">
336
                [% INCLUDE 'members-toolbar.inc' %]
337
338
                <div class="statictabs">
339
                    <ul>
340
                        <li class="active">
341
                            <a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a>
342
                        </li>
343
344
                        <li>
345
                            <a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a>
346
                        </li>
347
348
                        <li>
349
                            <a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a>
350
                        </li>
351
352
                        <li>
353
                            <a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a>
354
                        </li>
355
                    </ul>
356
                </div>
357
358
                <div class="tabs-container">
359
360
                    <p>
361
                        <h3>Account balance: [% borrower.account_balance | $Currency %]</h3>
362
                    </p>
363
364
                    <div>
365
                        <div id="account-debits">
366
                            <a id="account-debits-switcher" href="#" onclick="return false">View payments</a>
367
                            <table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table">
368
                                <thead>
369
                                    <tr>
370
                                        <th colspan="99">Fees</th>
371
                                    </tr>
372
                                    <tr>
373
                                        <th></th>
374
                                        <th>ID</th>
375
                                        <th>Description</th>
376
                                        <th>Type</th>
377
                                        <th>Amount</th>
378
                                        <th>Outsanding</th>
379
                                        <th>Created on</th>
380
                                        <th>Updated on</th>
381
                                    </tr>
382
                                </thead>
383
                                <tbody></tbody>
384
                            </table>
385
                        </div>
386
387
                        <div id="account-credits">
388
                            <a id="account-credits-switcher" href="#"  onclick="return false">View fees</a>
389
                            <table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table">
390
                                <thead>
391
                                    <tr>
392
                                        <th colspan="99">Payments</th>
393
                                    </tr>
394
                                    <tr>
395
                                        <th></th>
396
                                        <th>ID</th>
397
                                        <th>Notes</th>
398
                                        <th>Type</th>
399
                                        <th>Amount</th>
400
                                        <th>Remaining</th>
401
                                        <th>Created on</th>
402
                                        <th>Updated on</th>
403
                                    </tr>
404
                                </thead>
405
                                <tbody></tbody>
406
                            </table>
407
                        </div>
408
                    </div>
409
                </div>
410
            </div>
411
        </div>
412
413
    <div class="yui-b">
414
        [% INCLUDE 'circ-menu.inc' %]
415
    </div>
416
</div>
417
[% INCLUDE 'intranet-bottom.inc' %]
418
419
[% BLOCK format_data %]
420
    [% FOREACH key IN data.result_source.columns %]
421
        [% IF key.match('^amount') %]
422
            "[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]",
423
        [% ELSIF key.match('_on$') %]
424
            "[% key %]": "[% data.$key | $KohaDates %]",
425
        [% ELSE %]
426
            "[% key %]": "[% data.$key %]",
427
        [% END %]
428
    [% END %]
429
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_credit.tt (+92 lines)
Line 0 Link Here
1
[% SET accounts_view = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Borrowers &rsaquo; Create manual credit</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
<script type="text/javascript">
6
//<![CDATA[
7
$(document).ready(function(){
8
        $('#account_credit').preventDoubleFormSubmit();
9
        $("fieldset.rows input").addClass("noEnterSubmit");
10
});
11
//]]>
12
</script>
13
</head>
14
<body id="pat_account_credit" class="pat">
15
    [% INCLUDE 'header.inc' %]
16
    [% INCLUDE 'patron-search.inc' %]
17
18
    <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Manual credit</div>
19
20
    <div id="doc3" class="yui-t2">
21
        <div id="bd">
22
               <div id="yui-main">
23
            <div class="yui-b">
24
                    [% INCLUDE 'members-toolbar.inc' %]
25
26
                    <div class="statictabs">
27
                        <ul>
28
                            <li><a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
29
                            <li><a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
30
                            <li><a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a></li>
31
                            <li class="active"><a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a></li>
32
                        </ul>
33
34
                        <div class="tabs-container">
35
36
                            <form action="/cgi-bin/koha/members/account_credit_do.pl" method="post" id="account_credit">
37
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
38
39
                                <fieldset class="rows">
40
                                    <legend>Manual credit</legend>
41
42
                                    <ol>
43
                                        <li>
44
                                            <label for="type">Credit Type: </label>
45
                                            <select name="type" id="type">
46
                                                <option value="CREDIT">Credit</option>
47
                                                <option value="FORGIVEN">Forgiven</option>
48
                                                [% FOREACH c IN credit_types_loop %]
49
                                                    <option value="[% c.authorised_value %]">[% c.lib %]</option>
50
                                                [% END %]
51
                                            </select>
52
                                        </li>
53
54
                                        <li>
55
                                            <label for="barcode">Barcode: </label>
56
                                            <input type="text" name="barcode" id="barcode" />
57
                                        </li>
58
59
                                        <li>
60
                                            <label for="desc">Description: </label>
61
                                            <input type="text" name="desc" size="50" id="desc" />
62
                                        </li>
63
64
                                        <li>
65
                                            <label for="note">Note: </label>
66
                                            <input type="text" name="note" size="50" id="note" />
67
                                        </li>
68
69
                                        <li>
70
                                            <label for="amount">Amount: </label>
71
                                            <input type="text" name="amount" id="amount" />
72
                                            Example: 5.00
73
                                        </li>
74
                                    </ol>
75
76
                                </fieldset>
77
78
                                <fieldset class="action">
79
                                    <input type="submit" name="add" value="Add credit" />
80
                                    <a class="cancel" href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
81
                                </fieldset>
82
                            </form>
83
84
                        </div>
85
                    </div>
86
                </div>
87
            </div>
88
        <div class="yui-b">
89
            [% INCLUDE 'circ-menu.inc' %]
90
        </div>
91
    </div>
92
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_debit.tt (+109 lines)
Line 0 Link Here
1
[% SET accounts_view = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Borrowers &rsaquo; Create manual invoice</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
<script type="text/javascript">
6
//<![CDATA[
7
$(document).ready(function(){
8
    $('#maninvoice').preventDoubleFormSubmit();
9
    $("fieldset.rows input").addClass("noEnterSubmit");
10
11
    var type_fees = new Array();
12
    type_fees['L'] = '';
13
    type_fees['F'] = '';
14
    type_fees['A'] = '';
15
    type_fees['N'] = '';
16
    type_fees['M'] = '';
17
    [% FOREACH invoice_types_loo IN invoice_types_loop %]
18
        type_fees['[% invoice_types_loo.authorised_value %]'] = "[% invoice_types_loo.lib %]";
19
    [% END %]
20
});
21
//]]>
22
</script>
23
</head>
24
25
<body>
26
    [% INCLUDE 'header.inc' %]
27
    [% INCLUDE 'patron-search.inc' %]
28
29
    <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Manual invoice</div>
30
31
    <div id="doc3" class="yui-t2">
32
        <div id="bd">
33
            <div id="yui-main">
34
                <div class="yui-b">
35
                    [% INCLUDE 'members-toolbar.inc' %]
36
37
                    <div class="statictabs">
38
                    <ul>
39
                        <li><a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
40
                        <li><a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
41
                        <li class="active"><a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a></li>
42
                        <li><a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a></li>
43
                    </ul>
44
                    <div class="tabs-container">
45
46
                    <form action="/cgi-bin/koha/members/account_debit_do.pl" method="post" id="account_debit">
47
                        <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
48
49
                        <fieldset class="rows">
50
                            <legend>Manual Invoice</legend>
51
52
                            <ol>
53
                                <li>
54
                                    <label for="type">Type: </label>
55
                                    <select name="type" id="type">
56
                                        <option value="LOST">Lost item</option>
57
                                        <option value="FINE">Fine</option>
58
                                        <option value="ACCOUNT_MANAGEMENT_FEE">Account management fee</option>
59
                                        <option value="NEW_CARD">New card</option>
60
                                        <option value="SUNDRY">Sundry</option>
61
62
                                        [% FOREACH invoice_types_loo IN invoice_types_loop %]
63
                                            <option value="[% invoice_types_loo.authorised_value %]">[% invoice_types_loo.lib %]</option>
64
                                        [% END %]
65
                                    </select>
66
                                </li>
67
68
                                <!-- TODO: Write ajax barcode validator that appends the itemnumber for this form in a hidden input -->
69
                                 <li>
70
                                    <label for="barcode">Barcode: </label>
71
                                    <input type="text" name="barcode" id="barcode" />
72
                                </li>
73
74
                                <li>
75
                                    <label for="description">Description: </label>
76
                                    <input type="text" name="description" id="description" size="50" />
77
                                </li>
78
79
                                <li>
80
                                    <label for="notes">Notes: </label>
81
                                    <input type="text" name="notes" size="50" id="notes" />
82
                                </li>
83
84
                                <li>
85
                                    <label for="amount">Amount: </label>
86
                                    <input type="text" name="amount" id="amount" /> Example: 5.00
87
                                </li>
88
89
                            </ol>
90
                        </fieldset>
91
92
                        <fieldset class="action">
93
                            <input type="submit" name="add" value="Save" />
94
                            <a class="cancel" href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
95
                        </fieldset>
96
97
                    </form>
98
99
                </div>
100
            </div>
101
        </div>
102
    </div>
103
104
<div class="yui-b">
105
  [% INCLUDE 'circ-menu.inc' %]
106
</div>
107
108
</div>
109
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_payment.tt (+226 lines)
Line 0 Link Here
1
[% SET accounts_view = 1 %]
2
[% USE Currency %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'browser-strings.inc' %]
7
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8
<script type= "text/javascript">
9
//<![CDATA[
10
$( document ).ready(function() {
11
    // Convert codes to translated strings
12
    $(".debit-type").each(function() {
13
        $(this).html( STRINGS['DebitTypes'][ $(this).html() ] );
14
    });
15
16
    // Show amount recieved only if the "Receive different amount" checkbox is checked
17
    $("#amount-received-p").hide();
18
    $("#receive_different_amount").click(function() {
19
        if( $(this).is(':checked')) {
20
            $("#amount-received-p").show();
21
            $("#amount_received").focus();
22
        } else {
23
            $("#amount-received-p").hide();
24
        }
25
    });
26
27
    $("#amount_received").keyup(function() {
28
        // Allow only numbers in ammount received
29
        $(this).val($(this).val().replace(/[^\d.]/g, ''));
30
31
        // Make sure the amount recieved is greater than the amount to pay if it is being used
32
        if ( $("#amount_to_pay").val() && parseFloat( $("#amount_received").val() ) < parseFloat( $("#amount_to_pay").val() ) ) {
33
            $("#process").attr('disabled','disabled');
34
        } else {
35
            $("#process").removeAttr('disabled');
36
        }
37
    });
38
39
    // Allow only numbers in ammount to pay
40
    $("#amount_to_pay").keyup(function() {
41
        var $this = $(this);
42
        $this.val($this.val().replace(/[^\d.]/g, ''));
43
    });
44
45
    // Enable the "Select all/Clear all" links
46
    $('#CheckAll').click(function() {
47
        $("input[name='debit_id']" ).prop('checked', true).trigger("change");
48
    });
49
    $('#ClearAll').click(function() {
50
        $("input[name='debit_id']" ).prop('checked', false).trigger("change");
51
    });
52
53
    // Update the "amount to pay" field whenever a fee checkbox is changed
54
    // Note, this is just a payment suggestion and can be changed to any amount
55
    $("input[name='debit_id']" ).change(function() {
56
        var sum = 0;
57
        $("input[name='debit_id']:checked" ).each(function(i,n){
58
            sum += parseFloat( $( "#amount_outstanding_" + $(this).val() ).val() );
59
        });
60
        $('#amount_to_pay').val( sum );
61
    });
62
});
63
64
function checkForm(){
65
    // If using the "amount to receive" field, make sure the librarian is recieving at
66
    // least enough to pay those fees.
67
    if ( $('#amount_received').val() ) {
68
        if ( parseFloat( $('#amount_received').val() ) < parseFloat( $('#amount_to_pay').val() ) ) {
69
            alert( _("Cannot pay more than receieved!") );
70
            return false;
71
        }
72
    }
73
74
    return true;
75
}
76
//]]>
77
</script>
78
</head>
79
<body id="pat_pay" class="pat">
80
    [% INCLUDE 'header.inc' %]
81
    [% INCLUDE 'patron-search.inc' %]
82
83
    <div id="breadcrumbs">
84
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
85
        &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
86
        &rsaquo; Pay fines for [% borrower.firstname %] [% borrower.surname %]
87
    </div>
88
89
    <div id="doc3" class="yui-t2">
90
        <div id="bd">
91
            <div id="yui-main">
92
                <div class="yui-b">
93
                    [% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %]
94
95
                    <div class="statictabs">
96
                        <ul>
97
                            <li><a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a></li>
98
                            <li class="active"><a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a></li>
99
                            <li><a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual invoice</a></li>
100
                            <li><a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a></li>
101
                        </ul>
102
103
                        <div class="tabs-container">
104
105
                        [% IF ( debits ) %]
106
                            <form action="/cgi-bin/koha/members/account_payment_do.pl" method="post" id="account-payment-form" onsubmit="return checkForm()">
107
108
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
109
110
                                <p>
111
                                    <span class="checkall">
112
                                        <a id="CheckAll" href="#">Select all</a>
113
                                    </span>
114
115
                                    |
116
117
                                    <span class="clearall">
118
                                        <a id="ClearAll" href="#">Clear all</a>
119
                                    </span>
120
                                </p>
121
122
                                <table id="finest">
123
                                    <thead>
124
                                        <tr>
125
                                            <th>&nbsp;</th>
126
                                            <th>Description</th>
127
                                            <th>Account type</th>
128
                                            <th>Original amount</th>
129
                                            <th>Amount outstanding</th>
130
                                        </tr>
131
                                    </thead>
132
133
                                    <tbody>
134
                                        [% SET total_due = 0 %]
135
                                        [% FOREACH d IN debits %]
136
                                            [% SET total_due = total_due + d.amount_outstanding %]
137
                                            <tr>
138
                                                <td>
139
                                                    <input type="checkbox" checked="checked" name="debit_id" value="[% d.debit_id %]" />
140
                                                </td>
141
142
                                                <td>
143
                                                    [% d.description %]
144
145
                                                    [% IF d.notes %]
146
                                                        ( <i>[% d.notes %]</i> )
147
                                                    [% END %]
148
                                                </td>
149
150
                                                <td>
151
                                                    <span class="debit-type">[% d.type %]</span>
152
                                                </td>
153
154
                                                <td class="debit">
155
                                                    [% d.amount_original | $Currency %]
156
                                                    <input type="hidden" id="amount_original_[% d.debit_id %]" value="[% Currency.format_without_symbol( d.amount_original ) %]" />
157
                                                </td>
158
159
                                                <td class="debit">
160
                                                    [% d.amount_outstanding | $Currency %]
161
                                                    <input type="hidden" id="amount_outstanding_[% d.debit_id %]" value="[% Currency.format_without_symbol( d.amount_outstanding ) %]" />
162
                                                </td>
163
                                            </tr>
164
                                        [% END %]
165
                                    </tbody>
166
167
                                    <tfoot>
168
                                        <tr>
169
                                            <td class="total" colspan="4">Total Due:</td>
170
                                            <td>[% total_due | $Currency %]</td>
171
                                        </tr>
172
                                    </tfoot>
173
174
                                </table>
175
176
                                <fieldset>
177
                                    <p>
178
                                        <label for="amount_to_pay">Amount to pay: [% Currency.symbol() %]</label>
179
                                        <input type="text" name="amount_to_pay" id="amount_to_pay" value="[% Currency.format_without_symbol( total_due ) %]" />
180
181
                                        <input type="checkbox" id="receive_different_amount" />
182
                                        <label for="receive_different_amount"><i>Receive different amount</i></label>
183
                                    </p>
184
185
                                    <p id="amount-received-p">
186
                                        <label for="amount_received">Amount recieved: [% Currency.symbol() %]</label>
187
                                        <input type="text" name="amount_received" id="amount_received" />
188
                                    </p>
189
190
                                    <p>
191
                                        <label for="type">Type:</label>
192
                                        <select id="type" name="type">
193
                                            <option value="PAYMENT">Payment</option>
194
                                            <option value="WRITEOFF">Writeoff</option>
195
                                        </select>
196
                                    </p>
197
198
                                    <p>
199
                                        <label for="notes">Payment notes:</label>
200
                                        <input type="textbox" name="notes" id="notes" />
201
                                    <p>
202
                                </fieldset>
203
204
                                <fieldset class="action">
205
                                    <input type="submit" id="process" value="Process" class="submit" />
206
                                    <a class="cancel" href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
207
                                </fieldset>
208
209
                            </form>
210
211
                        [% ELSE %]
212
                            <p>
213
                                [% borrower.firstname %] [% borrower.surname %] has no outstanding fines.
214
                            </p>
215
                        [% END %]
216
217
                    </div>
218
                </div>
219
            </div>
220
        </div>
221
222
        <div class="yui-b">
223
            [% INCLUDE 'circ-menu.tt' %]
224
        </div>
225
    </div>
226
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_print.tt (+146 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% USE Currency %]
3
[% USE EncodeUTF8 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Print Receipt for [% cardnumber %]</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
9
<script type="text/javascript">
10
    function printThenClose() {
11
        window.print();
12
        window.close();
13
    }
14
</script>
15
</head>
16
17
[% SET account = debit || credit %]
18
[% SET borrower = account.borrower %]
19
20
<body id="account-print-body" onload="printThenClose();">
21
22
    <table>
23
        <thead>
24
            <tr>
25
                <th colspan="99">
26
                    [% IF debit %]
27
                        Invoice
28
                    [% ELSIF credit %]
29
                        Payment receipt
30
                    [% END %]
31
                </th>
32
            </tr>
33
34
            <tr>
35
                <th colspan="99">
36
                    [% borrower.branch.branchname | $EncodeUTF8 %]
37
                </th>
38
            </tr>
39
40
            <tr>
41
                <th>Name:</th>
42
                <th colspan="99">[% borrower.firstname | $EncodeUTF8 %] [% borrower.surname | $EncodeUTF8 %]</th>
43
            </tr>
44
45
            <tr>
46
                <th>Card number:</th>
47
                <th colspan="99">[% borrower.cardnumber %]</th>
48
            </tr>
49
50
            <tr>
51
                <th>Date:</th>
52
                <th colspan="99">[% account.created_on | $KohaDates %]</th>
53
            </tr>
54
55
            [% IF account.description %]
56
                <tr>
57
                    <th>Description:</th>
58
                    <th colspan="99">[% account.description | $EncodeUTF8 %]</th>
59
                </tr>
60
            [% END %]
61
62
            [% IF credit %]
63
                <tr>
64
                    <th>Amount paid:</th>
65
                    <th colspan="99">[% credit.amount_paid | $Currency highlight => type %]</th>
66
                </tr>
67
                [% IF credit.amount_received %]
68
                    <tr>
69
                        <th>Amount received:</th>
70
                        <th colspan="99">[% credit.amount_received | $Currency highlight => type %]</th>
71
                    </tr>
72
                    <tr>
73
                        <th>Change due:</th>
74
                        <th colspan="99">[% credit.amount_received - credit.amount_paid | $Currency highlight => type %]</th>
75
                    </tr>
76
                [% END %]
77
                <tr>
78
                    <th>Balance:</th>
79
                    <th colspan="99">[% credit.amount_remaining | $Currency highlight => type %]</th>
80
                </tr>
81
                [% IF credit.account_offsets %]
82
                    <tr>
83
                        <th colspan="99">Fees paid</th>
84
                    </tr>
85
                    <tr>
86
                        <th>Description</th>
87
                        <th>Type</th>
88
                        <th>Amount</th>
89
                        <th>Paid</th>
90
                        <th>Outstanding</th>
91
                        <th>Date</th>
92
                    </tr>
93
                [% END %]
94
            [% ELSIF debit %]
95
                <tr>
96
                    <th>Amount:</th>
97
                    <th colspan="99">[% debit.amount_original | $Currency highlight => type %]</th>
98
                </tr>
99
                <tr>
100
                    <th>Outstanding:</th>
101
                    <th colspan="99">[% debit.amount_outstanding | $Currency highlight => type %]</th>
102
                </tr>
103
                [% IF debit.account_offsets %]
104
                    <tr>
105
                        <th colspan="99">Payments applied</th>
106
                    </tr>
107
                    <tr>
108
                        <th>Date</th>
109
                        <th>Type</th>
110
                        <th>Payment</th>
111
                        <th>Applied</th>
112
                        <th>Balance</th>
113
                        <th>Notes</th>
114
                    </tr>
115
                [% END %]
116
            [% END %]
117
        </thead>
118
119
        <tbody>
120
            [% IF credit.account_offsets %]
121
                [% FOREACH ao IN credit.account_offsets %]
122
                    <tr>
123
                        <td>[% ao.debit.description %]</td>
124
                        <td>[% ao.debit.type %]</td>
125
                        <td>[% ao.debit.amount_original | $Currency highlight => 'debit' %]</td>
126
                        <td>[% ao.amount | $Currency highlight => 'offset' %]</td>
127
                        <td>[% ao.debit.amount_outstanding | $Currency highlight => 'debit' %]</td>
128
                        <td>[% ao.debit.created_on | $KohaDates %]</td>
129
                    </tr>
130
                [% END %]
131
            [% ELSIF debit.account_offsets %]
132
                [% FOREACH ao IN debit.account_offsets %]
133
                    <tr>
134
                        <td>[% ao.credit.created_on | $KohaDates %]</td>
135
                        <td>[% ao.credit.type %]</td>
136
                        <td>[% ao.credit.amount_paid | $Currency highlight => 'credit' %]</td>
137
                        <td>[% ao.amount | $Currency highlight => 'offset' %]</td>
138
                        <td>[% ao.credit.amount_remaining | $Currency highlight => 'credit' %]</td>
139
                        <td>[% ao.credit.notes %]</td>
140
                    </tr>
141
                [% END %]
142
            [% END %]
143
        </tbody>
144
    </table>
145
146
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/members/account.pl (+112 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2000-2002 Katipo Communications
4
# Copyright 2013 ByWater Solutions
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 3 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
use CGI;
24
25
use C4::Auth;
26
use C4::Output;
27
use C4::Dates qw/format_date/;
28
use C4::Members;
29
use C4::Branch;
30
use C4::Members::Attributes qw(GetBorrowerAttributes);
31
use Koha::Database;
32
33
my $cgi = new CGI;
34
35
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
36
    {
37
        template_name   => "members/account.tt",
38
        query           => $cgi,
39
        type            => "intranet",
40
        authnotrequired => 0,
41
        flagsrequired   => { borrowers => 1, updatecharges => 1 },
42
        debug           => 1,
43
    }
44
);
45
46
my $borrowernumber = $cgi->param('borrowernumber');
47
48
my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
49
50
my @debits = Koha::Database->new()->schema->resultset('AccountDebit')->search(
51
    { 'me.borrowernumber' => $borrowernumber },
52
    { prefetch            => { account_offsets => 'credit' } }
53
);
54
55
my @credits = Koha::Database->new()->schema->resultset('AccountCredit')->search(
56
    { 'me.borrowernumber' => $borrowernumber },
57
    { prefetch            => { account_offsets => 'debit' } }
58
);
59
60
$template->param(
61
    debits   => \@debits,
62
    credits  => \@credits,
63
    borrower => $borrower,
64
);
65
66
# Standard /members/ borrower details data
67
## FIXME: This code is in every /members/ script and should be unified
68
69
if ( $borrower->{'category_type'} eq 'C' ) {
70
    my ( $catcodes, $labels ) =
71
      GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
72
    my $cnt = scalar(@$catcodes);
73
    $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
74
    $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
75
}
76
77
my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
78
$template->param( picture => 1 ) if $picture;
79
80
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
81
    my $attributes = GetBorrowerAttributes($borrowernumber);
82
    $template->param(
83
        ExtendedPatronAttributes => 1,
84
        extendedattributes       => $attributes
85
    );
86
}
87
88
$template->param(
89
    borrowernumber => $borrowernumber,
90
    firstname      => $borrower->{'firstname'},
91
    surname        => $borrower->{'surname'},
92
    cardnumber     => $borrower->{'cardnumber'},
93
    categorycode   => $borrower->{'categorycode'},
94
    category_type  => $borrower->{'category_type'},
95
    categoryname   => $borrower->{'description'},
96
    address        => $borrower->{'address'},
97
    address2       => $borrower->{'address2'},
98
    city           => $borrower->{'city'},
99
    state          => $borrower->{'state'},
100
    zipcode        => $borrower->{'zipcode'},
101
    country        => $borrower->{'country'},
102
    phone          => $borrower->{'phone'},
103
    email          => $borrower->{'email'},
104
    branchcode     => $borrower->{'branchcode'},
105
    branchname     => GetBranchName( $borrower->{'branchcode'} ),
106
    is_child       => ( $borrower->{'category_type'} eq 'C' ),
107
    activeBorrowerRelationship =>
108
      ( C4::Context->preference('borrowerRelationship') ne '' ),
109
    RoutingSerials => C4::Context->preference('RoutingSerials'),
110
);
111
112
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/members/account_credit.pl (+103 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#written 11/1/2000 by chris@katipo.oc.nz
4
#script to display borrowers account details
5
6
# Copyright 2000-2002 Katipo Communications
7
# Copyright 2010 BibLibre
8
#
9
# This file is part of Koha.
10
#
11
# Koha is free software; you can redistribute it and/or modify it under the
12
# terms of the GNU General Public License as published by the Free Software
13
# Foundation; either version 3 of the License, or (at your option) any later
14
# version.
15
#
16
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License along
21
# with Koha; if not, write to the Free Software Foundation, Inc.,
22
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24
use strict;
25
use warnings;
26
27
use C4::Auth;
28
use C4::Output;
29
use CGI;
30
31
use C4::Koha;
32
use C4::Members;
33
use C4::Branch;
34
use C4::Items;
35
use C4::Members::Attributes qw(GetBorrowerAttributes);
36
use Koha::Database;
37
38
my $cgi = new CGI;
39
40
my $borrowernumber = $cgi->param('borrowernumber');
41
42
my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
43
44
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
45
    {
46
        template_name   => "members/account_credit.tt",
47
        query           => $cgi,
48
        type            => "intranet",
49
        authnotrequired => 0,
50
        flagsrequired   => { borrowers => 1, updatecharges => 1 },
51
        debug           => 1,
52
    }
53
);
54
55
$template->param( credit_types_loop => GetAuthorisedValues('ACCOUNT_CREDIT') );
56
57
# Standard /members/ borrower details data
58
## FIXME: This code is in every /members/ script and should be unified
59
60
if ( $borrower->{'category_type'} eq 'C' ) {
61
    my ( $catcodes, $labels ) =
62
      GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
63
    my $cnt = scalar(@$catcodes);
64
    $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
65
    $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
66
}
67
68
my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
69
$template->param( picture => 1 ) if $picture;
70
71
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
72
    my $attributes = GetBorrowerAttributes($borrowernumber);
73
    $template->param(
74
        ExtendedPatronAttributes => 1,
75
        extendedattributes       => $attributes
76
    );
77
}
78
79
$template->param(
80
    borrowernumber => $borrowernumber,
81
    firstname      => $borrower->{'firstname'},
82
    surname        => $borrower->{'surname'},
83
    cardnumber     => $borrower->{'cardnumber'},
84
    categorycode   => $borrower->{'categorycode'},
85
    category_type  => $borrower->{'category_type'},
86
    categoryname   => $borrower->{'description'},
87
    address        => $borrower->{'address'},
88
    address2       => $borrower->{'address2'},
89
    city           => $borrower->{'city'},
90
    state          => $borrower->{'state'},
91
    zipcode        => $borrower->{'zipcode'},
92
    country        => $borrower->{'country'},
93
    phone          => $borrower->{'phone'},
94
    email          => $borrower->{'email'},
95
    branchcode     => $borrower->{'branchcode'},
96
    branchname     => GetBranchName( $borrower->{'branchcode'} ),
97
    is_child       => ( $borrower->{'category_type'} eq 'C' ),
98
    activeBorrowerRelationship =>
99
      ( C4::Context->preference('borrowerRelationship') ne '' ),
100
    RoutingSerials => C4::Context->preference('RoutingSerials'),
101
);
102
103
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/members/account_credit_do.pl (+66 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2013 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
24
use C4::Auth;
25
use C4::Output;
26
use C4::Members;
27
use C4::Items;
28
use C4::Branch;
29
use C4::Members::Attributes qw(GetBorrowerAttributes);
30
use Koha::Accounts;
31
use Koha::Database;
32
33
my $cgi = new CGI;
34
35
my $borrowernumber = $cgi->param('borrowernumber');
36
my $borrower =
37
  Koha::Database->new()->schema->resultset('Borrower')->find($borrowernumber);
38
39
if ( checkauth( $cgi, 0, { borrowers => 1 }, 'intranet' ) ) {
40
41
    my $barcode     = $cgi->param('barcode');
42
    my $itemnumber  = $cgi->param('itemnumber');
43
    my $description = $cgi->param('description');
44
    my $amount      = $cgi->param('amount');
45
    my $type        = $cgi->param('type');
46
    my $notes       = $cgi->param('notes');
47
48
    if ( !$itemnumber && $barcode ) {
49
        $itemnumber = GetItemnumberFromBarcode($barcode);
50
    }
51
52
    my $debit = AddCredit(
53
        {
54
            borrower    => $borrower,
55
            amount      => $amount,
56
            type        => $type,
57
            itemnumber  => $itemnumber,
58
            description => $description,
59
            notes       => $notes,
60
61
        }
62
    );
63
64
    print $cgi->redirect(
65
        "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
66
}
(-)a/members/account_debit.pl (+104 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#written 11/1/2000 by chris@katipo.oc.nz
4
#script to display borrowers account details
5
6
# Copyright 2000-2002 Katipo Communications
7
# Copyright 2010 BibLibre
8
#
9
# This file is part of Koha.
10
#
11
# Koha is free software; you can redistribute it and/or modify it under the
12
# terms of the GNU General Public License as published by the Free Software
13
# Foundation; either version 3 of the License, or (at your option) any later
14
# version.
15
#
16
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License along
21
# with Koha; if not, write to the Free Software Foundation, Inc.,
22
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24
use strict;
25
use warnings;
26
27
use CGI;
28
29
use C4::Auth;
30
use C4::Output;
31
use C4::Members;
32
use C4::Items;
33
use C4::Branch;
34
use C4::Members::Attributes qw(GetBorrowerAttributes);
35
use C4::Koha;
36
use Koha::Accounts;
37
use Koha::Database;
38
39
my $input = new CGI;
40
41
my $borrowernumber = $input->param('borrowernumber');
42
43
my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
44
45
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
46
    {
47
        template_name   => "members/account_debit.tt",
48
        query           => $input,
49
        type            => "intranet",
50
        authnotrequired => 0,
51
        flagsrequired   => { borrowers => 1, updatecharges => 1 },
52
        debug           => 1,
53
    }
54
);
55
56
$template->param( invoice_types_loop => GetAuthorisedValues('MANUAL_INV') );
57
58
# Standard /members/ borrower details data
59
## FIXME: This code is in every /members/ script and should be unified
60
61
if ( $borrower->{'category_type'} eq 'C' ) {
62
    my ( $catcodes, $labels ) =
63
      GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
64
    my $cnt = scalar(@$catcodes);
65
    $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
66
    $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
67
}
68
69
my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
70
$template->param( picture => 1 ) if $picture;
71
72
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
73
    my $attributes = GetBorrowerAttributes($borrowernumber);
74
    $template->param(
75
        ExtendedPatronAttributes => 1,
76
        extendedattributes       => $attributes
77
    );
78
}
79
80
$template->param(
81
    borrowernumber => $borrowernumber,
82
    firstname      => $borrower->{'firstname'},
83
    surname        => $borrower->{'surname'},
84
    cardnumber     => $borrower->{'cardnumber'},
85
    categorycode   => $borrower->{'categorycode'},
86
    category_type  => $borrower->{'category_type'},
87
    categoryname   => $borrower->{'description'},
88
    address        => $borrower->{'address'},
89
    address2       => $borrower->{'address2'},
90
    city           => $borrower->{'city'},
91
    state          => $borrower->{'state'},
92
    zipcode        => $borrower->{'zipcode'},
93
    country        => $borrower->{'country'},
94
    phone          => $borrower->{'phone'},
95
    email          => $borrower->{'email'},
96
    branchcode     => $borrower->{'branchcode'},
97
    branchname     => GetBranchName( $borrower->{'branchcode'} ),
98
    is_child       => ( $borrower->{'category_type'} eq 'C' ),
99
    activeBorrowerRelationship =>
100
      ( C4::Context->preference('borrowerRelationship') ne '' ),
101
    RoutingSerials => C4::Context->preference('RoutingSerials'),
102
);
103
104
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/account_debit_do.pl (+67 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2013 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
24
use C4::Auth;
25
use C4::Output;
26
use C4::Members;
27
use C4::Items;
28
use C4::Branch;
29
use C4::Members::Attributes qw(GetBorrowerAttributes);
30
use Koha::Accounts;
31
use Koha::Database;
32
33
my $cgi = new CGI;
34
35
my $borrowernumber = $cgi->param('borrowernumber');
36
my $borrower =
37
  Koha::Database->new()->schema->resultset('Borrower')->find($borrowernumber);
38
39
if ( checkauth( $cgi, 0, { borrowers => 1 }, 'intranet' ) ) {
40
41
    #  print $cgi->header;
42
    my $barcode     = $cgi->param('barcode');
43
    my $itemnumber  = $cgi->param('itemnumber');
44
    my $description = $cgi->param('description');
45
    my $amount      = $cgi->param('amount');
46
    my $type        = $cgi->param('type');
47
    my $notes       = $cgi->param('notes');
48
49
    if ( !$itemnumber && $barcode ) {
50
        $itemnumber = GetItemnumberFromBarcode($barcode);
51
    }
52
53
    my $debit = AddDebit(
54
        {
55
            borrower    => $borrower,
56
            amount      => $amount,
57
            type        => $type,
58
            itemnumber  => $itemnumber,
59
            description => $description,
60
            notes       => $notes,
61
62
        }
63
    );
64
65
    print $cgi->redirect(
66
        "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
67
}
(-)a/members/account_payment.pl (+122 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2000-2002 Katipo Communications
4
# Copyright 2010 BibLibre
5
# Copyright 2010,2011 PTFS-Europe Ltd
6
# Copyright 2013 ByWater Solutions
7
#
8
# This file is part of Koha.
9
#
10
# Koha is free software; you can redistribute it and/or modify it under the
11
# terms of the GNU General Public License as published by the Free Software
12
# Foundation; either version 3 of the License, or (at your option) any later
13
# version.
14
#
15
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License along
20
# with Koha; if not, write to the Free Software Foundation, Inc.,
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23
=head1 account_payment.pl
24
25
 written 11/1/2000 by chris@katipo.oc.nz
26
 part of the koha library system, script to facilitate paying off fines
27
28
=cut
29
30
use Modern::Perl;
31
32
use CGI;
33
34
use URI::Escape;
35
36
use C4::Context;
37
use C4::Auth;
38
use C4::Output;
39
use C4::Members;
40
use C4::Stats;
41
use C4::Koha;
42
use C4::Overdues;
43
use C4::Branch;
44
use C4::Members::Attributes qw(GetBorrowerAttributes);
45
use Koha::Database;
46
47
our $cgi = CGI->new;
48
49
our ( $template, $loggedinuser, $cookie ) = get_template_and_user(
50
    {
51
        template_name   => 'members/account_payment.tt',
52
        query           => $cgi,
53
        type            => 'intranet',
54
        authnotrequired => 0,
55
        flagsrequired   => { borrowers => 1, updatecharges => 1 },
56
        debug           => 1,
57
    }
58
);
59
60
my $borrowernumber = $cgi->param('borrowernumber');
61
62
my $borrower = GetMember( borrowernumber => $borrowernumber );
63
64
my @debits = Koha::Database->new()->schema->resultset('AccountDebit')->search(
65
    {
66
        'me.borrowernumber' => $borrowernumber,
67
        amount_outstanding  => { '>' => 0 }
68
    }
69
);
70
71
$template->param(
72
    debits   => \@debits,
73
    borrower => $borrower,
74
);
75
76
# Standard /members/ borrower details data
77
## FIXME: This code is in every /members/ script and should be unified
78
79
if ( $borrower->{'category_type'} eq 'C' ) {
80
    my ( $catcodes, $labels ) =
81
      GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
82
    my $cnt = scalar(@$catcodes);
83
    $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
84
    $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
85
}
86
87
my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
88
$template->param( picture => 1 ) if $picture;
89
90
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
91
    my $attributes = GetBorrowerAttributes($borrowernumber);
92
    $template->param(
93
        ExtendedPatronAttributes => 1,
94
        extendedattributes       => $attributes
95
    );
96
}
97
98
$template->param(
99
    borrowernumber => $borrowernumber,
100
    firstname      => $borrower->{'firstname'},
101
    surname        => $borrower->{'surname'},
102
    cardnumber     => $borrower->{'cardnumber'},
103
    categorycode   => $borrower->{'categorycode'},
104
    category_type  => $borrower->{'category_type'},
105
    categoryname   => $borrower->{'description'},
106
    address        => $borrower->{'address'},
107
    address2       => $borrower->{'address2'},
108
    city           => $borrower->{'city'},
109
    state          => $borrower->{'state'},
110
    zipcode        => $borrower->{'zipcode'},
111
    country        => $borrower->{'country'},
112
    phone          => $borrower->{'phone'},
113
    email          => $borrower->{'email'},
114
    branchcode     => $borrower->{'branchcode'},
115
    branchname     => GetBranchName( $borrower->{'branchcode'} ),
116
    is_child       => ( $borrower->{'category_type'} eq 'C' ),
117
    activeBorrowerRelationship =>
118
      ( C4::Context->preference('borrowerRelationship') ne '' ),
119
    RoutingSerials => C4::Context->preference('RoutingSerials'),
120
);
121
122
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/members/account_payment_do.pl (+64 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2013 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
24
use C4::Auth;
25
use C4::Members;
26
use C4::Items;
27
use C4::Branch;
28
use C4::Members::Attributes qw(GetBorrowerAttributes);
29
use Koha::Accounts;
30
use Koha::Database;
31
32
my $cgi = new CGI;
33
34
if ( checkauth( $cgi, 0, { borrowers => 1 }, 'intranet' ) ) {
35
    my $borrowernumber = $cgi->param('borrowernumber');
36
37
    my $borrower =
38
      Koha::Database->new()->schema->resultset('Borrower')
39
      ->find($borrowernumber);
40
41
    my $amount_to_pay   = $cgi->param('amount_to_pay');
42
    my $amount_received = $cgi->param('amount_received');
43
    my $type            = $cgi->param('type');
44
    my $notes           = $cgi->param('notes');
45
    my @debit_id        = $cgi->param('debit_id');
46
47
    $amount_received ||= $amount_to_pay
48
      if $type eq Koha::Accounts::CreditTypes::Payment();
49
50
    my $debit = AddCredit(
51
        {
52
            borrower        => $borrower,
53
            amount_received => $amount_received,
54
            amount          => $amount_to_pay,
55
            type            => $type,
56
            notes           => $notes,
57
            debit_id        => \@debit_id,
58
59
        }
60
    );
61
62
    print $cgi->redirect(
63
        "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
64
}
(-)a/members/account_print.pl (-1 / +60 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2013 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
24
use C4::Auth;
25
use C4::Output;
26
use Koha::Database;
27
28
my $cgi = new CGI;
29
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
    {
32
        template_name   => "members/account_print.tt",
33
        query           => $cgi,
34
        type            => "intranet",
35
        authnotrequired => 0,
36
        flagsrequired   => { borrowers => 1, updatecharges => 1 },
37
        debug           => 1,
38
    }
39
);
40
41
my $type = $cgi->param('type');
42
my $id   = $cgi->param('id');
43
44
warn "No type passed in!" unless $type;
45
warn "No id passed in!"   unless $id;
46
47
if ( $type eq 'debit' ) {
48
    my $debit =
49
      Koha::Database->new()->schema->resultset('AccountDebit')->find($id);
50
    $template->param( debit => $debit );
51
}
52
elsif ( $type eq 'credit' ) {
53
    my $credit =
54
      Koha::Database->new()->schema->resultset('AccountCredit')->find($id);
55
    $template->param( credit => $credit );
56
}
57
58
$template->param( type => $type );
59
60
output_html_with_http_headers $cgi, $cookie, $template->output;

Return to bug 6427