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 (+433 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] || 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 | replace('"', '\"') %]",
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
                            [% IF ao.credit %]
79
                                {
80
                                    [% PROCESS format_data data=ao highlight='offset'%]
81
82
                                    "credit": {
83
                                        [% PROCESS format_data data=ao.credit highlight='credit' %]
84
                                    }
85
                                },
86
                            [% END %]
87
                        [% END %]
88
                    ]
89
90
                },
91
            [% END %]
92
        ]
93
    } );
94
95
    $('#debits-table td.control').live( 'click', function () {
96
        var nTr = this.parentNode;
97
        var i = $.inArray( nTr, anOpen );
98
99
        if ( i === -1 ) {
100
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
101
            var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' );
102
            $('div.innerDetails', nDetailsRow).slideDown();
103
            anOpen.push( nTr );
104
        }
105
        else {
106
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
107
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
108
                debitsTable.fnClose( nTr );
109
                anOpen.splice( i, 1 );
110
            } );
111
        }
112
    } );
113
114
    var creditsTable = $('#credits-table').dataTable( {
115
        "bProcessing": true,
116
        "aoColumns": [
117
            {
118
                "mDataProp": null,
119
                "sClass": "control center",
120
                "sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">'
121
            },
122
            { "mDataProp": "credit_id" },
123
            { "mDataProp": "notes" },
124
            {
125
                "mDataProp": "type",
126
                "fnRender": function ( o, val ) {
127
                    return STRINGS['CreditTypes'][val] || val;
128
                },
129
            },
130
            { "mDataProp": "amount_paid" },
131
            { "mDataProp": "amount_remaining" },
132
            { "mDataProp": "created_on" },
133
            { "mDataProp": "updated_on" }
134
        ],
135
        "aaData": [
136
            [% FOREACH c IN credits %]
137
                {
138
                    [% PROCESS format_data data=c highlight='credit' %]
139
140
                    "account_offsets": [
141
                        [% FOREACH ao IN c.account_offsets %]
142
                            {
143
                                [% PROCESS format_data data=ao highlight='offset' %]
144
145
                                "debit": {
146
                                    [% PROCESS format_data data=ao.debit highlight='debit' %]
147
                                }
148
                            },
149
                        [% END %]
150
                    ]
151
152
                },
153
            [% END %]
154
        ]
155
    } );
156
157
    $('#credits-table td.control').live( 'click', function () {
158
        var nTr = this.parentNode;
159
        var i = $.inArray( nTr, anOpen );
160
161
        if ( i === -1 ) {
162
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
163
            var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' );
164
            $('div.innerDetails', nDetailsRow).slideDown();
165
            anOpen.push( nTr );
166
        }
167
        else {
168
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
169
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
170
                creditsTable.fnClose( nTr );
171
                anOpen.splice( i, 1 );
172
            } );
173
        }
174
    } );
