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

(-)a/Koha/Account/Line.pm (+1 lines)
Lines 301-306 sub void { Link Here
301
                    manager_id        => $params->{staff_id},
301
                    manager_id        => $params->{staff_id},
302
                    interface         => $params->{interface},
302
                    interface         => $params->{interface},
303
                    branchcode        => $params->{branch},
303
                    branchcode        => $params->{branch},
304
                    note              => $params->{note},
304
                }
305
                }
305
            )->store();
306
            )->store();
306
307
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-18 / +10 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-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price on_editing => 1 %]" class="btn btn-default btn-xs void-action"><i class="fa-solid 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 245-250 Link Here
245
    [% INCLUDE 'modals/issue_payout.inc' %]
236
    [% INCLUDE 'modals/issue_payout.inc' %]
246
    [% INCLUDE 'modals/issue_refund.inc' %]
237
    [% INCLUDE 'modals/issue_refund.inc' %]
247
    [% INCLUDE 'modals/issue_refund.inc' %]
238
    [% INCLUDE 'modals/issue_refund.inc' %]
239
    [% INCLUDE 'modals/void_payment.inc' %]
248
240
249
[% MACRO jsinclude BLOCK %]
241
[% MACRO jsinclude BLOCK %]
250
    [% INCLUDE 'datatables.inc' %]
242
    [% INCLUDE 'datatables.inc' %]
Lines 280-293 Link Here
280
                $(this).toggleClass('filtered');
272
                $(this).toggleClass('filtered');
281
            });
273
            });
282
274
283
            $(".void-action").on("click",function(e){
284
                if( confirm( _("Are you sure you want to void this credit?") ) ) {
285
                    return true;
286
                } else {
287
                    e.preventDefault();
288
                }
289
            });
290
291
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
275
            $("#issuePayoutModal").on("shown.bs.modal", function(e){
292
                var button = $(e.relatedTarget);
276
                var button = $(e.relatedTarget);
293
                var accountline = button.data('accountline');
277
                var accountline = button.data('accountline');
Lines 330-335 Link Here
330
                $("#discount").focus();
314
                $("#discount").focus();
331
            });
315
            });
332
316
317
            $("#voidPaymentModal").on("shown.bs.modal", function(e){
318
                var button = $(e.relatedTarget);
319
                var accountline = button.data('accountline');
320
                $('#voidline').val(accountline);
321
                var amount = button.data('amount');
322
                $('#void_amount').text(amount);
323
            });
324
333
            $(".receipt-email-action").on("click", function(e){
325
            $(".receipt-email-action").on("click", function(e){
334
                e.preventDefault();
326
                e.preventDefault();
335
                return $(this).siblings('form').submit();
327
                return $(this).siblings('form').submit();
(-)a/members/boraccount.pl (-1 / +2 lines)
Lines 72-83 my $registerid = $input->param('registerid'); Link Here
72
if ( $op eq 'cud-void' ) {
72
if ( $op eq 'cud-void' ) {
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 $void_note = scalar $input->param('void_note');
75
    my $payment    = Koha::Account::Lines->find( $payment_id );
76
    my $payment    = Koha::Account::Lines->find( $payment_id );
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      => $void_note,
81
        }
83
        }
82
    );
84
    );
83
}
85
}
84
- 

Return to bug 24597