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

(-)a/Koha/Schema/Result/AccountCredit.pm (+5 lines)
Lines 168-171 __PACKAGE__->belongs_to( Link Here
168
  { borrowernumber => "borrowernumber" },
168
  { borrowernumber => "borrowernumber" },
169
);
169
);
170
170
171
__PACKAGE__->belongs_to(
172
    "branch",
173
    "Koha::Schema::Result::Branch",
174
    { branchcode => "branchcode" },
175
);
171
1;
176
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt (+552 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
[% INCLUDE 'datatables.inc' %]
10
[% INCLUDE 'browser-strings.inc' %]
11
12
<script type="text/javascript">
13
//<![CDATA[
14
$(document).ready(function() {
15
    void_compare = "[% 0 FILTER $Currency highlight => highlight %]";
16
17
    [% IF credit_id %]
18
        accountPrint( 'credit', [% credit_id %] );
19
    [% ELSIF debit_id %]
20
        accountPrint( 'debit', [% debit_id %] );
21
    [% END %]
22
23
    $('#account-credits').hide();
24
25
    var anOpen = [];
26
    var sImageUrl = "[% interface %]/[% theme %]/img/";
27
28
    var debitsTable = $('#debits-table').dataTable( {
29
        "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>",
30
        "oTableTools": {
31
            "sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf",
32
            "aButtons": [
33
                {
34
                    "sExtends": "text",
35
                    "sButtonText": _("View payments"),
36
                    "fnClick": function ( nButton, oConfig, oFlash ) {
37
                        $('#account-debits').slideUp();
38
                        $('#account-credits').slideDown();
39
                    }
40
                },
41
                {
42
                    "sExtends": "text",
43
                    "sButtonText": [% IF show_all %] "<i class='icon-eye-close'></i> " + _("Hide fees & payments with no balance") [% ELSE %] "<i class='icon-eye-open'></i> " + _("Show all fees & payments") [% END %],
44
                    "fnClick": function ( nButton, oConfig, oFlash ) {
45
                        [% IF show_all %]
46
                            window.location = "/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]&show_all=0";
47
                        [% ELSE %]
48
                            window.location = "/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]&show_all=1";
49
                        [% END %]
50
                    }
51
                },
52
                {
53
                    "sExtends": "print",
54
                    "sButtonText": "<i class='icon-print'></i> " + _("Print")
55
                },
56
                {
57
                    "sExtends":    "collection",
58
                    "sButtonText": "<i class='icon-download'></i> " + _("Download") + " <span class='caret' />",
59
                    "aButtons": [
60
                        {
61
                            "sExtends": "csv",
62
                            "sButtonText": "<i class='icon-file'></i> " + _("CSV")
63
                        }
64
                    ]
65
                }
66
            ]
67
        },
68
        "oLanguage": {
69
            "sEmptyTable": [% IF show_all %] _("Patron has no fees!") [% ELSE %] _("Patron has no outstanding fees!") [% END %]
70
        },
71
        "bProcessing": true,
72
        "aoColumns": [
73
            {
74
                "mDataProp": null,
75
                "sClass": "control center",
76
                "sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">'
77
            },
78
            { "mDataProp": "debit_id" },
79
            { "mDataProp": "description" },
80
            {
81
                "mDataProp": "type",
82
                "render": function ( data, type, full, meta ) {
83
                    return STRINGS['DebitTypes'][data] || val;
84
                },
85
            },
86
            { "mDataProp": "amount_original" },
87
            { "mDataProp": "amount_outstanding" },
88
            { "mDataProp": "created_on" },
89
            { "mDataProp": "updated_on" }
90
        ],
91
        "aaData": [
92
            [% FOREACH d IN debits %]
93
                {
94
                    [% PROCESS format_data data=d highlight='debit' %]
95
96
                    // Data for related item if there is one linked
97
                    "title": "[% d.item.biblio.title || d.deleted_item.biblio.title || d.deleted_item.deleted_biblio.title | replace('"', '\"') %]",
98
                    "biblionumber": "[% d.item.biblio.biblionumber || d.deleted_item.biblio.biblionumber %]",
99
                    "barcode": "[% d.item.barcode || d.deleted_item.barcode %]",
100
                    "itemnumber": "[% d.item.itemnumber %]", //This way itemnumber will be undef if deleted
101
102
103
                    // Data for related issue if there is one linked
104
                    [% IF d.issue %]
105
                        [% SET table = 'issue' %]
106
                    [% ELSIF d.old_issue %]
107
                        [% SET table = 'old_issue' %]
108
                    [% END %]
109
110
                    [% IF table %]
111
                        "issue": {
112
                            [% PROCESS format_data data=d.$table %]
113
                        },
114
                    [% END %]
115
116
117
                    "account_offsets": [
118
                        [% FOREACH ao IN d.account_offsets %]
119
                            [% IF ao.credit %]
120
                                {
121
                                    [% PROCESS format_data data=ao highlight='offset'%]
122
123
                                    "credit": {
124
                                        [% PROCESS format_data data=ao.credit highlight='credit' %]
125
                                    }
126
                                },
127
                            [% END %]
128
                        [% END %]
129
                    ]
130
131
                },
132
            [% END %]
133
        ]
134
    } );
135
136
    $('#debits-table td.control').live( 'click', function () {
137
        var nTr = this.parentNode;
138
        var i = $.inArray( nTr, anOpen );
139
140
        if ( i === -1 ) {
141
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
142
            var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' );
143
            $('div.innerDetails', nDetailsRow).slideDown();
144
            anOpen.push( nTr );
145
        }
146
        else {
147
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
148
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
149
                debitsTable.fnClose( nTr );
150
                anOpen.splice( i, 1 );
151
            } );
152
        }
153
    } );
154
155
    var creditsTable = $('#credits-table').dataTable( {
156
        "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>",
157
        "oTableTools": {
158
            "sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf",
159
            "aButtons": [
160
                {
161
                    "sExtends": "text",
162
                    "sButtonText": _("View fees"),
163
                    "fnClick": function ( nButton, oConfig, oFlash ) {
164
                        $('#account-credits').slideUp();
165
                        $('#account-debits').slideDown();
166
                    }
167
                },
168
                {
169
                    "sExtends": "text",
170
                    "sButtonText": [% IF show_all %] "<i class='icon-eye-close'></i> " + _("Hide fees & payments with no balance") [% ELSE %] "<i class='icon-eye-open'></i> " + _("Show all fees & payments") [% END %],
171
                    "fnClick": function ( nButton, oConfig, oFlash ) {
172
                        [% IF show_all %]
173
                            window.location = "/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]&show_all=0";
174
                        [% ELSE %]
175
                            window.location = "/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]&show_all=1";
176
                        [% END %]
177
                    }
178
                },
179
                {
180
                    "sExtends": "print",
181
                    "sButtonText": "<i class='icon-print'></i> " + _("Print")
182
                },
183
                {
184
                    "sExtends":    "collection",
185
                    "sButtonText": "<i class='icon-download'></i> " + _("Download") + " <span class='caret' />",
186
                    "aButtons": [
187
                        {
188
                            "sExtends": "csv",
189
                            "sButtonText": "<i class='icon-file'></i> " + _("CSV")
190
                        }
191
                    ]
192
                }
193
            ]
194
        },
195
        "oLanguage": {
196
            "sEmptyTable": [% IF show_all %] _("Patron has no payments!") [% ELSE %] _("Patron has no payments with an unused balance!") [% END %]
197
        },
198
        "bProcessing": true,
199
        "aoColumns": [
200
            {
201
                "mDataProp": null,
202
                "sClass": "control center",
203
                "sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">'
204
            },
205
            { "mDataProp": "credit_id" },
206
            { "mDataProp": "notes" },
207
            {
208
                "mDataProp": "type",
209
                "render": function ( data, type, full, meta ) {
210
                    return STRINGS['CreditTypes'][data] || val;
211
                },
212
            },
213
            {
214
                "mDataProp": "amount_paid",
215
                "mRender": function ( data, type, full ) {
216
                    if ( full.amount_voided && full.amount_voided != void_compare ) {
217
                        return "<strike>" + full.amount_voided + "</strike>";
218
                    } else {
219
                        return full.amount_paid;
220
                    }
221
                }
222
            },
223
            { "mDataProp": "amount_remaining" },
224
            { "mDataProp": "created_on" },
225
            { "mDataProp": "updated_on" }
226
        ],
227
        "aaData": [
228
            [% FOREACH c IN credits %]
229
                {
230
                    [% PROCESS format_data data=c highlight='credit' %]
231
232
                    "account_offsets": [
233
                        [% FOREACH ao IN c.account_offsets %]
234
                            {
235
                                [% PROCESS format_data data=ao highlight='offset' %]
236
237
                                "debit": {
238
                                    [% PROCESS format_data data=ao.debit highlight='debit' %]
239
                                }
240
                            },
241
                        [% END %]
242
                    ]
243
244
                },
245
            [% END %]
246
        ]
247
    } );
248
249
    $('#credits-table td.control').live( 'click', function () {
250
        var nTr = this.parentNode;
251
        var i = $.inArray( nTr, anOpen );
252
253
        if ( i === -1 ) {
254
            $('img', this).attr( 'src', sImageUrl+"details_close.png" );
255
            var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' );
256
            $('div.innerDetails', nDetailsRow).slideDown();
257
            anOpen.push( nTr );
258
        }
259
        else {
260
            $('img', this).attr( 'src', sImageUrl+"details_open.png" );
261
            $('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
262
                creditsTable.fnClose( nTr );
263
                anOpen.splice( i, 1 );
264
            } );
265
        }
266
    } );
