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

(-)a/Koha/Account/Line.pm (+1 lines)
Lines 420-425 sub cancel { Link Here
420
                    borrowernumber    => $self->borrowernumber,
420
                    borrowernumber    => $self->borrowernumber,
421
                    interface         => 'intranet',
421
                    interface         => 'intranet',
422
                    branchcode        => $params->{branch},
422
                    branchcode        => $params->{branch},
423
                    note              => $params->{note},
423
                }
424
                }
424
            )->store();
425
            )->store();
425
426
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-9 / +53 lines)
Lines 193-207 Link Here
193
                                    >
193
                                    >
194
                                [% END %]
194
                                [% END %]
195
                                [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
195
                                [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
196
                                    <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
196
                                    <button
197
                                        [% INCLUDE 'csrf-token.inc' %]
197
                                        type="button"
198
                                        <input type="hidden" name="op" value="cud-cancel" />
198
                                        data-toggle="modal"
199
                                        <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]" />
199
                                        data-target="#cancelChargeModal"
200
                                        <button type="submit" class="btn btn-default btn-xs cancel-action">
200
                                        data-accountlines_id="[% account.accountlines_id | html %]"
201
                                            <i class="fa fa-ban"></i>
201
                                        data-borrowernumber="[% patron.borrowernumber | html %]"
202
                                            Cancel charge
202
                                        class="btn btn-default btn-xs void-action"
203
                                        </button>
203
                                        ><i class="fa fa-ban"></i> Cancel charge</button
204
                                    </form>
204
                                    >
205
                                [% END %]
205
                                [% END %]
206
                                [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
206
                                [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
207
                                    <button
207
                                    <button
Lines 477-482 Link Here
477
</div>
477
</div>
478
<!-- /#voidPaymentModal -->
478
<!-- /#voidPaymentModal -->
479
479
480
<!-- Cancel charge modal -->
481
<div class="modal" id="cancelChargeModal" tabindex="-1" role="dialog" aria-labelledby="cancelChangreLabel">
482
    <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
483
        [% INCLUDE 'csrf-token.inc' %]
484
        <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
485
        <input type="hidden" name="accountlines_id" id="accountlines_id" value="" />
486
        <div class="modal-dialog" role="document">
487
            <div class="modal-content">
488
                <div class="modal-header">
489
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
490
                    <h4 class="modal-title" id="cancelChargeLabel">Cancel charge</h4>
491
                </div>
492
                <div class="modal-body">
493
                    <fieldset class="rows">
494
                        <ol>
495
                            <li>
496
                                <label for="cancel_charge_note">Note: </label>
497
                                <input type="text" id="cnacel_charge_note" name="cancel_charge_note" />
498
                            </li>
499
                        </ol>
500
                    </fieldset>
501
                    <!-- /.rows -->
502
                </div>
503
                <!-- /.modal-body -->
504
                <div class="modal-footer">
505
                    <button type="submit" class="btn btn-default">Confirm</button>
506
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
507
                </div>
508
                <!-- /.modal-footer -->
509
            </div>
510
            <!-- /.modal-content -->
511
        </div>
512
        <!-- /.modal-dialog -->
513
    </form>
514
    <!-- /#cancel_charge_form -->
515
</div>
516
<!-- /#voidPaymentModal -->
517
480
[% MACRO jsinclude BLOCK %]
518
[% MACRO jsinclude BLOCK %]
481
    [% INCLUDE 'datatables.inc' %]
519
    [% INCLUDE 'datatables.inc' %]
482
    [% INCLUDE 'format_price.inc' %]
520
    [% INCLUDE 'format_price.inc' %]
Lines 561-566 Link Here
561
                $('#voidline').val(accountline);
599
                $('#voidline').val(accountline);
562
            });
600
            });
563
601
602
            $("#cancelChargeModal").on("shown.bs.modal", function(e){
603
                var button = $(e.relatedTarget);
604
                var item = button.data('accountlines_id');
605
                $('#accountlines_id').val(item);
606
            });
607
564
            $(".receipt-email-action").on("click", function(e){
608
            $(".receipt-email-action").on("click", function(e){
565
                e.preventDefault();
609
                e.preventDefault();
566
                return $(this).siblings('form').submit();
610
                return $(this).siblings('form').submit();
(-)a/members/cancel-charge.pl (-6 / +6 lines)
Lines 35-48 my ( $user, $cookie ) = C4::Auth::checkauth( $cgi, $authnotrequired, $flags, $ty Link Here
35
my $op = $cgi->param('op') // q{};
35
my $op = $cgi->param('op') // q{};
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