Bugzilla – Attachment 170002 Details for
Bug 37211
All notes in the patron Transactions table should be editable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37211: Make notes in patron transactions table editable
Bug-37211-Make-notes-in-patron-transactions-table-.patch (text/plain), 6.61 KB, created by
Sam Lau
on 2024-08-02 15:21:52 UTC
(
hide
)
Description:
Bug 37211: Make notes in patron transactions table editable
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2024-08-02 15:21:52 UTC
Size:
6.61 KB
patch
obsolete
>From 710401ec34bfc366367b349c182e3b0bfc80179b Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Thu, 27 Jun 2024 17:06:32 +0000 >Subject: [PATCH] Bug 37211: Make notes in patron transactions table editable > >This patch adds an edit button to each notes field in an accountline entry. This feature is controlled by a new staff permision under the 'updatecharges' permision called 'edit_notes'. > >To test: >1) Apply patch, updatedatabase, restart_all >2) In the staff interface, give your logged in user superlibrarian permissions. >3) Visit a patron's accounting tab. Create a manual invoice for some amount and enter a note. >4) Create another manual invoice, this time do not enter a note. >5) Click on the transactions tab to view the table. >6) See that the notes column now has edit buttons. >7) Attempt to edit the note that is not blank. >8) A modal should pop up prompting you to edit your note. The previous note should be in the text box. >9) Edit this note and press confirm. >10) Ensure the note was updated and the updated column was filled with the correct time. >11) Now attempt to edit the blank note. >12) Again, you should see a modal but no prefilled message. Update this note and ensure correct changes. >13) Go back to the permissions for your logged in user and remove the 'edit_notes' subpermission under the 'updatecharges' permissions. >14) Go back to the patron's accounting tab. This time, there should not be any edit buttons in the notes column. >--- > .../prog/en/modules/members/boraccount.tt | 48 ++++++++++++++++++- > members/boraccount.pl | 18 +++++++ > 2 files changed, 65 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >index 57b11a693e..8ab355042d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -132,7 +132,12 @@ > [% END %] > </td> > <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td> >- <td>[% account.note | html_line_break %]</td> >+ <td> >+ [% account.note | html_line_break %] >+ [% IF CAN_user_updatecharges_edit_notes %] >+ <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> >+ [% END %] >+ </td> > [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td> > [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td> > <td class="actions"> >@@ -448,6 +453,37 @@ > </form> <!-- /#cancel_charge_form --> > </div> <!-- /#voidPaymentModal --> > >+ <!-- Edit note modal --> >+ <div class="modal" id="editNoteModal" tabindex="-1" role="dialog" aria-labelledby="editNoteLabel"> >+ <form id="edit_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="accountlines_id" value="" id="noteline"> >+ <input type="hidden" name="op" value="cud-edit_note"> >+ <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]"> >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ <h4 class="modal-title" id="editNoteLabel">Edit note</h4> >+ </div> >+ <div class="modal-body"> >+ <fieldset class="rows"> >+ <ol> >+ <li> >+ <label for="edited_note">Note: </label> >+ <input name="edited_note" id="edited_note" value="" /> >+ </li> >+ </ol> >+ </fieldset> <!-- /.rows --> >+ </div> <!-- /.modal-body --> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-default">Confirm</button> >+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> >+ </div> <!-- /.modal-footer --> >+ </div> <!-- /.modal-content --> >+ </div> <!-- /.modal-dialog --> >+ </form> <!-- /#void_form --> >+ </div> <!-- /#editNoteModal --> > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] >@@ -537,6 +573,16 @@ > $('#accountlines_id').val(item); > }); > >+ $("#editNoteModal").on("shown.bs.modal", function(e){ >+ var button = $(e.relatedTarget); >+ var item = button.data('item'); >+ $("#item + span").replaceWith(item); >+ var accountline = button.data('accountline'); >+ $('#noteline').val(accountline); >+ var note = button.data('note'); >+ $('#edited_note').val(note); >+ }); >+ > $(".receipt-email-action").on("click", function(e){ > e.preventDefault(); > return $(this).siblings('form').submit(); >diff --git a/members/boraccount.pl b/members/boraccount.pl >index 6e9cd60047..844c83554b 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -226,6 +226,24 @@ if ( $op eq 'cud-send_receipt' ) { > } > } > >+if ( $op eq 'cud-edit_note' ) { >+ output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } ); >+ my $payment_id = scalar $input->param('accountlines_id'); >+ my $note = scalar $input->param('edited_note'); >+ my $payment = Koha::Account::Lines->find($payment_id); >+ $schema->txn_do( >+ sub { >+ # Update the note and date in the account line >+ $payment->set( >+ { >+ date => \'NOW()', >+ note => $note >+ } >+ )->store(); >+ } >+ ); >+} >+ > #get account details > my $total = $patron->account->balance; > >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37211
:
168211
|
168212
|
170002
|
170003
|
170218
|
170219