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

(-)a/Koha/Account/Line.pm (-1 / +3 lines)
Lines 236-242 sub debits { Link Here
236
236
237
  $payment_accountline->void({
237
  $payment_accountline->void({
238
      interface => $interface,
238
      interface => $interface,
239
      [ staff_id => $staff_id, branch => $branchcode ]
239
      [ staff_id => $staff_id, branch => $branchcode ],
240
      note       => $note
240
  });
241
  });
241
242
242
Used to 'void' (or reverse) a payment/credit. It will roll back any offsets
243
Used to 'void' (or reverse) a payment/credit. It will roll back any offsets
Lines 301-306 sub void { Link Here
301
                    manager_id        => $params->{staff_id},
302
                    manager_id        => $params->{staff_id},
302
                    interface         => $params->{interface},
303
                    interface         => $params->{interface},
303
                    branchcode        => $params->{branch},
304
                    branchcode        => $params->{branch},
305
                    note              => $params->{note}
304
                }
306
                }
305
            )->store();
307
            )->store();
306
308
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-18 / +42 lines)
Lines 176-191 Link Here
176
            </form>
176
            </form>
177
        [% END %]
177
        [% END %]
178
        [% IF account.is_credit && account.status != 'VOID' %]
178
        [% IF account.is_credit && account.status != 'VOID' %]
179
          <form method="post" action="/cgi-bin/koha/members/boraccount.pl">
179
            <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>
180
            [% INCLUDE 'csrf-token.inc' %]
181
            <input type="hidden" name="op" value="cud-void" />
182
            <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
183
            <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]">
184
            <button type="submit" class="btn btn-default btn-xs void-action">
185
                <i class="fa fa-ban"></i>
186
                Void payment
187
            </button>
188
          </form>
189
        [% END %]
180
        [% END %]
190
        [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
181
        [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
191
          <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
182
          <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
Lines 402-407 Link Here
402
        </form> <!-- /#discount_form -->
393
        </form> <!-- /#discount_form -->
403
    </div> <!-- /#applyDiscountModal -->
394
    </div> <!-- /#applyDiscountModal -->
404
395
396
    <!-- Void payment modal -->
397
    <div class="modal" id="voidPaymentModal" tabindex="-1" role="dialog" aria-labelledby="voidPaymentLabel">
398
        <form  id="void_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated">
399
            [% INCLUDE 'csrf-token.inc' %]
400
            <input type="hidden" name="accountlines_id" value="" id="voidline">
401
            <input type="hidden" name="op" value="cud-void">
402
            <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
403
            <div class="modal-dialog" role="document">
404
                <div class="modal-content">
405
                    <div class="modal-header">
406
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
407
                        <h4 class="modal-title" id="voidPaymentLabel">Void payment</h4>
408
                    </div>
409
                    <div class="modal-body">
410
                        <fieldset class="rows">
411
                            <ol>
412
                                <li>
413
                                    <label for="apply_discount_note">Note: </label>
414
                                    <input type="text" id="void_note" name="void_note">
415
                                </li>
416
                            </ol>
417
                        </fieldset> <!-- /.rows -->
418
                    </div> <!-- /.modal-body -->
419
                    <div class="modal-footer">
420
                        <button type="submit" class="btn btn-default">Confirm</button>
421
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
422
                    </div> <!-- /.modal-footer -->
423
                </div> <!-- /.modal-content -->
424
            </div> <!-- /.modal-dialog -->
425
        </form> <!-- /#void_form -->
426
    </div> <!-- /#voidPaymentModal -->
427
    
428
405
[% MACRO jsinclude BLOCK %]
429
[% MACRO jsinclude BLOCK %]
406
    [% INCLUDE 'datatables.inc' %]
430
    [% INCLUDE 'datatables.inc' %]
407
    [% INCLUDE 'format_price.inc' %]
431
    [% INCLUDE 'format_price.inc' %]
Lines 436-449 Link Here
436
                $(this).toggleClass('filtered');
460
                $(this).toggleClass('filtered');
437
            });
461
            });
438
462
439
            $(".void-action").on("click",function(e){
440
                if( confirm( _("Are you sure you want to void this credit?") ) ) {
441
                    return true;
442
                } else {
443
                    e.preventDefault();
444
                }
445
            });
446
447
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
463
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
448
                var button = $(e.relatedTarget);
464
                var button = $(e.relatedTarget);
449
                var accountline = button.data('accountline');
465
                var accountline = button.data('accountline');
Lines 486-491 Link Here
486
                $("#discount").focus();
502
                $("#discount").focus();
487
            });
503
            });
488
504
505
            $("#voidPaymentModal").on("shown.bs.modal", function(e){
506
                var button = $(e.relatedTarget);
507
                var item = button.data('item');
508
                $("#item + span").replaceWith(item);
509
                var accountline = button.data('accountline');
510
                $('#voidline').val(accountline);
511
            });
512
489
            $(".receipt-email-action").on("click", function(e){
513
            $(".receipt-email-action").on("click", function(e){
490
                e.preventDefault();
514
                e.preventDefault();
491
                return $(this).siblings('form').submit();
515
                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