267
268
} );
269
270
function fnFormatDebitDetails( debitsTable, nTr ) {
271
    var oData = debitsTable.fnGetData( nTr );
272
273
    var sOut = "<div class='innerDetails' style='display:none;'>";
274
275
    var account_offsets = oData.account_offsets;
276
277
    sOut += "<a class='debit_print btn btn-small noprint' style='margin:5px;' onclick='accountPrint(\"debit\"," + oData.debit_id + ")'>" +
278
                "<i class='icon-print'></i> " + _("Print receipt") +
279
            "</a>";
280
281
    sOut += "<ul>";
282
    if ( oData.title ) {
283
        sOut += "<li>" + _("Title: ");
284
        if ( oData.biblionumber ) {
285
            sOut += "<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + oData.biblionumber + "'>";
286
        }
287
288
        sOut += oData.title;
289
290
        if ( oData.biblionumber ) {
291
            sOut += "</a>";
292
        }
293
294
        sOut += "</li>";
295
    }
296
297
    if ( oData.barcode ) {
298
        sOut += "<li>" + _("Barcode: ");
299
        if ( oData.itemnumber ) {
300
            sOut += "<a href='/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=11&biblionumber=" + oData.biblionumber + "&bi=" + oData.biblionumber + "#item" + oData.itemnumber + "" + oData.biblionumber + "'>";
301
        }
302
303
        sOut += oData.barcode;
304
305
        if ( oData.itemnumber ) {
306
            sOut += "</a>";
307
        }
308
309
        sOut += "</li>";
310
    }
311
312
    if ( oData.notes ) {
313
        sOut += "<li>" + _("Notes: ") + oData.notes + "</li>";
314
    }
315
316
    sOut += "</ul>";
317
318
    if ( account_offsets.length ) {
319
        sOut +=
320
            "<div class='innerDetails'>" +
321
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
322
                    "<thead>" +
323
                        "<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" +
324
                        "<tr>" +
325
                            "<th>" + _("ID") + "</th>" +
326
                            "<th>" + _("Created on") + "</th>" +
327
                            "<th>" + _("Payment amount") + "</th>" +
328
                            "<th>" + _("Applied amount") + "</th>" +
329
                            "<th>" + _("Type") + "</th>" +
330
                            "<th>" + _("Notes") + "</th>" +
331
                        "</tr>" +
332
                    "</thead>" +
333
                    "<tbody>";
334
335
        for ( var i = 0; i < account_offsets.length; i++ ) {
336
            ao = account_offsets[i];
337
            credit_type = STRINGS["CreditTypes"][ao.credit.type] || ao.credit.type;
338
            offset_type = STRINGS["OffsetTypes"][ao.type] || ao.type;
339
            if ( offset_type ) offset_type = " (" + offset_type + ") ";
340
341
            var payment_or_void;
342
            if ( ao.credit.amount_voided && ao.credit.amount_voided != void_compare ) {
343
                payment_or_void = "<strike>" + ao.credit.amount_voided + "</strike>";
344
            } else {
345
                payment_or_void = ao.credit.amount_paid;
346
            }
347
348
            sOut +=
349
            "<tr>" +
350
                "<td>" + ao.credit_id + "</td>" +
351
                "<td>" + ao.created_on + "</td>" +
352
                "<td>" + payment_or_void + "</td>" +
353
                "<td>" + ao.amount + "</td>" +
354
                "<td>" + credit_type + offset_type  + "</td>" +
355
                "<td>" + ao.credit.notes + "</td>" +
356
            "</tr>";
357
        }
358
359
        sOut +=
360
            "</tbody>"+
361
            "</table>";
362
    }
363
364
    sOut +=
365
        "</div>";
366
367
    return sOut;
368
}
369
370
function fnFormatCreditDetails( creditsTable, nTr ) {
371
    var oData = creditsTable.fnGetData( nTr );
372
373
    var sOut = "<div class='innerDetails' style='display:none;'>";
374
375
    sOut += "<button class='credit_print btn btn-small noprint' style='margin:5px;' onclick='accountPrint(\"credit\"," + oData.credit_id + ")'>" +
376
                "<i class='icon-print'></i> " + _("Print receipt") +
377
            "</button>";
378
379
    if ( ! oData.amount_voided_original ) {
380
    sOut += "<a class='credit_void btn btn-small noprint' style='margin:5px;' onclick='accountVoid(\"credit\"," + oData.credit_id + ")'>" +
381
                "<i class='icon-remove-sign'></i> " + _("Void payment") +
382
            "</a>";
383
    }
384
385
    var account_offsets = oData.account_offsets;
386
387
    if ( account_offsets.length ) {
388
        sOut +=
389
                "<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" +
390
                    "<thead>" +
391
                        "<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" +
392
                        "<tr>" +
393
                            "<th>" + _("ID") + "</th>" +
394
                            "<th>" + _("Description") + "</th>" +
395
                            "<th>" + _("Type") + "</th>" +
396
                            "<th>" + _("Amount") + "</th>" +
397
                            "<th>" + _("Amount applied") + "</th>" +
398
                            "<th>" + _("Remaining") + "</th>" +
399
                            "<th>" + _("Created on") + "</th>" +
400
                            "<th>" + _("Updated on") + "</th>" +
401
                            "<th>" + _("Notes") + "</th>" +
402
                        "</tr>" +
403
                    "</thead>" +
404
                    "<tbody>";
405
406
        for ( var i = 0; i < account_offsets.length; i++ ) {
407
            ao = account_offsets[i];
408
            debit_type = STRINGS["DebitTypes"][ao.debit.type] || ao.debit.type;
409
            offset_type = STRINGS["OffsetTypes"][ao.type] || ao.type;
410
            if ( offset_type ) offset_type = " (" + offset_type + ") ";
411
412
            sOut +=
413
            "<tr>" +
414
                "<td>" + ao.debit.debit_id + "</td>" +
415
                "<td>" + ao.debit.description + "</td>" +
416
                "<td>" + debit_type + offset_type + "</td>" +
417
                "<td>" + ao.debit.amount_original + "</td>" +
418
                "<td>" + ao.amount + "</td>" +
419
                "<td>" + ao.debit.amount_outstanding + "</td>" +
420
                "<td>" + ao.debit.created_on + "</td>" +
421
                "<td>" + ao.debit.updated_on + "</td>" +
422
                "<td>" + ao.debit.notes + "</td>" +
423
            "</tr>";
424
        }
425
426
        sOut +=
427
            "</tbody>"+
428
            "</table>";
429
    }
430
431
    sOut +=
432
        "</div>";
433
434
    return sOut;
435
}
436
437
function accountPrint( type, id ) {
438
    window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id );
