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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-1 / +47 lines)
Lines 132-138 Link Here
132
          [% END %]
132
          [% END %]
133
      </td>
133
      </td>
134
      <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
134
      <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
135
      <td>[% account.note | html_line_break %]</td>
135
    <td>
136
        [% account.note | html_line_break %]
137
        [% IF CAN_user_updatecharges_edit_notes %]
138
            <button type="button"  class="btn btn-default btn-xs edit-action" data-toggle="modal" data-target="#editNoteModal" data-accountline="[% account.accountlines_id | html %]" data-note="[% account.note | html %]" data-member="[% account.borrowernumber | html %]"><i class="fa-solid fa-pen"></i> Edit</button>
139
        [% END %]
140
    </td>
136
      [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
141
      [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
137
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
142
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
138
      <td class="actions">
143
      <td class="actions">
Lines 425-430 Link Here
425
        </form> <!-- /#void_form -->
430
        </form> <!-- /#void_form -->
426
    </div> <!-- /#voidPaymentModal -->
431
    </div> <!-- /#voidPaymentModal -->
427
432
433
    <!-- Edit note modal -->
434
    <div class="modal" id="editNoteModal" tabindex="-1" role="dialog" aria-labelledby="editNoteLabel">
435
        <form id="edit_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated">
436
            [% INCLUDE 'csrf-token.inc' %]
437
            <input type="hidden" name="accountlines_id" value="" id="noteline">
438
            <input type="hidden" name="op" value="cud-edit_note">
439
            <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
440
            <div class="modal-dialog" role="document">
441
                <div class="modal-content">
442
                    <div class="modal-header">
443
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
444
                        <h4 class="modal-title" id="editNoteLabel">Edit note</h4>
445
                    </div>
446
                    <div class="modal-body">
447
                        <fieldset class="rows">
448
                            <ol>
449
                                <li>
450
                                    <label for="edited_note">Note: </label>
451
                                    <input name="edited_note" id="edited_note" value="" />
452
                                </li>
453
                            </ol>
454
                        </fieldset> <!-- /.rows -->
455
                    </div> <!-- /.modal-body -->
456
                    <div class="modal-footer">
457
                        <button type="submit" class="btn btn-default">Confirm</button>
458
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
459
                    </div> <!-- /.modal-footer -->
460
                </div> <!-- /.modal-content -->
461
            </div> <!-- /.modal-dialog -->
462
        </form> <!-- /#void_form -->
463
    </div> <!-- /#editNoteModal -->
428
464
429
[% MACRO jsinclude BLOCK %]
465
[% MACRO jsinclude BLOCK %]
430
    [% INCLUDE 'datatables.inc' %]
466
    [% INCLUDE 'datatables.inc' %]
Lines 510-515 Link Here
510
                $('#voidline').val(accountline);
546
                $('#voidline').val(accountline);
511
            });
547
            });
512
548
549
            $("#editNoteModal").on("shown.bs.modal", function(e){
550
                var button = $(e.relatedTarget);
551
                var item = button.data('item');
552
                $("#item + span").replaceWith(item);
553
                var accountline = button.data('accountline');
554
                $('#noteline').val(accountline);
555
                var note = button.data('note');
556
                $('#edited_note').val(note);
557
            });
558
513
            $(".receipt-email-action").on("click", function(e){
559
            $(".receipt-email-action").on("click", function(e){
514
                e.preventDefault();
560
                e.preventDefault();
515
                return $(this).siblings('form').submit();
561
                return $(this).siblings('form').submit();
(-)a/members/boraccount.pl (-1 / +18 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
    output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } );
231
    my $payment_id = scalar $input->param('accountlines_id');
232
    my $note       = scalar $input->param('edited_note');
233
    my $payment    = Koha::Account::Lines->find($payment_id);
234
    $schema->txn_do(
235
        sub {
236
            # Update the note and date in the account line
237
            $payment->set(
238
                {
239
                    date => \'NOW()',
240
                    note => $note
241
                }
242
            )->store();
243
        }
244
    );
245
}
246
229
#get account details
247
#get account details
230
my $total = $patron->account->balance;
248
my $total = $patron->account->balance;
231
249
232
- 

Return to bug 37211