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

(-)a/Koha/Accounts.pm (-5 / +53 lines)
Lines 25-33 use Data::Dumper qw(Dumper); Link Here
25
use C4::Context;
25
use C4::Context;
26
use C4::Log qw(logaction);
26
use C4::Log qw(logaction);
27
use Koha::DateUtils qw(get_timestamp);
27
use Koha::DateUtils qw(get_timestamp);
28
29
use Koha::Accounts::CreditTypes;
28
use Koha::Accounts::CreditTypes;
30
use Koha::Accounts::DebitTypes;
29
use Koha::Accounts::DebitTypes;
30
use Koha::Accounts::OffsetTypes;
31
use Koha::Database;
31
32
32
use vars qw($VERSION @ISA @EXPORT);
33
use vars qw($VERSION @ISA @EXPORT);
33
34
Lines 38-43 BEGIN { Link Here
38
      AddDebit
39
      AddDebit
39
      AddCredit
40
      AddCredit
40
41
42
      VoidCredit
43
41
      NormalizeBalances
44
      NormalizeBalances
42
45
43
      RecalculateAccountBalance
46
      RecalculateAccountBalance
Lines 309-317 sub AddCredit { Link Here
309
        $type = Koha::Accounts::CreditTypes::Payment;
312
        $type = Koha::Accounts::CreditTypes::Payment;
310
    }
313
    }
311
314
312
    my $debit =
313
      Koha::Database->new()->schema->resultset('AccountDebit')->find($debit_id);
314
315
    # First, we make the credit. We'll worry about what we paid later on
315
    # First, we make the credit. We'll worry about what we paid later on
316
    my $credit =
316
    my $credit =
