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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (+71 lines)
Lines 132-137 Link Here
132
                                    [% account.checkout.library.branchname | html %]
132
                                    [% account.checkout.library.branchname | html %]
133
                                [% END %]
133
                                [% END %]
134
                            </td>
134
                            </td>
135
                            <td>
136
                                [% account.note | html_line_break %]
137
                                [% IF CAN_user_updatecharges_edit_notes %]
138
                                    <button
139
                                        type="button"
140
                                        class="btn btn-default btn-xs edit-action"
141
                                        data-toggle="modal"
142
                                        data-target="#editNoteModal"
143
                                        data-accountline="[% account.accountlines_id | html %]"
144
                                        data-note="[% account.note | html %]"
145
                                        data-member="[% account.borrowernumber | html %]"
146
                                        ><i class="fa-solid fa-pen"></i> Edit</button
147
                                    >
148
                                [% END %]
149
                            </td>
135
                            <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
150
                            <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
136
                            <td>[% account.note | html_line_break %]</td>
151
                            <td>[% account.note | html_line_break %]</td>
137
                            [% IF account.amount <= 0 %]
152
                            [% IF account.amount <= 0 %]
Lines 477-482 Link Here
477
</div>
492
</div>
478
<!-- /#voidPaymentModal -->
493
<!-- /#voidPaymentModal -->
479
494
495
<!-- Edit note modal -->
496
<div class="modal" id="editNoteModal" tabindex="-1" role="dialog" aria-labelledby="editNoteLabel">
497
    <form id="edit_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated">
498
        [% INCLUDE 'csrf-token.inc' %]
499
        <input type="hidden" name="accountlines_id" value="" id="noteline" />
500
        <input type="hidden" name="op" value="cud-edit_note" />
501
        <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]" />
502
503
        <div class="modal-dialog" role="document">
504
            <div class="modal-content">
505
                <div class="modal-header">
506
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
507
                        <span aria-hidden="true">&times;</span>
508
                    </button>
509
                    <h4 class="modal-title" id="editNoteLabel">Edit note</h4>
510
                </div>
511
512
                <div class="modal-body">
513
                    <fieldset class="rows">
514
                        <ol>
515
                            <li>
516
                                <label for="edited_note">Note: </label>
517
                                <input name="edited_note" id="edited_note" value="" />
518
                            </li>
519
                        </ol>
520
                    </fieldset>
521
                    <!-- /.rows -->
522
                </div>
523
                <!-- /.modal-body -->
524
525
                <div class="modal-footer">
526
                    <button type="submit" class="btn btn-default">Confirm</button>
527
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
528
                </div>
529
                <!-- /.modal-footer -->
530
            </div>
531
            <!-- /.modal-content -->
532
        </div>
533
        <!-- /.modal-dialog -->
534
    </form>
535
    <!-- /#void_form -->
536
</div>
537
<!-- /#editNoteModal -->
538
480
<!-- Cancel charge modal -->
539
<!-- Cancel charge modal -->
481
<div class="modal" id="cancelChargeModal" tabindex="-1" role="dialog" aria-labelledby="cancelChangreLabel">
540
<div class="modal" id="cancelChargeModal" tabindex="-1" role="dialog" aria-labelledby="cancelChangreLabel">
482
    <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
541
    <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
Lines 606-611 Link Here
606
                $('#accountlines_id').val(item);
665
                $('#accountlines_id').val(item);
607
            });
666
            });
608
667
668
            $("#editNoteModal").on("shown.bs.modal", function(e) {
669
                var button = $(e.relatedTarget);
670
                var item = button.data('item');
671
                $("#item + span").replaceWith(item);
672
673
                var accountline = button.data('accountline');
674
                $('#noteline').val(accountline);
675
676
                var note = button.data('note');
677
                $('#edited_note').val(note);
678
            });
679
609
            $(".receipt-email-action").on("click", function(e){
680
            $(".receipt-email-action").on("click", function(e){
610
                e.preventDefault();
681
                e.preventDefault();
611
                return $(this).siblings('form').submit();
682
                return $(this).siblings('form').submit();
(-)a/members/boraccount.pl (-1 / +22 lines)
Lines 226-231 if ( $op eq 'cud-send_receipt' ) { Link Here
226
    }
226
    }
227
}
227
}
228
228
229
if ( $op eq 'cud-edit_note' ) {
230
231
    output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } );
232
233
    my $payment_id = scalar $input->param('accountlines_id');
234
    my $note       = scalar $input->param('edited_note');
235
236
    my $payment = Koha::Account::Lines->find($payment_id);
237
238
    $schema->txn_do(
239
        sub {
240
            # Update the note and date in the account line
241
            $payment->set(
242
                {
243
                    date => \'NOW()',
244
                    note => $note
245
                }
246
            )->store();
247
        }
248
    );
249
}
250
229
#get account details
251
#get account details
230
my $total = $patron->account->balance;
252
my $total = $patron->account->balance;
231
253
232
- 

Return to bug 37211