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

(-)a/Koha/Account/Line.pm (-1 / +3 lines)
Lines 243-249 sub debits { Link Here
243
243
244
  $payment_accountline->void({
244
  $payment_accountline->void({
245
      interface => $interface,
245
      interface => $interface,
246
      [ staff_id => $staff_id, branch => $branchcode ]
246
      [ staff_id => $staff_id, branch => $branchcode ],
247
      note       => $note
247
  });
248
  });
248
249
249
Used to 'void' (or reverse) a payment/credit. It will roll back any offsets
250
Used to 'void' (or reverse) a payment/credit. It will roll back any offsets
Lines 308-313 sub void { Link Here
308
                    manager_id        => $params->{staff_id},
309
                    manager_id        => $params->{staff_id},
309
                    interface         => $params->{interface},
310
                    interface         => $params->{interface},
310
                    branchcode        => $params->{branch},
311
                    branchcode        => $params->{branch},
312
                    note              => $params->{note}
311
                }
313
                }
312
            )->store();
314
            )->store();
313
315
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-18 / +42 lines)
Lines 175-190 Link Here
175
            </form>
175
            </form>
176
        [% END %]
176
        [% END %]
177
        [% IF account.is_credit && account.status != 'VOID' %]
177
        [% IF account.is_credit && account.status != 'VOID' %]
178
          <form method="post" action="/cgi-bin/koha/members/boraccount.pl">
178
            <button type="button" data-toggle="modal" data-target="#voidPaymentModal" data-accountline="[% account.accountlines_id | html %]" data-member="[% account.borrowernumber | html %]" class="btn btn-default btn-xs void-action"><i class="fa fa-ban"></i> Void payment</button>
179
            [% INCLUDE 'csrf-token.inc' %]
180
            <input type="hidden" name="op" value="cud-void" />
181
            <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
182
            <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]">
183
            <button type="submit" class="btn btn-default btn-xs void-action">
184
                <i class="fa fa-ban"></i>
185
                Void payment
186
            </button>
187
          </form>
188
        [% END %]
179
        [% END %]
189
        [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
180
        [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
190
          <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
181
          <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
Lines 398-403 Link Here
398
        </form> <!-- /#discount_form -->
389
        </form> <!-- /#discount_form -->
399
    </div> <!-- /#applyDiscountModal -->
390
    </div> <!-- /#applyDiscountModal -->
400
391
392
    <!-- Void payment modal -->
393
    <div class="modal" id="voidPaymentModal" tabindex="-1" role="dialog" aria-labelledby="voidPaymentLabel">
394
        <form  id="void_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated">
395
            [% INCLUDE 'csrf-token.inc' %]
396
            <input type="hidden" name="accountlines_id" value="" id="voidline">
397
            <input type="hidden" name="op" value="cud-void">
398
            <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
399
            <div class="modal-dialog" role="document">
400
                <div class="modal-content">
401
                    <div class="modal-header">
402
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
403
                        <h4 class="modal-title" id="voidPaymentLabel">Void payment</h4>
404
                    </div>
405
                    <div class="modal-body">
406
                        <fieldset class="rows">
407
                            <ol>
408
                                <li>
409
                                    <label for="apply_discount_note">Note: </label>
410
                                    <input type="text" id="void_note" name="void_note">
411
                                </li>
412
                            </ol>
413
                        </fieldset> <!-- /.rows -->
414
                    </div> <!-- /.modal-body -->
415
                    <div class="modal-footer">
416
                        <button type="submit" class="btn btn-default">Confirm</button>
417
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
418
                    </div> <!-- /.modal-footer -->
419
                </div> <!-- /.modal-content -->
420
            </div> <!-- /.modal-dialog -->
421
        </form> <!-- /#void_form -->
422
    </div> <!-- /#voidPaymentModal -->
423
424
401
[% MACRO jsinclude BLOCK %]
425
[% MACRO jsinclude BLOCK %]
402
    [% INCLUDE 'datatables.inc' %]
426
    [% INCLUDE 'datatables.inc' %]
403
    [% INCLUDE 'format_price.inc' %]
427
    [% INCLUDE 'format_price.inc' %]
Lines 432-445 Link Here
432
                $(this).toggleClass('filtered');
456
                $(this).toggleClass('filtered');
433
            });
457
            });
434
458
435
            $(".void-action").on("click",function(e){
436
                if( confirm( _("Are you sure you want to void this credit?") ) ) {
437
                    return true;
438
                } else {
439
                    e.preventDefault();
440
                }
441
            });
442
443
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
459
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
444
                var button = $(e.relatedTarget);
460
                var button = $(e.relatedTarget);
445
                var accountline = button.data('accountline');
461
                var accountline = button.data('accountline');
Lines 482-487 Link Here
482
                $("#discount").focus();
498
                $("#discount").focus();
483
            });
499
            });
484
500
501
            $("#voidPaymentModal").on("shown.bs.modal", function(e){
502
                var button = $(e.relatedTarget);
503
                var item = button.data('item');
504
                $("#item + span").replaceWith(item);
505
                var accountline = button.data('accountline');
506
                $('#voidline').val(accountline);
507
            });
508
485
            $(".receipt-email-action").on("click", function(e){
509
            $(".receipt-email-action").on("click", function(e){
486
                e.preventDefault();
510
                e.preventDefault();
487
                return $(this).siblings('form').submit();
511
                return $(this).siblings('form').submit();
(-)a/members/boraccount.pl (-1 / +2 lines)
Lines 73-83 if ( $op eq 'cud-void' ) { Link Here
73
    output_and_exit_if_error($input, $cookie, $template, { check => 'csrf_token' });
73
    output_and_exit_if_error($input, $cookie, $template, { check => 'csrf_token' });
74
    my $payment_id = scalar $input->param('accountlines_id');
74
    my $payment_id = scalar $input->param('accountlines_id');
75
    my $payment    = Koha::Account::Lines->find( $payment_id );
75
    my $payment    = Koha::Account::Lines->find( $payment_id );
76
    my $note       = scalar $input->param('void_note');
76
    $payment->void(
77
    $payment->void(
77
        {
78
        {
78
            branch    => $library_id,
79
            branch    => $library_id,
79
            staff_id  => $logged_in_user->id,
80
            staff_id  => $logged_in_user->id,
80
            interface => 'intranet',
81
            interface => 'intranet',
82
            note      => $note
81
        }
83
        }
82
    );
84
    );
83
}
85
}
84
- 

Return to bug 23674