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

(-)a/Koha/Account/Line.pm (-1 / +3 lines)
Lines 231-237 sub debits { Link Here
231
231
232
  $payment_accountline->void({
232
  $payment_accountline->void({
233
      interface => $interface,
233
      interface => $interface,
234
      [ staff_id => $staff_id, branch => $branchcode ]
234
      [ staff_id => $staff_id, branch => $branchcode ],
235
      note       => $note
235
  });
236
  });
236
237
237
Used to 'void' (or reverse) a payment/credit. It will roll back any offsets
238
Used to 'void' (or reverse) a payment/credit. It will roll back any offsets
Lines 290-295 sub void { Link Here
290
                    manager_id        => $params->{staff_id},
291
                    manager_id        => $params->{staff_id},
291
                    interface         => $params->{interface},
292
                    interface         => $params->{interface},
292
                    branchcode        => $params->{branch},
293
                    branchcode        => $params->{branch},
294
                    note              => $params->{note}
293
                }
295
                }
294
            )->store();
296
            )->store();
295
297
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-18 / +56 lines)
Lines 182-197 Link Here
182
                                    </form>
182
                                    </form>
183
                                [% END %]
183
                                [% END %]
184
                                [% IF account.is_credit && account.status != 'VOID' %]
184
                                [% IF account.is_credit && account.status != 'VOID' %]
185
                                    <form method="post" action="/cgi-bin/koha/members/boraccount.pl">
185
                                    <button
186
                                        [% INCLUDE 'csrf-token.inc' %]
186
                                        type="button"
187
                                        <input type="hidden" name="op" value="cud-void" />
187
                                        data-toggle="modal"
188
                                        <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
188
                                        data-target="#voidPaymentModal"
189
                                        <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]" />
189
                                        data-accountline="[% account.accountlines_id | html %]"
190
                                        <button type="submit" class="btn btn-default btn-xs void-action">
190
                                        data-member="[% account.borrowernumber | html %]"
191
                                            <i class="fa fa-ban"></i>
191
                                        class="btn btn-default btn-xs void-action"
192
                                            Void payment
192
                                        ><i class="fa fa-ban"></i> Void payment</button
193
                                        </button>
193
                                    >
194
                                    </form>
195
                                [% END %]
194
                                [% END %]
196
                                [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
195
                                [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
197
                                    <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
196
                                    <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
Lines 435-440 Link Here
435
</div>
434
</div>
436
<!-- /#applyDiscountModal -->
435
<!-- /#applyDiscountModal -->
437
436
437
<!-- Void payment modal -->
438
<div class="modal" id="voidPaymentModal" tabindex="-1" role="dialog" aria-labelledby="voidPaymentLabel">
439
    <form id="void_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated">
440
        [% INCLUDE 'csrf-token.inc' %]
441
        <input type="hidden" name="accountlines_id" value="" id="voidline" />
442
        <input type="hidden" name="op" value="cud-void" />
443
        <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]" />
444
        <div class="modal-dialog" role="document">
445
            <div class="modal-content">
446
                <div class="modal-header">
447
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
448
                    <h4 class="modal-title" id="voidPaymentLabel">Void payment</h4>
449
                </div>
450
                <div class="modal-body">
451
                    <fieldset class="rows">
452
                        <ol>
453
                            <li>
454
                                <label for="apply_discount_note">Note: </label>
455
                                <input type="text" id="void_note" name="void_note" />
456
                            </li>
457
                        </ol>
458
                    </fieldset>
459
                    <!-- /.rows -->
460
                </div>
461
                <!-- /.modal-body -->
462
                <div class="modal-footer">
463
                    <button type="submit" class="btn btn-default">Confirm</button>
464
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
465
                </div>
466
                <!-- /.modal-footer -->
467
            </div>
468
            <!-- /.modal-content -->
469
        </div>
470
        <!-- /.modal-dialog -->
471
    </form>
472
    <!-- /#void_form -->
473
</div>
474
<!-- /#voidPaymentModal -->
475
438
[% MACRO jsinclude BLOCK %]
476
[% MACRO jsinclude BLOCK %]
439
    [% INCLUDE 'datatables.inc' %]
477
    [% INCLUDE 'datatables.inc' %]
440
    [% INCLUDE 'format_price.inc' %]
478
    [% INCLUDE 'format_price.inc' %]
Lines 469-482 Link Here
469
                $(this).toggleClass('filtered');
507
                $(this).toggleClass('filtered');
470
            });
508
            });
471
509
472
            $(".void-action").on("click",function(e){
473
                if( confirm( _("Are you sure you want to void this credit?") ) ) {
474
                    return true;
475
                } else {
476
                    e.preventDefault();
477
                }
478
            });
479
480
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
510
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
481
                var button = $(e.relatedTarget);
511
                var button = $(e.relatedTarget);
482
                var accountline = button.data('accountline');
512
                var accountline = button.data('accountline');
Lines 519-524 Link Here
519
                $("#discount").focus();
549
                $("#discount").focus();
520
            });
550
            });
521
551
552
            $("#voidPaymentModal").on("shown.bs.modal", function(e){
553
                var button = $(e.relatedTarget);
554
                var item = button.data('item');
555
                $("#item + span").replaceWith(item);
556
                var accountline = button.data('accountline');
557
                $('#voidline').val(accountline);
558
            });
559
522
            $(".receipt-email-action").on("click", function(e){
560
            $(".receipt-email-action").on("click", function(e){
523
                e.preventDefault();
561
                e.preventDefault();
524
                return $(this).siblings('form').submit();
562
                return $(this).siblings('form').submit();
(-)a/members/boraccount.pl (-1 / +2 lines)
Lines 75-85 if ( $op eq 'cud-void' ) { Link Here
75
    output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } );
75
    output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } );
76
    my $payment_id = scalar $input->param('accountlines_id');
76
    my $payment_id = scalar $input->param('accountlines_id');
77
    my $payment    = Koha::Account::Lines->find($payment_id);
77
    my $payment    = Koha::Account::Lines->find($payment_id);
78
    my $note       = scalar $input->param('void_note');
78
    $payment->void(
79
    $payment->void(
79
        {
80
        {
80
            branch    => $library_id,
81
            branch    => $library_id,
81
            staff_id  => $logged_in_user->id,
82
            staff_id  => $logged_in_user->id,
82
            interface => 'intranet',
83
            interface => 'intranet',
84
            note      => $note
83
        }
85
        }
84
    );
86
    );
85
}
87
}
86
- 

Return to bug 23674