175
176
} );
177
178
function fnFormatDebitDetails( debitsTable, nTr ) {
179
    var oData = debitsTable.fnGetData( nTr );
180
181
    var sOut = "<div class='innerDetails' style='display:none;'>";
182
183
    var account_offsets = oData.account_offsets;
184
185
    sOut += "<a class='debit_print btn btn-small' style='margin:5px;' onclick='accountPrint(\"debit\"," + oData.debit_id + ")'>" +
186
                "<i class='icon-print'></i> " + _("Print receipt") +
187
            "</a>";
188
189
    sOut += "<ul>";
190
    if ( oData.title ) {
191
        sOut += "<li>" + _("Title: ");
192
        if ( oData.biblionumber ) {
193
            sOut += "<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + oData.biblionumber + "'>";
194
        }
195
196
        sOut += oData.title;
197
198
        if ( oData.biblionumber ) {
199
            sOut += "</a>";
200
        }
201
202
        sOut += "</li>";
203
    }
204
205
    if ( oData.barcode ) {
206
        sOut += "<li>" + _("Barcode: ");
207
        if ( oData.itemnumber ) {
208
            sOut += "<a href='/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=11&biblionumber=" + oData.biblionumber + "&bi=" + oData.biblionumber + "#item" + oData.itemnumber + "" + oData.biblionumber + "'>";
209
        }
210
211
        sOut += oData.barcode;
212
213
        if ( oData.itemnumber ) {
214
            sOut += "</a>";
215
        }
216
217
        sOut += "</li>";
218
    }
219
220
    if ( oData.notes ) {
221
        sOut += "<li>" + _("Notes: ") + oData.notes + "</li>";
222
    }
223
224
    sOut += "</ul>";
225
226
    if ( account_offsets.length ) {
227
        sOut +=
228
            "<div class='innerDetails'>" +
229
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
230
                    "<thead>" +
231
                        "<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" +
232
                        "<tr>" +
233
                            "<th>" + _("ID") + "</th>" +
234
                            "<th>" + _("Created on") + "</th>" +
235
                            "<th>" + _("Payment amount") + "</th>" +
236
                            "<th>" + _("Applied amount") + "</th>" +
237
                            "<th>" + _("Type") + "</th>" +
238
                            "<th>" + _("Notes") + "</th>" +
239
                        "</tr>" +
240
                    "</thead>" +
241
                    "<tbody>";
242
243
        for ( var i = 0; i < account_offsets.length; i++ ) {
244
            ao = account_offsets[i];
245
            credit_type = STRINGS["CreditTypes"][ao.credit.type] || ao.credit.type;
246
            sOut +=
247
            "<tr>" +
248
                "<td>" + ao.credit_id + "</td>" +
249
                "<td>" + ao.created_on + "</td>" +
250
                "<td>" + ao.credit.amount_paid + "</td>" +
251
                "<td>" + ao.amount + "</td>" +
252
                "<td>" + credit_type + "</td>" +
253
                "<td>" + ao.credit.notes + "</td>" +
254
            "</tr>";
255
        }
256
257
        sOut +=
258
            "</tbody>"+
259
            "</table>";
260
    }
261
262
    sOut +=
263
        "</div>";
264
265
    return sOut;
266
}
267
268
function fnFormatCreditDetails( creditsTable, nTr ) {
269
    var oData = creditsTable.fnGetData( nTr );
270
271
    var sOut = "<div class='innerDetails' style='display:none;'>";
272
273
    sOut += "<button class='credit_print btn btn-small' style='margin:5px;' onclick='accountPrint(\"credit\"," + oData.credit_id + ")'>" +
274
                "<i class='icon-print'></i> " + _("Print receipt") +
275
            "</button>";
276
277
    var account_offsets = oData.account_offsets;
278
279
    if ( account_offsets.length ) {
280
        sOut +=
281
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
282
                    "<thead>" +
283
                        "<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" +
284
                        "<tr>" +
285
                            "<th>" + _("ID") + "</th>" +
286
                            "<th>" + _("Description") + "</th>" +
287
                            "<th>" + _("Type") + "</th>" +
288
                            "<th>" + _("Amount") + "</th>" +
289
                            "<th>" + _("Remaining") + "</th>" +
290
                            "<th>" + _("Created on") + "</th>" +
291
                            "<th>" + _("Updated on") + "</th>" +
292
                            "<th>" + _("Notes") + "</th>" +
293
                        "</tr>" +
294
                    "</thead>" +
295
                    "<tbody>";
296
297
        for ( var i = 0; i < account_offsets.length; i++ ) {
298
            ao = account_offsets[i];
299
            debit_type = STRINGS["DebitTypes"][ao.debit.type] || ao.debit.type;
300
            sOut +=
301
            "<tr>" +
302
                "<td>" + ao.debit.debit_id + "</td>" +
303
                "<td>" + ao.debit.description + "</td>" +
304
                "<td>" + debit_type + "</td>" +
305
                "<td>" + ao.debit.amount_original + "</td>" +
306
                "<td>" + ao.debit.amount_outstanding + "</td>" +
307
                "<td>" + ao.debit.created_on + "</td>" +
308
                "<td>" + ao.debit.updated_on + "</td>" +
309
                "<td>" + ao.debit.notes + "</td>" +
310
            "</tr>";
311
        }
312
313
        sOut +=
314
            "</tbody>"+
315
            "</table>";
316
    }
317
318
    sOut +=
319
        "</div>";
320
321
    return sOut;
322
}
323
324
function accountPrint( type, id ) {
325
    window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id );
326
}
327
//]]>
328
</script>
329
</head>
330
<body>
331
[% INCLUDE 'header.inc' %]
332
[% INCLUDE 'patron-search.inc' %]
333
334
<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>
335
336
<div id="doc3" class="yui-t2">
337
    <div id="bd">