439
}
440
441
function accountVoid( type, id ) {
442
    if ( confirm(_("Are you sure you want to void this transaction?")) ) {
443
        window.location.href = "/cgi-bin/koha/members/account_void.pl?borrowernumber=" + [% borrowernumber %] + "&id=" + id;
444
    }
445
}
446
//]]>
447
</script>
448
</head>
449
<body>
450
[% INCLUDE 'header.inc' %]
451
[% INCLUDE 'patron-search.inc' %]
452
453
<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>
454
455
<div id="doc3" class="yui-t2">
456
    <div id="bd">
457
           <div id="yui-main">
458
                <div class="yui-b">
459
                [% INCLUDE 'members-toolbar.inc' %]
460
461
                <div class="statictabs">
462
                    <ul>
463
                        <li class="active">
464
                            <a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a>
465
                        </li>
466
467
                        <li>
468
                            <a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a>
469
                        </li>
470
471
                        <li>
472
                            <a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a>
473
                        </li>
474
475
                        <li>
476
                            <a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a>
477
                        </li>
478
                    </ul>
479
                </div>
480
481
                <div class="tabs-container">
482
483
                    <p>
484
                        <h3>Account balance: [% borrower.account_balance | $Currency %]</h3>
485
                    </p>
486
487
                    <div>