317
      Koha::Database->new()->schema->resultset('AccountCredit')->create(
317
      Koha::Database->new()->schema->resultset('AccountCredit')->create(
Lines 378-384 sub CreditDebit { Link Here
378
378
379
    croak("Required parameter 'credit' not passed in!")
379
    croak("Required parameter 'credit' not passed in!")
380
      unless $credit;
380
      unless $credit;
381
    croak("Required parameter 'debit' not passed in!") unless $debit;
381
    croak("Required parameter 'debit' not passed in!")
382
      unless $debit;
382
383
383
    my $amount_to_pay =
384
    my $amount_to_pay =
384
      ( $debit->amount_outstanding() > $credit->amount_remaining() )
385
      ( $debit->amount_outstanding() > $credit->amount_remaining() )
Lines 388-397 sub CreditDebit { Link Here
388
    if ( $amount_to_pay > 0 ) {
389
    if ( $amount_to_pay > 0 ) {
389
        $debit->amount_outstanding(
390
        $debit->amount_outstanding(
390
            $debit->amount_outstanding() - $amount_to_pay );
391
            $debit->amount_outstanding() - $amount_to_pay );
392
        $debit->updated_on( get_timestamp() );
391
        $debit->update();
393
        $debit->update();
392
394
393
        $credit->amount_remaining(
395
        $credit->amount_remaining(
394
            $credit->amount_remaining() - $amount_to_pay );
396
            $credit->amount_remaining() - $amount_to_pay );
397
        $credit->updated_on( get_timestamp() );
395
        $credit->update();
398
        $credit->update();
396
399
397
        my $offset =
400
        my $offset =
Lines 452-457 sub RecalculateAccountBalance { Link Here
452
    return $account_balance;
455
    return $account_balance;
453
}
456
}
454
457
458
=head2 VoidCredit
459
    $account_balance = VoidCredit({ id => $credit_id });
460
461
    Reverts a payment. All debits paid by this payment will be
462
    updated such that the amount offset is reinstated for the debit.
463
=cut
464
465
sub VoidCredit {
466
    my ($params) = @_;
467
468
    my $id = $params->{id};
469
470
    croak("No id passed in!") unless $id;
471
472
    my $schema = Koha::Database->new()->schema();
473
474
    my $credit = $schema->resultset('AccountCredit')->find($id);
475
476
    foreach my $offset ( $credit->account_offsets() ) {
477
          my $debit = $offset->debit();
478
479
          $debit->amount_outstanding( $debit->amount_outstanding() - $offset->amount() );
480
          $debit->updated_on( get_timestamp() );
481
          $debit->update();
482
483
          Koha::Database->new()->schema->resultset('AccountOffset')->create(
484
            {
485
                amount     => $offset->amount() * -1,
486
                debit_id   => $debit->id(),
487
                credit_id  => $credit->id(),
488
                created_on => get_timestamp(),
489
                type       => Koha::Accounts::OffsetTypes::Void(),
490
            }
491
          );
492
    }
493
494
    $credit->amount_voided( $credit->amount_paid );
495
    $credit->amount_paid(0);
496
    $credit->amount_remaining(0);
497
    $credit->updated_on( get_timestamp() );
498
    $credit->update();
499
500
    return RecalculateAccountBalance( { borrower => $credit->borrower() } );
501
}
502
455
=head2 NormalizeBalances
503
=head2 NormalizeBalances
456
504
457
    $account_balance = NormalizeBalances({ borrower => $borrower });
505
    $account_balance = NormalizeBalances({ borrower => $borrower });
(-)a/Koha/Accounts/OffsetTypes.pm (+11 lines)
Lines 63-68 sub Fine { Link Here
63
    return 'FINE';
63
    return 'FINE';
64
}
64
}
65
65
66
=head2 VOID
67
68
Indicates this offset was an automatically
69
generated in response to a voided credit
70
71
=cut
72
73
sub Void {
74
    return 'VOID';
75
}
76
66
1;
77
1;
67
78
68
=head1 AUTHOR
79
=head1 AUTHOR
(-)a/Koha/Schema/Result/AccountCredit.pm (-14 / +22 lines)
Lines 55-60 __PACKAGE__->table("account_credits"); Link Here
55
  is_nullable: 0
55
  is_nullable: 0
56
  size: [28,6]
56
  size: [28,6]
57
57
58
=head2 amount_voided
59
60
  data_type: 'decimal'
61
  is_nullable: 1
62
  size: [28,6]
63
58
=head2 notes
64
=head2 notes
59
65
60
  data_type: 'text'
66
  data_type: 'text'
Lines 97-102 __PACKAGE__->add_columns( Link Here
97
  { data_type => "decimal", is_nullable => 0, size => [28, 6] },
103
  { data_type => "decimal", is_nullable => 0, size => [28, 6] },
98
  "amount_remaining",
104
  "amount_remaining",
99
  { data_type => "decimal", is_nullable => 0, size => [28, 6] },
105
  { data_type => "decimal", is_nullable => 0, size => [28, 6] },
106
  "amount_voided",
107
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
100
  "notes",
108
  "notes",
101
  { data_type => "text", is_nullable => 1 },
109
  { data_type => "text", is_nullable => 1 },
102
  "branchcode",
110
  "branchcode",
Lines 112-145 __PACKAGE__->set_primary_key("credit_id"); Link Here
112
120
113
=head1 RELATIONS
121
=head1 RELATIONS
114
122
115
=head2 branchcode
123
=head2 borrowernumber
116
124
117
Type: belongs_to
125
Type: belongs_to
118
126
119
Related object: L<Koha::Schema::Result::Branch>
127
Related object: L<Koha::Schema::Result::Borrower>
120
128
121
=cut
129
=cut
122
130
123
__PACKAGE__->belongs_to(
131
__PACKAGE__->belongs_to(
124
  "branchcode",
132
  "borrowernumber",
125
  "Koha::Schema::Result::Branch",
133
  "Koha::Schema::Result::Borrower",
126
  { branchcode => "branchcode" },
134
  { borrowernumber => "borrowernumber" },
127
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
135
  { on_delete => "CASCADE", on_update => "CASCADE" },
128
);
136
);
129
137
130
=head2 borrowernumber
138
=head2 branchcode
131
139
132
Type: belongs_to
140
Type: belongs_to
133
141
134
Related object: L<Koha::Schema::Result::Borrower>
142
Related object: L<Koha::Schema::Result::Branch>
135
143
136
=cut
144
=cut
137
145
138
__PACKAGE__->belongs_to(
146
__PACKAGE__->belongs_to(
139
  "borrowernumber",
147
  "branchcode",
140
  "Koha::Schema::Result::Borrower",
148
  "Koha::Schema::Result::Branch",
141
  { borrowernumber => "borrowernumber" },
149
  { branchcode => "branchcode" },
142
  { on_delete => "CASCADE", on_update => "CASCADE" },
150
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
143
);
151
);
144
152
145
=head2 account_offsets
153
=head2 account_offsets
Lines 158-165 __PACKAGE__->has_many( Link Here
158
);
166
);
159
167
160
168
161
# Created by DBIx::Class::Schema::Loader v0.07000 @ 2013-12-11 14:04:23
169
# Created by DBIx::Class::Schema::Loader v0.07000 @ 2014-05-29 12:48:58
162
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2VUFELBmtChTTprhmJGq6A
170
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wAjdPOw4IvuhGQOUC4xiJQ
163
171
164
__PACKAGE__->belongs_to(
172
__PACKAGE__->belongs_to(
165
  "borrower",
173
  "borrower",
(-)a/installer/data/mysql/kohastructure.sql (-11 / +12 lines)
Lines 3384-3400 CREATE TABLE IF NOT EXISTS `misc_files` ( -- miscellaneous files attached to rec Link Here
3384
--
3384
--
3385
DROP TABLE IF EXISTS account_credits;
3385
DROP TABLE IF EXISTS account_credits;
3386
CREATE TABLE IF account_credits (
3386
CREATE TABLE IF account_credits (
3387
    credit_id int(11) NOT NULL AUTO_INCREMENT,  -- The unique id for this credit
3387
    credit_id int(11) NOT NULL AUTO_INCREMENT,     -- The unique id for this credit
3388
    borrowernumber int(11) NOT NULL,            -- The borrower this credit applies to
3388
    borrowernumber int(11) NOT NULL,               -- The borrower this credit applies to
3389
    `type` varchar(255) NOT NULL,               -- The type of credit this is ( defined by Koha::Accounts::CreditTypes )
3389
    `type` varchar(255) NOT NULL,                  -- The type of credit this is ( defined by Koha::Accounts::CreditTypes )
3390
    amount_received decimal(28,6) DEFAULT NULL, -- If this was a cash payment, the amount of money given
3390
    amount_received decimal(28,6) DEFAULT NULL,    -- If this was a cash payment, the amount of money given
3391
    amount_paid decimal(28,6) NOT NULL,         -- The actual ammount paid, if less than amount_recieved, change was given back
3391
    amount_paid decimal(28,6) NOT NULL,            -- The actual ammount paid, if less than amount_recieved, change was given back
3392
    amount_remaining decimal(28,6) NOT NULL,    -- The amount of this credit that has not been applied to outstanding debits
3392
    amount_remaining decimal(28,6) NOT NULL,       -- The amount of this credit that has not been applied to outstanding debits
3393
    notes text,                                 -- Misc notes for this credit
3393
    amount_voided decimal(28,6) NULL DEFAULT NULL, -- The amount of this credit was for before it was voided
3394
    branchcode VARCHAR( 10 ) NULL DEFAULT NULL, -- Branchcode where the credit was created ( if any )
3394
    notes text,                                    -- Misc notes for this credit
3395
    manager_id int(11) DEFAULT NULL,            -- The borrowernumber of the user who created this credit ( if any )
3395
    branchcode VARCHAR( 10 ) NULL DEFAULT NULL,    -- Branchcode where the credit was created ( if any )
3396
    created_on timestamp NULL DEFAULT NULL,     -- Timestamp for when this credit was created
3396
    manager_id int(11) DEFAULT NULL,               -- The borrowernumber of the user who created this credit ( if any )
3397
    updated_on timestamp NULL DEFAULT NULL,     -- Timestamp for when this credit was last modified
3397
    created_on timestamp NULL DEFAULT NULL,        -- Timestamp for when this credit was created
3398
    updated_on timestamp NULL DEFAULT NULL,        -- Timestamp for when this credit was last modified
3398
    PRIMARY KEY (credit_id),
3399
    PRIMARY KEY (credit_id),
3399
    KEY borrowernumber (borrowernumber),
3400
    KEY borrowernumber (borrowernumber),
3400
    KEY branchcode (branchcode)
3401
    KEY branchcode (branchcode)
(-)a/installer/data/mysql/updatedatabase.pl (+1 lines)
Lines 8573-8578 if ( CheckVersion($DBversion) ) { Link Here
8573
            amount_received decimal(28,6) DEFAULT NULL,
8573
            amount_received decimal(28,6) DEFAULT NULL,
8574
            amount_paid decimal(28,6) NOT NULL,
8574
            amount_paid decimal(28,6) NOT NULL,
8575
            amount_remaining decimal(28,6) NOT NULL,
8575
            amount_remaining decimal(28,6) NOT NULL,
8576
            amount_voided decimal(28,6) NULL DEFAULT NULL,
8576
            notes text,
8577
            notes text,
8577
            branchcode VARCHAR( 10 ) NULL DEFAULT NULL,
8578
            branchcode VARCHAR( 10 ) NULL DEFAULT NULL,
8578
            manager_id int(11) DEFAULT NULL,
8579
            manager_id int(11) DEFAULT NULL,
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/browser-strings.inc (-1 / +7 lines)
Lines 28-34 Link Here
28
            [% FOREACH a IN AuthorisedValues.Get('MANUAL_CREDIT') %]
28
            [% FOREACH a IN AuthorisedValues.Get('MANUAL_CREDIT') %]
29
                "[% a.authorised_value %]" : "[% a.lib %]",
29
                "[% a.authorised_value %]" : "[% a.lib %]",
30
            [% END %]
30
            [% END %]
31
        }
31
        },
32
33
        "OffsetTypes": {
34
            "DROPBOX"                   : _("Dropbox fine reduction"),
35
            "FINE"                      : _("Fine increment"),
36
            "VOID"                      : _("Voided"),
37
        },
32
    }
38
    }
33
//]]>
39
//]]>
34
</script>
40
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt (-4 / +45 lines)
Lines 12-17 Link Here
12
<script type="text/javascript">
12
<script type="text/javascript">
13
//<![CDATA[
13
//<![CDATA[
14
$(document).ready(function() {
14
$(document).ready(function() {
15
    void_compare = "[% 0 FILTER $Currency highlight => highlight %]";
16
15
    [% IF credit_id %]
17
    [% IF credit_id %]
16
        accountPrint( 'credit', [% credit_id %] );
18
        accountPrint( 'credit', [% credit_id %] );
17
    [% ELSIF debit_id %]
19
    [% ELSIF debit_id %]
Lines 172-178 $(document).ready(function() { Link Here
172
                    return STRINGS['CreditTypes'][val] || val;
174
                    return STRINGS['CreditTypes'][val] || val;
173
                },
175
                },
174
            },
176
            },
175
            { "mDataProp": "amount_paid" },
177
            {
178
                "mDataProp": "amount_paid",
179
                "mRender": function ( data, type, full ) {
180
                    if ( full.amount_voided != void_compare ) {
181
                        return "<strike>" + full.amount_voided + "</strike>";
182
                    } else {
183
                        return full.amount_paid;
184
                    }
185
                }
186
            },
176
            { "mDataProp": "amount_remaining" },
187
            { "mDataProp": "amount_remaining" },
177
            { "mDataProp": "created_on" },
188
            { "mDataProp": "created_on" },
178
            { "mDataProp": "updated_on" }
189
            { "mDataProp": "updated_on" }
Lines 288-300 function fnFormatDebitDetails( debitsTable, nTr ) { Link Here
288
        for ( var i = 0; i < account_offsets.length; i++ ) {
299
        for ( var i = 0; i < account_offsets.length; i++ ) {
289
            ao = account_offsets[i];
300
            ao = account_offsets[i];
290
            credit_type = STRINGS["CreditTypes"][ao.credit.type] || ao.credit.type;
301
            credit_type = STRINGS["CreditTypes"][ao.credit.type] || ao.credit.type;
302
            offset_type = STRINGS["OffsetTypes"][ao.type] || ao.type;
303
            if ( offset_type ) offset_type = " (" + offset_type + ") ";
304
305
            var payment_or_void;
306
            if ( ao.credit.amount_voided != void_compare ) {
307
                payment_or_void = "<strike>" + ao.credit.amount_voided + "</strike>";
308
            } else {
309
                payment_or_void = ao.credit.amount_paid;
310
            }
311
291
            sOut +=
312
            sOut +=
292
            "<tr>" +
313
            "<tr>" +
293
                "<td>" + ao.credit_id + "</td>" +
314
                "<td>" + ao.credit_id + "</td>" +
294
                "<td>" + ao.created_on + "</td>" +
315
                "<td>" + ao.created_on + "</td>" +
295
                "<td>" + ao.credit.amount_paid + "</td>" +
316
                "<td>" + payment_or_void + "</td>" +
296
                "<td>" + ao.amount + "</td>" +
317
                "<td>" + ao.amount + "</td>" +
297
                "<td>" + credit_type + "</td>" +
318
                "<td>" + credit_type + offset_type  + "</td>" +
298
                "<td>" + ao.credit.notes + "</td>" +
319
                "<td>" + ao.credit.notes + "</td>" +
299
            "</tr>";
320
            "</tr>";
300
        }
321
        }
Lines 319-324 function fnFormatCreditDetails( creditsTable, nTr ) { Link Here
319
                "<i class='icon-print'></i> " + _("Print receipt") +
340
                "<i class='icon-print'></i> " + _("Print receipt") +
320
            "</button>";
341
            "</button>";
321
342
343
    if ( ! oData.amount_voided_original ) {
344
    sOut += "<a class='credit_void btn btn-small noprint' style='margin:5px;' onclick='accountVoid(\"credit\"," + oData.credit_id + ")'>" +
345
                "<i class='icon-remove-sign'></i> " + _("Void payment") +
346
            "</a>";
347
    }
348
322
    var account_offsets = oData.account_offsets;
349
    var account_offsets = oData.account_offsets;
323
350
324
    if ( account_offsets.length ) {
351
    if ( account_offsets.length ) {
Lines 331-336 function fnFormatCreditDetails( creditsTable, nTr ) { Link Here
331
                            "<th>" + _("Description") + "</th>" +
358
                            "<th>" + _("Description") + "</th>" +
332
                            "<th>" + _("Type") + "</th>" +
359
                            "<th>" + _("Type") + "</th>" +
333
                            "<th>" + _("Amount") + "</th>" +
360
                            "<th>" + _("Amount") + "</th>" +
361
                            "<th>" + _("Amount applied") + "</th>" +
334
                            "<th>" + _("Remaining") + "</th>" +
362
                            "<th>" + _("Remaining") + "</th>" +
335
                            "<th>" + _("Created on") + "</th>" +
363
                            "<th>" + _("Created on") + "</th>" +
336
                            "<th>" + _("Updated on") + "</th>" +
364
                            "<th>" + _("Updated on") + "</th>" +
Lines 342-353 function fnFormatCreditDetails( creditsTable, nTr ) { Link Here
342
        for ( var i = 0; i < account_offsets.length; i++ ) {
370
        for ( var i = 0; i < account_offsets.length; i++ ) {
343
            ao = account_offsets[i];
371
            ao = account_offsets[i];
344
            debit_type = STRINGS["DebitTypes"][ao.debit.type] || ao.debit.type;
372
            debit_type = STRINGS["DebitTypes"][ao.debit.type] || ao.debit.type;
373
            offset_type = STRINGS["OffsetTypes"][ao.type] || ao.type;
374
            if ( offset_type ) offset_type = " (" + offset_type + ") ";
375
345
            sOut +=
376
            sOut +=
346
            "<tr>" +
377
            "<tr>" +
347
                "<td>" + ao.debit.debit_id + "</td>" +
378
                "<td>" + ao.debit.debit_id + "</td>" +
348
                "<td>" + ao.debit.description + "</td>" +
379
                "<td>" + ao.debit.description + "</td>" +
349
                "<td>" + debit_type + "</td>" +
380
                "<td>" + debit_type + offset_type + "</td>" +
350
                "<td>" + ao.debit.amount_original + "</td>" +
381
                "<td>" + ao.debit.amount_original + "</td>" +
382
                "<td>" + ao.amount + "</td>" +
351
                "<td>" + ao.debit.amount_outstanding + "</td>" +
383
                "<td>" + ao.debit.amount_outstanding + "</td>" +
352
                "<td>" + ao.debit.created_on + "</td>" +
384
                "<td>" + ao.debit.created_on + "</td>" +
353
                "<td>" + ao.debit.updated_on + "</td>" +
385
                "<td>" + ao.debit.updated_on + "</td>" +
Lines 369-374 function fnFormatCreditDetails( creditsTable, nTr ) { Link Here
369
function accountPrint( type, id ) {
401
function accountPrint( type, id ) {
370
    window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id );
402
    window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id );
371
}
403
}
404
405
function accountVoid( type, id ) {
406
    if ( confirm(_("Are you sure you want to void this transaction?")) ) {
407
        window.location.href = "/cgi-bin/koha/members/account_void.pl?borrowernumber=" + [% borrowernumber %] + "&id=" + id;
408
    }
409
}
372
//]]>
410
//]]>
373
</script>
411
</script>
374
</head>
412
</head>
Lines 468-477 function accountPrint( type, id ) { Link Here
468
[% BLOCK format_data %]
506
[% BLOCK format_data %]
469
    [% FOREACH key IN data.result_source.columns %]
507
    [% FOREACH key IN data.result_source.columns %]
470
        [% IF key.match('^amount') %]
508
        [% IF key.match('^amount') %]
509
            "[% key %]_original": "[% data.$key %]",
471
            "[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]",
510
            "[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]",
472
        [% ELSIF key.match('_on$') %]
511
        [% ELSIF key.match('_on$') %]
512
            "[% key %]_original": "[% data.$key %]",
473
            "[% key %]": "[% data.$key | $KohaDates %]",
513
            "[% key %]": "[% data.$key | $KohaDates %]",
474
        [% ELSE %]
514
        [% ELSE %]
515
            "[% key %]_original": "[% data.$key %]",
475
            "[% key %]": "[% data.$key | replace('"', '\"') %]",
516
            "[% key %]": "[% data.$key | replace('"', '\"') %]",
476
        [% END %]
517
        [% END %]
477
    [% END %]
518
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account_payment.tt (-1 lines)
Lines 4-10 Link Here
4
<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
4
<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'browser-strings.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">
7
<script type= "text/javascript">
9
//<![CDATA[
8
//<![CDATA[
10
$( document ).ready(function() {
9
$( document ).ready(function() {
(-)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