338
           <div id="yui-main">
339
                <div class="yui-b">
340
                [% INCLUDE 'members-toolbar.inc' %]
341
342
                <div class="statictabs">
343
                    <ul>
344
                        <li class="active">
345
                            <a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a>
346
                        </li>
347
348
                        <li>
349
                            <a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a>
350
                        </li>
351
352
                        <li>
353
                            <a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a>
354
                        </li>
355
356
                        <li>
357
                            <a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a>
358
                        </li>
359
                    </ul>
360
                </div>
361
362
                <div class="tabs-container">
363
364
                    <p>
365
                        <h3>Account balance: [% borrower.account_balance | $Currency %]</h3>
366
                    </p>
367
368
                    <div>
369
                        <div id="account-debits">
370
                            <a id="account-debits-switcher" href="#" onclick="return false">View payments</a>
371
                            <table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table">
372
                                <thead>
373
                                    <tr>
374
                                        <th colspan="99">Fees</th>
375
                                    </tr>
376
                                    <tr>
377
                                        <th></th>
378
                                        <th>ID</th>
379
                                        <th>Description</th>
380
                                        <th>Type</th>
381
                                        <th>Amount</th>
382
                                        <th>Outsanding</th>
383
                                        <th>Created on</th>
384
                                        <th>Updated on</th>
385
                                    </tr>
386
                                </thead>
387
                                <tbody></tbody>
388
                            </table>
389
                        </div>
390
391
                        <div id="account-credits">
392
                            <a id="account-credits-switcher" href="#"  onclick="return false">View fees</a>
393
                            <table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table">
394
                                <thead>
395
                                    <tr>
396
                                        <th colspan="99">Payments</th>
397
                                    </tr>
398
                                    <tr>
399
                                        <th></th>
400
                                        <th>ID</th>
401
                                        <th>Notes</th>
402
                                        <th>Type</th>
403
                                        <th>Amount</th>
404
                                        <th>Remaining</th>
405
                                        <th>Created on</th>
406
                                        <th>Updated on</th>
407
                                    </tr>
408
                                </thead>
409
                                <tbody></tbody>
410
                            </table>
411
                        </div>
412
                    </div>
413
                </div>
414
            </div>
415
        </div>
416
417
    <div class="yui-b">
418
        [% INCLUDE 'circ-menu.inc' %]
419
    </div>
420
</div>
421
[% INCLUDE 'intranet-bottom.inc' %]
422
423
[% BLOCK format_data %]
424
    [% FOREACH key IN data.result_source.columns %]
425
        [% IF key.match('^amount') %]
426
            "[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]",
427
        [% ELSIF key.match('_on$') %]
428
            "[% key %]": "[% data.$key | $KohaDates %]",
429
        [% ELSE %]
430
            "[% key %]": "[% data.$key | replace('"', '\"') %]",
431
        [% END %]
432
    [% END %]
433
[% 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 (+231 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
    $('#account-payment-form').preventDoubleFormSubmit();
12
13
    // Convert codes to translated strings
14
    $(".debit-type").each(function() {
15
        $(this).html( STRINGS['DebitTypes'][ $(this).html() ] );
16
    });
17
18
    // Show amount recieved only if the "Receive different amount" checkbox is checked
19
    $("#amount-received-p").hide();
20
    $("#receive_different_amount").click(function() {
21
        if( $(this).is(':checked')) {
22
            $("#amount-received-p").show();
23
            $("#amount_received").focus();
24
        } else {
25
            $("#amount-received-p").hide();
26
        }
27
    });
28
29
    $("#amount_received").keyup(function() {
30
        // Allow only numbers in ammount received
31
        $(this).val($(this).val().replace(/[^\d.]/g, ''));
32
33
        // Make sure the amount recieved is greater than the amount to pay if it is being used
34
        if ( $("#amount_to_pay").val() && parseFloat( $("#amount_received").val() ) < parseFloat( $("#amount_to_pay").val() ) ) {
35
            $("#process").attr('disabled','disabled');
36
        } else {
37
            $("#process").removeAttr('disabled');
38
        }
39
    });
40
41
    // Allow only numbers in ammount to pay
42
    $("#amount_to_pay").keyup(function() {
43
        var $this = $(this);
44
        $this.val($this.val().replace(/[^\d.]/g, ''));
45
    });
46
47
    // Enable the "Select all/Clear all" links
48
    $('#CheckAll').click(function() {
49
        $("input[name='debit_id']" ).prop('checked', true).trigger("change");
50
    });
51
    $('#ClearAll').click(function() {
52
        $("input[name='debit_id']" ).prop('checked', false).trigger("change");
53
    });
54
55
    // Update the "amount to pay" field whenever a fee checkbox is changed
56
    // Note, this is just a payment suggestion and can be changed to any amount
57
    $("input[name='debit_id']" ).change(function() {
58
        var sum = 0;
59
        $("input[name='debit_id']:checked" ).each(function(i,n){
60
            sum += parseFloat( $( "#amount_outstanding_" + $(this).val() ).val() );
61
        });
62
        $('#amount_to_pay').val( sum );
63
    });
64
});
65
66
function checkForm(){
67
    // If using the "amount to receive" field, make sure the librarian is recieving at
68
    // least enough to pay those fees.
69
    if ( $('#amount_received').val() ) {
70
        if ( parseFloat( $('#amount_received').val() ) < parseFloat( $('#amount_to_pay').val() ) ) {
71
            alert( _("Cannot pay more than receieved!") );
72
            return false;
73
        }
74
    }
75
76
    return true;
77
}
78
//]]>
79
</script>
80
</head>
81
<body id="pat_pay" class="pat">
82
    [% INCLUDE 'header.inc' %]
