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

(-)a/Koha/Account/Line.pm (+1 lines)
Lines 436-441 sub cancel { Link Here
436
                    borrowernumber    => $self->borrowernumber,
436
                    borrowernumber    => $self->borrowernumber,
437
                    interface         => 'intranet',
437
                    interface         => 'intranet',
438
                    branchcode        => $params->{branch},
438
                    branchcode        => $params->{branch},
439
                    note              => $params->{note},
439
                }
440
                }
440
            )->store();
441
            )->store();
441
442
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-9 / +38 lines)
Lines 179-193 Link Here
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>
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
        [% END %]
180
        [% END %]
181
        [% 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') %]
182
          <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
182
            <button type="button" data-toggle="modal" data-target="#cancelChargeModal" data-accountlines_id="[% account.accountlines_id | html %]" data-borrowernumber="[% patron.borrowernumber | html %]" class="btn btn-default btn-xs void-action"><i class="fa fa-ban"></i> Cancel charge</button>
183
            [% INCLUDE 'csrf-token.inc' %]
184
            <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
185
            <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]">
186
            <button type="submit" class="btn btn-default btn-xs cancel-action">
187
                <i class="fa fa-ban"></i>
188
                Cancel charge
189
            </button>
190
          </form>
191
        [% END %]
183
        [% END %]
192
        [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
184
        [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
193
          <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price on_editing => 1 %]" class="btn btn-default btn-xs payout-action"><i class="fa-solid fa-money-bill-1"></i> Issue payout</button>
185
          <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price on_editing => 1 %]" class="btn btn-default btn-xs payout-action"><i class="fa-solid fa-money-bill-1"></i> Issue payout</button>
Lines 425-430 Link Here
425
        </form> <!-- /#void_form -->
417
        </form> <!-- /#void_form -->
426
    </div> <!-- /#voidPaymentModal -->
418
    </div> <!-- /#voidPaymentModal -->
427
419
420
    <!-- Cancel charge modal -->
421
    <div class="modal" id="cancelChargeModal" tabindex="-1" role="dialog" aria-labelledby="cancelChangreLabel">
422
        <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
423
            [% INCLUDE 'csrf-token.inc' %]
424
            <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
425
            <input type="hidden" name="accountlines_id" id="accountlines_id" value="">
426
            <div class="modal-dialog" role="document">
427
                <div class="modal-content">
428
                    <div class="modal-header">
429
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
430
                        <h4 class="modal-title" id="cancelChargeLabel">Cancel charge</h4>
431
                    </div>
432
                    <div class="modal-body">
433
                        <fieldset class="rows">
434
                            <ol>
435
                                <li>
436
                                    <label for="cancel_charge_note">Note: </label>
437
                                    <input type="text" id="cnacel_charge_note" name="cancel_charge_note">
438
                                </li>
439
                            </ol>
440
                        </fieldset> <!-- /.rows -->
441
                    </div> <!-- /.modal-body -->
442
                    <div class="modal-footer">
443
                        <button type="submit" class="btn btn-default">Confirm</button>
444
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
445
                    </div> <!-- /.modal-footer -->
446
                </div> <!-- /.modal-content -->
447
            </div> <!-- /.modal-dialog -->
448
        </form> <!-- /#cancel_charge_form -->
449
    </div> <!-- /#voidPaymentModal -->
450
428
451
429
[% MACRO jsinclude BLOCK %]
452
[% MACRO jsinclude BLOCK %]
430
    [% INCLUDE 'datatables.inc' %]
453
    [% INCLUDE 'datatables.inc' %]
Lines 510-515 Link Here
510
                $('#voidline').val(accountline);
533
                $('#voidline').val(accountline);
511
            });
534
            });
512
535
536
            $("#cancelChargeModal").on("shown.bs.modal", function(e){
537
                var button = $(e.relatedTarget);
538
                var item = button.data('accountlines_id');
539
                $('#accountlines_id').val(item);
540
            });
541
513
            $(".receipt-email-action").on("click", function(e){
542
            $(".receipt-email-action").on("click", function(e){
514
                e.preventDefault();
543
                e.preventDefault();
515
                return $(this).siblings('form').submit();
544
                return $(this).siblings('form').submit();
(-)a/members/cancel-charge.pl (-3 / +3 lines)
Lines 34-45 my ($user, $cookie) = C4::Auth::checkauth($cgi, $authnotrequired, $flags, $type) Link Here
34
34
35
my $borrowernumber = $cgi->param('borrowernumber');
35
my $borrowernumber = $cgi->param('borrowernumber');
36
my $accountlines_id = $cgi->param('accountlines_id');
36
my $accountlines_id = $cgi->param('accountlines_id');
37
37
my $cancel_charge_note = $cgi->param('cancel_charge_note');
38
my $charge = Koha::Account::Lines->find($accountlines_id);
38
my $charge = Koha::Account::Lines->find($accountlines_id);
39
$charge->cancel(
39
$charge->cancel(
40
    {
40
    {
41
        branch   => C4::Context->userenv->{'branch'},
41
        branch   => C4::Context->userenv->{'branch'},
42
        staff_id => C4::Context->userenv->{'number'}
42
        staff_id => C4::Context->userenv->{'number'},
43
        note     => $cancel_charge_note,
43
    }
44
    }
44
);
45
);
45
46
46
- 

Return to bug 23674