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

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

Return to bug 23674