83
    [% INCLUDE 'patron-search.inc' %]
84
85
    <div id="breadcrumbs">
86
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
87
        &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
88
        &rsaquo; Pay fines for [% borrower.firstname %] [% borrower.surname %]
89
    </div>
90
91
    <div id="doc3" class="yui-t2">
92
        <div id="bd">
93
            <div id="yui-main">
94
                <div class="yui-b">
95
                    [% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %]
96
97
                    <div class="statictabs">
98
                        <ul>
99
                            <li><a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a></li>
100
                            <li class="active"><a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a></li>
101
                            <li><a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual invoice</a></li>
102
                            <li><a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a></li>
103
                        </ul>
104
105
                        <div class="tabs-container">
106
107
                        [% IF ( debits ) %]
108
                            <form action="/cgi-bin/koha/members/account_payment_do.pl" method="post" id="account-payment-form" onsubmit="return checkForm()">
109
110
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
111
112
                                <p>
113
                                    <span class="checkall">
114
                                        <a id="CheckAll" href="#">Select all</a>
115
                                    </span>
116
117
                                    |
118
119
                                    <span class="clearall">
120
                                        <a id="ClearAll" href="#">Clear all</a>
121
                                    </span>
122
                                </p>
123
124
                                <table id="finest">
125
                                    <thead>
126
                                        <tr>
127
                                            <th>&nbsp;</th>
128
                                            <th>Description</th>
129
                                            <th>Account type</th>
130
                                            <th>Original amount</th>
131
                                            <th>Amount outstanding</th>
132
                                        </tr>
133
                                    </thead>
134
135
                                    <tbody>
136
                                        [% SET total_due = 0 %]
137
                                        [% FOREACH d IN debits %]
138
                                            [% SET total_due = total_due + d.amount_outstanding %]
139
                                            <tr>
140
                                                <td>
141
                                                    <input type="checkbox" checked="checked" name="debit_id" value="[% d.debit_id %]" />
142
                                                </td>
143
144
                                                <td>
145
                                                    [% d.description %]
146
147
                                                    [% IF d.notes %]
148
                                                        ( <i>[% d.notes %]</i> )
149
                                                    [% END %]
150
                                                </td>
151
152
                                                <td>
153
                                                    <span class="debit-type">[% d.type %]</span>
154
                                                </td>
155
156
                                                <td class="debit">
157
                                                    [% d.amount_original | $Currency %]
158
                                                    <input type="hidden" id="amount_original_[% d.debit_id %]" value="[% Currency.format_without_symbol( d.amount_original ) %]" />
159
                                                </td>
160
161
                                                <td class="debit">
162
                                                    [% d.amount_outstanding | $Currency %]
163
                                                    <input type="hidden" id="amount_outstanding_[% d.debit_id %]" value="[% Currency.format_without_symbol( d.amount_outstanding ) %]" />
164
                                                </td>
165
                                            </tr>
166
                                        [% END %]
167
                                    </tbody>
168
169
                                    <tfoot>