488
                        <div id="account-debits">
489
                            <table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table">
490
                                <thead>
491
                                    <tr>
492
                                        <th colspan="99">Fees</th>
493
                                    </tr>
494
                                    <tr>
495
                                        <th></th>
496
                                        <th>ID</th>
497
                                        <th>Description</th>
498
                                        <th>Type</th>
499
                                        <th>Amount</th>
500
                                        <th>Outstanding</th>
501
                                        <th>Created on</th>
502
                                        <th>Updated on</th>
503
                                    </tr>
504
                                </thead>
505
                                <tbody></tbody>
506
                            </table>
507
                        </div>
508
509
                        <div id="account-credits">
510
                            <table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table">
511
                                <thead>
512
                                    <tr>
513
                                        <th colspan="99">Payments</th>
514
                                    </tr>
515
                                    <tr>
516
                                        <th></th>
517
                                        <th>ID</th>
518
                                        <th>Notes</th>
519
                                        <th>Type</th>
520
                                        <th>Amount</th>
521
                                        <th>Remaining</th>
522
                                        <th>Created on</th>
523
                                        <th>Updated on</th>
524
                                    </tr>
525
                                </thead>
526
                                <tbody></tbody>
527
                            </table>
528
                        </div>
529
                    </div>
530
                </div>
531
            </div>
532
        </div>
533
534
    <div class="yui-b">
535
        [% INCLUDE 'circ-menu.inc' %]
536
    </div>
537
</div>
538
[% INCLUDE 'intranet-bottom.inc' %]
539
540
[% BLOCK format_data %]
541
    [% FOREACH key IN data.result_source.columns %]
542
        [% IF key.match('^amount') %]
543
            "[% key %]_original": "[% data.$key %]",
544
            "[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]",
545
        [% ELSIF key.match('_on$') %]
546
            "[% key %]_original": "[% data.$key %]",
547
            "[% key %]": "[% data.$key | $KohaDates %]",
548
        [% ELSE %]
549
            "[% key %]": "[% data.$key | replace('"', '\"') %]",
550
        [% END %]
551
    [% END %]
552
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_credit.tt (+97 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
    $("#amount").bind('keyup blur', function() {
12
        // Allow only numbers in amount received
13
        $(this).val($(this).val().replace(/[^\d.]/g, ''));
14
    });
15
});
16
//]]>
17
</script>
18
</head>
19
<body id="pat_account_credit" class="pat">
20
    [% INCLUDE 'header.inc' %]
21
    [% INCLUDE 'patron-search.inc' %]
22
23
    <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>
24
25
    <div id="doc3" class="yui-t2">
26
        <div id="bd">
27
               <div id="yui-main">
28
            <div class="yui-b">
29
                    [% INCLUDE 'members-toolbar.inc' %]
30
31
                    <div class="statictabs">
32
                        <ul>
33
                            <li><a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
34
                            <li><a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
35
                            <li><a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a></li>
36
                            <li class="active"><a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a></li>
37
                        </ul>
38
39
                        <div class="tabs-container">
40
41
                            <form action="/cgi-bin/koha/members/account_credit_do.pl" method="post" id="account_credit">
42
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
43
44
                                <fieldset class="rows">
45
                                    <legend>Manual credit</legend>
46
47
                                    <ol>
48
                                        <li>
49
                                            <label for="type">Credit Type: </label>
50
                                            <select name="type" id="type">
51
                                                <option value="CREDIT">Credit</option>
52
                                                <option value="FORGIVEN">Forgiven</option>
53
                                                [% FOREACH c IN credit_types_loop %]
54
                                                    <option value="[% c.authorised_value %]">[% c.lib %]</option>
55
                                                [% END %]
56
                                            </select>
57
                                        </li>
58
59
                                        <li>
60
                                            <label for="barcode">Barcode: </label>
61
                                            <input type="text" name="barcode" id="barcode" />
62
                                        </li>
63
64
                                        <li>
65
                                            <label for="desc">Description: </label>
