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 399-404 Link Here
399
        </form> <!-- /#discount_form -->
390
        </form> <!-- /#discount_form -->
400
    </div> <!-- /#applyDiscountModal -->
391
    </div> <!-- /#applyDiscountModal -->
401
392
393
    <!-- Void payment modal -->
394
    <div class="modal" id="voidPaymentModal" tabindex="-1" role="dialog" aria-labelledby="voidPaymentLabel">
395
        <form  id="void_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated">
396
            [% INCLUDE 'csrf-token.inc' %]
397
            <input type="hidden" name="accountlines_id" value="" id="voidline">
398
            <input type="hidden" name="op" value="cud-void">
399
            <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
400
            <div class="modal-dialog" role="document">
401
                <div class="modal-content">
402
                    <div class="modal-header">
403
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
404
                        <h4 class="modal-title" id="voidPaymentLabel">Void payment</h4>
405
                    </div>
406
                    <div class="modal-body">
407
                        <fieldset class="rows">
408
                            <ol>
409
                                <li>
410
                                    <label for="apply_discount_note">Note: </label>
411
                                    <input type="text" id="void_note" name="void_note">
412
                                </li>
413
                            </ol>
414
                        </fieldset> <!-- /.rows -->
415
                    </div> <!-- /.modal-body -->
416
                    <div class="modal-footer">
417
                        <button type="submit" class="btn btn-default">Confirm</button>
418
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
419
                    </div> <!-- /.modal-footer -->
420
                </div> <!-- /.modal-content -->
421
            </div> <!-- /.modal-dialog -->
422
        </form> <!-- /#void_form -->
423
    </div> <!-- /#voidPaymentModal -->
424
425
402
[% MACRO jsinclude BLOCK %]
426
[% MACRO jsinclude BLOCK %]
403
    [% INCLUDE 'datatables.inc' %]
427
    [% INCLUDE 'datatables.inc' %]
404
    [% INCLUDE 'format_price.inc' %]
428
    [% INCLUDE 'format_price.inc' %]
Lines 433-446 Link Here
433
                $(this).toggleClass('filtered');
457
                $(this).toggleClass('filtered');
434
            });
458
            });
435
459
436
            $(".void-action").on("click",function(e){
437
                if( confirm( _("Are you sure you want to void this credit?") ) ) {
438
                    return true;
439
                } else {
440
                    e.preventDefault();
441
                }
442
            });
443
444
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
460
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
445
                var button = $(e.relatedTarget);
461
                var button = $(e.relatedTarget);
446
                var accountline = button.data('accountline');
462
                var accountline = button.data('accountline');
Lines 483-488 Link Here
483
                $("#discount").focus();
499
                $("#discount").focus();
484
            });
500
            });
485
501
502
            $("#voidPaymentModal").on("shown.bs.modal", function(e){
503
                var button = $(e.relatedTarget);
504
                var item = button.data('item');
505
                $("#item + span").replaceWith(item);
506
                var accountline = button.data('accountline');
507
                $('#voidline').val(accountline);
508
            });
509
486
            $(".receipt-email-action").on("click", function(e){
510
            $(".receipt-email-action").on("click", function(e){
487
                e.preventDefault();
511
                e.preventDefault();
488
                return $(this).siblings('form').submit();
512
                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