170
                                        <tr>
171
                                            <td class="total" colspan="4">Total Due:</td>
172
                                            <td>[% total_due | $Currency %]</td>
173
                                        </tr>
174
                                    </tfoot>
175
176
                                </table>
177
178
                                <fieldset>
179
                                    <p>
180
                                        <label for="amount_to_pay">Amount to pay: [% Currency.symbol() %]</label>
181
                                        <input type="text" name="amount_to_pay" id="amount_to_pay" value="[% Currency.format_without_symbol( total_due ) %]" />
182
183
                                        <input type="checkbox" id="receive_different_amount" />
184
                                        <label for="receive_different_amount"><i>Receive different amount</i></label>
185
                                    </p>
186
187
                                    <p id="amount-received-p">
188
                                        <label for="amount_received">Amount recieved: [% Currency.symbol() %]</label>
189
                                        <input type="text" name="amount_received" id="amount_received" />
190
                                    </p>
191
192
                                    <p>
193
                                        <label for="type">Type:</label>
194
                                        <select id="type" name="type">
195
                                            <option value="PAYMENT">Payment</option>
196
                                            <option value="WRITEOFF">Writeoff</option>
197
                                            [% FOREACH c IN credit_types_loop %]
198
                                                <option value="[% c.authorised_value %]">[% c.lib %]</option>
199
                                            [% END %]
200
                                        </select>
201
                                    </p>
202
203
                                    <p>
204
                                        <label for="notes">Payment notes:</label>
205
                                        <input type="textbox" name="notes" id="notes" />
206
                                    <p>
207
                                </fieldset>
208
209
                                <fieldset class="action">
210
                                    <input type="submit" id="process" value="Process" class="submit" />
211
                                    <a class="cancel" href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
212
                                </fieldset>
213
214
                            </form>
215
216
                        [% ELSE %]
217
                            <p>
218
                                [% borrower.firstname %] [% borrower.surname %] has no outstanding fines.
219
                            </p>
220
                        [% END %]
221
222
                    </div>
223
                </div>
224
            </div>
225
        </div>
226
227
        <div class="yui-b">
228
            [% INCLUDE 'circ-menu.tt' %]
229
        </div>
230
    </div>
231
[% 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 > 0 %]
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('MANUAL_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 (+69 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
    my $debit_id = $debit->debit_id();
66
67
    print $cgi->redirect(
68
        "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
69
}
(-)a/members/account_payment.pl (+123 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
    credit_types_loop => GetAuthorisedValues('MANUAL_CREDIT'),
75
);
76
77
# Standard /members/ borrower details data
78
## FIXME: This code is in every /members/ script and should be unified
79
80
if ( $borrower->{'category_type'} eq 'C' ) {
81
    my ( $catcodes, $labels ) =
82
      GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
83
    my $cnt = scalar(@$catcodes);
84
    $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
85
    $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
86
}
87
88
my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
89
$template->param( picture => 1 ) if $picture;
90
91
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
92
    my $attributes = GetBorrowerAttributes($borrowernumber);
93
    $template->param(
94
        ExtendedPatronAttributes => 1,
95
        extendedattributes       => $attributes
96
    );
97
}
98
99
$template->param(
100
    borrowernumber => $borrowernumber,
101
    firstname      => $borrower->{'firstname'},
102
    surname        => $borrower->{'surname'},
103
    cardnumber     => $borrower->{'cardnumber'},
104
    categorycode   => $borrower->{'categorycode'},
105
    category_type  => $borrower->{'category_type'},
106
    categoryname   => $borrower->{'description'},
107
    address        => $borrower->{'address'},
108
    address2       => $borrower->{'address2'},
109
    city           => $borrower->{'city'},
110
    state          => $borrower->{'state'},
111
    zipcode        => $borrower->{'zipcode'},
112
    country        => $borrower->{'country'},
113
    phone          => $borrower->{'phone'},
114
    email          => $borrower->{'email'},
115
    branchcode     => $borrower->{'branchcode'},
116
    branchname     => GetBranchName( $borrower->{'branchcode'} ),
117
    is_child       => ( $borrower->{'category_type'} eq 'C' ),
118
    activeBorrowerRelationship =>
119
      ( C4::Context->preference('borrowerRelationship') ne '' ),
120
    RoutingSerials => C4::Context->preference('RoutingSerials'),
121
);
122
123
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