66
                                            <input type="text" name="desc" size="50" id="desc" />
67
                                        </li>
68
69
                                        <li>
70
                                            <label for="note">Note: </label>
71
                                            <input type="text" name="note" size="50" id="note" />
72
                                        </li>
73
74
                                        <li>
75
                                            <label for="amount">Amount: </label>
76
                                            <input type="text" name="amount" id="amount" />
77
                                            Example: 5.00
78
                                        </li>
79
                                    </ol>
80
81
                                </fieldset>
82
83
                                <fieldset class="action">
84
                                    <input type="submit" name="add" value="Add credit" />
85
                                    <a class="cancel" href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
86
                                </fieldset>
87
                            </form>
88
89
                        </div>
90
                    </div>
91
                </div>
92
            </div>
93
        <div class="yui-b">
94
            [% INCLUDE 'circ-menu.inc' %]
95
        </div>
96
    </div>
97
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_debit.tt (+114 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
    $("#amount").bind('keyup blur', function() {
22
        // Allow only numbers in amount received
23
        $(this).val($(this).val().replace(/[^\d.]/g, ''));
24
    });
25
});
26
//]]>
27
</script>
28
</head>
29
30
<body>
31
    [% INCLUDE 'header.inc' %]
32
    [% INCLUDE 'patron-search.inc' %]
33
34
    <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>
35
36
    <div id="doc3" class="yui-t2">
37
        <div id="bd">
38
            <div id="yui-main">
39
                <div class="yui-b">
40
                    [% INCLUDE 'members-toolbar.inc' %]
41
42
                    <div class="statictabs">
43
                    <ul>
44
                        <li><a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
45
                        <li><a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
46
                        <li class="active"><a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a></li>
47
                        <li><a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a></li>
48
                    </ul>
49
                    <div class="tabs-container">
50
51
                    <form action="/cgi-bin/koha/members/account_debit_do.pl" method="post" id="account_debit">
52
                        <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
53
54
                        <fieldset class="rows">
55
                            <legend>Manual Invoice</legend>
56
57
                            <ol>
58
                                <li>
59
                                    <label for="type">Type: </label>
60
                                    <select name="type" id="type">
61
                                        <option value="LOST">Lost item</option>
62
                                        <option value="FINE">Fine</option>
63
                                        <option value="ACCOUNT_MANAGEMENT_FEE">Account management fee</option>
64
                                        <option value="NEW_CARD">New card</option>
65
                                        <option value="SUNDRY">Sundry</option>
66
67
                                        [% FOREACH invoice_types_loo IN invoice_types_loop %]
68
                                            <option value="[% invoice_types_loo.authorised_value %]">[% invoice_types_loo.lib %]</option>
69
                                        [% END %]
70
                                    </select>
71
                                </li>
72
73
                                <!-- TODO: Write ajax barcode validator that appends the itemnumber for this form in a hidden input -->
74
                                 <li>
75
                                    <label for="barcode">Barcode: </label>
76
                                    <input type="text" name="barcode" id="barcode" />
77
                                </li>
78
79
                                <li>
80
                                    <label for="description">Description: </label>
81
                                    <input type="text" name="description" id="description" size="50" />
82
                                </li>
83
84
                                <li>
85
                                    <label for="notes">Notes: </label>
86
                                    <input type="text" name="notes" size="50" id="notes" />
87
                                </li>
88
89
                                <li>
90
                                    <label for="amount">Amount: </label>
91
                                    <input type="text" name="amount" id="amount" /> Example: 5.00
92
                                </li>
93
94
                            </ol>
95
                        </fieldset>
96
97
                        <fieldset class="action">
98
                            <input type="submit" name="add" value="Save" />
99
                            <a class="cancel" href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
100
                        </fieldset>
101
102
                    </form>
103
104
                </div>
105
            </div>
106
        </div>
107
    </div>
108
109
<div class="yui-b">
110
  [% INCLUDE 'circ-menu.inc' %]
111
</div>
112
113
</div>
114
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_payment.tt (+246 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">
8
//<![CDATA[
9
$( document ).ready(function() {
10
    $('#account-payment-form').preventDoubleFormSubmit();
11
12
    // Convert codes to translated strings
13
    $(".debit-type").each(function() {
14
        $(this).html( STRINGS['DebitTypes'][ $(this).html() ] );
15
    });
16
17
    // Show amount recieved only if the "Receive different amount" checkbox is checked
18
    $("#amount-received-p").hide();
19
    $("#receive_different_amount").bind('click focus blur', function() {
20
        if( $(this).is(':checked')) {
21
            $("#amount-received-p").show();
22
            $("#amount_received").focus();
23
            $("#amount_received").keyup();
24
        } else {
25
            $("#amount-received-p").hide();
26
            $("#amount_to_pay").keyup();
27
        }
28
    });
29
30
    $("#amount_received").bind('keyup blur', function() {
31
        // Allow only numbers in amount received
32
        $(this).val($(this).val().replace(/[^\d.]/g, ''));
33
34
        if ( $("#receive_different_amount").attr('checked') ) {
35
            // Make sure the amount recieved is greater than the amount to pay if it is being used
36
            amount_received = parseFloat( $("#amount_received").val() ) || 0;
37
            amount_to_pay = parseFloat( $("#amount_to_pay").val() ) || 0;
38
            if ( amount_received < amount_to_pay ) {
39
                $("#process").attr('disabled','disabled');
40
            } else {
41
                $("#process").removeAttr('disabled');
42
            }
43
        }
44
    });
45
46
    // Allow only numbers in amount to pay
47
    $("#amount_to_pay").bind('keyup blur', function() {
48
        // Allow only numbers in amount received
49
        $(this).val($(this).val().replace(/[^\d.]/g, ''));
50
51
        // Disallow over-payments
52
        if ( parseFloat( $(this).val() ) > parseFloat( $("#total_due").val() ) ) {
53
            $("#process").attr('disabled','disabled');
54
        } else {
55
            $("#process").removeAttr('disabled');
56
        }
57
58
        $("#amount_received").keyup();
59
    });
60
61
    // Enable the "Select all/Clear all" links
62
    $('#CheckAll').click(function() {
63
        $("input[name='debit_id']" ).prop('checked', true).trigger("change");
64
    });
65
    $('#ClearAll').click(function() {
66
        $("input[name='debit_id']" ).prop('checked', false).trigger("change");
67
    });
68
69
    // Update the "amount to pay" field whenever a fee checkbox is changed
70
    // Note, this is just a payment suggestion and can be changed to any amount
71
    $("input[name='debit_id']" ).change(function() {
72
        var sum = 0;
73
        $("input[name='debit_id']:checked" ).each(function(i,n){
74
            sum += parseFloat( $( "#amount_outstanding_" + $(this).val() ).val() );
75
        });
76
        $('#amount_to_pay').val( sum.toFixed(2) );
77
    });
78
});
79
80
function checkForm(){
81
    // If using the "amount to receive" field, make sure the librarian is recieving at
82
    // least enough to pay those fees.
83
    if ( $('#amount_received').val() ) {
84
        if ( parseFloat( $('#amount_received').val() ) < parseFloat( $('#amount_to_pay').val() ) ) {
85
            alert( _("Cannot pay more than receieved!") );
86
            return false;
87
        }
88
    }
89
90
    return true;
91
}
92
//]]>
93
</script>
94
</head>
95
<body id="pat_pay" class="pat">
96
    [% INCLUDE 'header.inc' %]
97
    [% INCLUDE 'patron-search.inc' %]
98
99
    <div id="breadcrumbs">
100
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
101
        &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
102
        &rsaquo; Pay fines for [% borrower.firstname %] [% borrower.surname %]
103
    </div>
104
105
    <div id="doc3" class="yui-t2">
106
        <div id="bd">
107
            <div id="yui-main">
108
                <div class="yui-b">
109
                    [% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %]
110
111
                    <div class="statictabs">
112
                        <ul>
113
                            <li><a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a></li>
114
                            <li class="active"><a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a></li>
115
                            <li><a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual invoice</a></li>
116
                            <li><a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a></li>
117
                        </ul>
118
119
                        <div class="tabs-container">
120
121
                        [% IF ( debits ) %]
122
                            <form action="/cgi-bin/koha/members/account_payment_do.pl" method="post" id="account-payment-form" onsubmit="return checkForm()">
123
124
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
125
126
                                <p>
127
                                    <span class="checkall">
128
                                        <a id="CheckAll" href="#">Select all</a>
129
                                    </span>
130
131
                                    |
132
133
                                    <span class="clearall">
134
                                        <a id="ClearAll" href="#">Clear all</a>
135
                                    </span>
136
                                </p>
137
138
                                <table id="finest">
139
                                    <thead>
140
                                        <tr>
141
                                            <th>&nbsp;</th>
142
                                            <th>Description</th>
143
                                            <th>Account type</th>
144
                                            <th>Original amount</th>
145
                                            <th>Amount outstanding</th>
146
                                        </tr>
147
                                    </thead>
148
149
                                    <tbody>
150
                                        [% SET total_due = 0 %]
151
                                        [% FOREACH d IN debits %]
152
                                            [% SET total_due = total_due + d.amount_outstanding %]
153
                                            <tr>
154
                                                <td>
155
                                                    <input type="checkbox" checked="checked" name="debit_id" value="[% d.debit_id %]" />
156
                                                </td>
157
158
                                                <td>
159
                                                    [% d.description %]
160
161
                                                    [% IF d.notes %]
162
                                                        ( <i>[% d.notes %]</i> )
163
                                                    [% END %]
164
                                                </td>
165
166
                                                <td>
167
                                                    <span class="debit-type">[% d.type %]</span>
168
                                                </td>
169
170
                                                <td class="debit">
171
                                                    [% d.amount_original | $Currency %]
172
                                                    <input type="hidden" id="amount_original_[% d.debit_id %]" value="[% Currency.format_without_symbol( d.amount_original ) %]" />
173
                                                </td>
174
175
                                                <td class="debit">
176
                                                    [% d.amount_outstanding | $Currency %]
177
                                                    <input type="hidden" id="amount_outstanding_[% d.debit_id %]" value="[% Currency.format_without_symbol( d.amount_outstanding ) %]" />
178
                                                </td>
179
                                            </tr>
180
                                        [% END %]
181
                                    </tbody>
182
183
                                    <tfoot>
184
                                        <tr>
185
                                            <td class="total" colspan="4">Total Due:</td>
186
                                            <td>[% total_due | $Currency %]</td>
187
                                        </tr>
188
                                    </tfoot>
189
190
                                </table>
191
192
                                <fieldset>
193
                                    <p>
194
                                        <label for="amount_to_pay">Amount to pay: [% Currency.symbol() %]</label>
195
                                        <input type="text" name="amount_to_pay" id="amount_to_pay" value="[% Currency.format_without_symbol( total_due ) %]" />
196
                                        <input type="hidden" name="total_due" id="total_due" value="[% total_due %]" />
197
198
                                        <input type="checkbox" id="receive_different_amount" />
199
                                        <label for="receive_different_amount"><i>Receive different amount</i></label>
200
                                    </p>
201
202
                                    <p id="amount-received-p">
203
                                        <label for="amount_received">Amount recieved: [% Currency.symbol() %]</label>
204
                                        <input type="text" name="amount_received" id="amount_received" />
205
                                    </p>
206
207
                                    <p>
208
                                        <label for="type">Type:</label>
209
                                        <select id="type" name="type">
210
                                            <option value="PAYMENT">Payment</option>
211
                                            <option value="WRITEOFF">Writeoff</option>
212
                                            [% FOREACH c IN credit_types_loop %]
213
                                                <option value="[% c.authorised_value %]">[% c.lib %]</option>
214
                                            [% END %]
215
                                        </select>
216
                                    </p>
217
218
                                    <p>
219
                                        <label for="notes">Payment notes:</label>
220
                                        <input type="textbox" name="notes" id="notes" />
221
                                    <p>
222
                                </fieldset>
223
224
                                <fieldset class="action">
225
                                    <input type="submit" id="process" value="Process" class="submit" />
226
                                    <a class="cancel" href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
227
                                </fieldset>
228
229
                            </form>
230
231
                        [% ELSE %]
232
                            <p>
233
                                [% borrower.firstname %] [% borrower.surname %] has no outstanding fines.
234
                            </p>
235
                        [% END %]
236
237
                    </div>
238
                </div>
239
            </div>
240
        </div>
241
242
        <div class="yui-b">
243
            [% INCLUDE 'circ-menu.tt' %]
244
        </div>
245
    </div>
246
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_print.tt (+149 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% USE Currency %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Print Receipt for [% cardnumber %]</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
8
<script type="text/javascript">
9
    function printThenClose() {
10
        window.print();
11
        window.close();
12
    }
13
</script>
14
</head>
15
16
[% SET account = debit || credit %]
17
[% SET borrower = account.borrower %]
18
19
<body id="account-print-body" onload="printThenClose();">
20
21
    <table>
22
        <thead>
23
            <tr>
24
                <th colspan="99">
25
                    [% IF debit %]
26
                        Invoice
27
                    [% ELSIF credit %]
28
                        Payment receipt
29
                    [% END %]
30
                </th>
31
            </tr>
32
33
            <tr>
34
                <th colspan="99">
35
                    [% IF credit %]
36
                        [% account.branch.branchname %]
37
                    [% ELSE %]
38
                        [% borrower.branch.branchname %]
39
                    [% END %]
40
                </th>
41
            </tr>
42
43
            <tr>
44
                <th>Name:</th>
45
                <th colspan="99">[% borrower.firstname %] [% borrower.surname %]</th>
46
            </tr>
47
48
            <tr>
49
                <th>Card number:</th>
50
                <th colspan="99">[% borrower.cardnumber %]</th>
51
            </tr>
52
53
            <tr>
54
                <th>Date:</th>
55
                <th colspan="99">[% account.created_on | $KohaDates %]</th>
56
            </tr>
57
58
            [% IF account.description %]
59
                <tr>
60
                    <th>Description:</th>
61
                    <th colspan="99">[% account.description %]</th>
62
                </tr>
63
            [% END %]
64
65
            [% IF credit %]
66
                <tr>
67
                    <th>Amount paid:</th>
68
                    <th colspan="99">[% credit.amount_paid | $Currency highlight => type %]</th>
69
                </tr>
70
                [% IF credit.amount_received > 0 %]
71
                    <tr>
72
                        <th>Amount received:</th>
73
                        <th colspan="99">[% credit.amount_received | $Currency highlight => type %]</th>
74
                    </tr>
75
                    <tr>
76
                        <th>Change due:</th>
77
                        <th colspan="99">[% credit.amount_received - credit.amount_paid | $Currency highlight => type %]</th>
78
                    </tr>
79
                [% END %]
80
                <tr>
81
                    <th>Balance:</th>
82
                    <th colspan="99">[% credit.amount_remaining | $Currency highlight => type %]</th>
83
                </tr>
84
                [% IF credit.account_offsets %]
85
                    <tr>
86
                        <th colspan="99">Fees paid</th>
87
                    </tr>
88
                    <tr>
89
                        <th>Description</th>
90
                        <th>Type</th>
91
                        <th>Amount</th>
92
                        <th>Paid</th>
93
                        <th>Outstanding</th>
94
                        <th>Date</th>
95
                    </tr>
96
                [% END %]
97
            [% ELSIF debit %]
98
                <tr>
99
                    <th>Amount:</th>
100
                    <th colspan="99">[% debit.amount_original | $Currency highlight => type %]</th>
101
                </tr>
102
                <tr>
103
                    <th>Outstanding:</th>
104
                    <th colspan="99">[% debit.amount_outstanding | $Currency highlight => type %]</th>
105
                </tr>
106
                [% IF debit.account_offsets %]
107
                    <tr>
108
                        <th colspan="99">Payments applied</th>
109
                    </tr>
110
                    <tr>
111
                        <th>Date</th>
112
                        <th>Type</th>
113
                        <th>Payment</th>
114
                        <th>Applied</th>
115
                        <th>Balance</th>
116
                        <th>Notes</th>
117
                    </tr>
118
                [% END %]
119
            [% END %]
120
        </thead>
121
122
        <tbody>
123
            [% IF credit.account_offsets %]
124
                [% FOREACH ao IN credit.account_offsets %]
125
                    <tr>
126
                        <td>[% ao.debit.description %]</td>
127
                        <td>[% ao.debit.type %]</td>
128
                        <td>[% ao.debit.amount_original | $Currency highlight => 'debit' %]</td>
129
                        <td>[% ao.amount | $Currency highlight => 'offset' %]</td>
130
                        <td>[% ao.debit.amount_outstanding | $Currency highlight => 'debit' %]</td>
131
                        <td>[% ao.debit.created_on | $KohaDates %]</td>
132
                    </tr>
133
                [% END %]
134
            [% ELSIF debit.account_offsets %]
135
                [% FOREACH ao IN debit.account_offsets %]
136
                    <tr>
137
                        <td>[% ao.credit.created_on | $KohaDates %]</td>
138
                        <td>[% ao.credit.type %]</td>
139
                        <td>[% ao.credit.amount_paid | $Currency highlight => 'credit' %]</td>
140
                        <td>[% ao.amount | $Currency highlight => 'offset' %]</td>
141
                        <td>[% ao.credit.amount_remaining | $Currency highlight => 'credit' %]</td>
142
                        <td>[% ao.credit.notes %]</td>
143
                    </tr>
144
                [% END %]
145
            [% END %]
146
        </tbody>
147
    </table>
148
149
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/members/account.pl (+132 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 $show_all = $cgi->param('show_all');
47
48
my $borrowernumber = $cgi->param('borrowernumber');
49
50
my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
51
52
my $schema =  Koha::Database->new()->schema();
53
54
my %params;
55
$params{-not} = { amount_outstanding => '0' } unless $show_all;
56
my @debits = $schema->resultset('AccountDebit')->search(
57
    {
58
        'me.borrowernumber' => $borrowernumber,
59
        %params,
60
    },
61
    { prefetch            => { account_offsets => 'credit' } }
62
);
63
64
%params = ();
65
$params{-not} = { amount_remaining => '0' } unless $show_all;
66
my @credits = $schema->resultset('AccountCredit')->search(
67
    {
68
        'me.borrowernumber' => $borrowernumber,
69
        %params,
70
    },
71
    { prefetch            => { account_offsets => 'debit' } }
72
);
73
74
$template->param(
75
    debits   => \@debits,
76
    credits  => \@credits,
77
    borrower => $borrower,
78
79
    # IDs for automatic receipt printing
80
    debit_id  => $cgi->param('debit_id')  || undef,
81
    credit_id => $cgi->param('credit_id') || undef,
82
83
    show_all => $show_all,
84
);
85
86
# Standard /members/ borrower details data
87
## FIXME: This code is in every /members/ script and should be unified
88
89
if ( $borrower->{'category_type'} eq 'C' ) {
90
    my ( $catcodes, $labels ) =
91
      GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
92
    my $cnt = scalar(@$catcodes);
93
    $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
94
    $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
95
}
96
97
my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
98
$template->param( picture => 1 ) if $picture;
99
100
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
101
    my $attributes = GetBorrowerAttributes($borrowernumber);
102
    $template->param(
103
        ExtendedPatronAttributes => 1,
104
        extendedattributes       => $attributes
105
    );
106
}
107
108
$template->param(
109
    borrowernumber => $borrowernumber,
110
    firstname      => $borrower->{'firstname'},
111
    surname        => $borrower->{'surname'},
112
    cardnumber     => $borrower->{'cardnumber'},
113
    categorycode   => $borrower->{'categorycode'},
114
    category_type  => $borrower->{'category_type'},
115
    categoryname   => $borrower->{'description'},
116
    address        => $borrower->{'address'},
117
    address2       => $borrower->{'address2'},
118
    city           => $borrower->{'city'},
119
    state          => $borrower->{'state'},
120
    zipcode        => $borrower->{'zipcode'},
121
    country        => $borrower->{'country'},
122
    phone          => $borrower->{'phone'},
123
    email          => $borrower->{'email'},
124
    branchcode     => $borrower->{'branchcode'},
125
    branchname     => GetBranchName( $borrower->{'branchcode'} ),
126
    is_child       => ( $borrower->{'category_type'} eq 'C' ),
127
    activeBorrowerRelationship =>
128
      ( C4::Context->preference('borrowerRelationship') ne '' ),
129
    RoutingSerials => C4::Context->preference('RoutingSerials'),
130
);
131
132
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 (+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::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 $credit = 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
    my $credit_id = $credit->credit_id();
63
64
    print $cgi->redirect(
65
        "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber&credit_id=$credit_id");
66
}
(-)a/members/account_print.pl (+60 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 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;
(-)a/members/account_void.pl (-1 / +38 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::Accounts;
27
28
my $cgi = new CGI;
29
30
my $id             = $cgi->param('id');
31
my $borrowernumber = $cgi->param('borrowernumber');
32
33
if ( checkauth( $cgi, 0, { borrowers => 1 }, 'intranet' ) ) {
34
    VoidCredit( { id => $id } );
35
36
    print $cgi->redirect(
37
        "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
38
}

Return to bug 6427