Bugzilla – Attachment 188507 Details for
Bug 40795
Fix +add note function on payment table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40795: Fix +add note function on payment table
Bug-40795-Fix-add-note-function-on-payment-table.patch (text/plain), 9.93 KB, created by
David Nind
on 2025-10-28 12:12:51 UTC
(
hide
)
Description:
Bug 40795: Fix +add note function on payment table
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-10-28 12:12:51 UTC
Size:
9.93 KB
patch
obsolete
>From 941a57e967be29883f0400c80c4c609d541bedca Mon Sep 17 00:00:00 2001 >From: Lisette Scheer <lisette@bywatersolutions.com> >Date: Thu, 2 Oct 2025 17:51:54 +0000 >Subject: [PATCH] Bug 40795: Fix +add note function on payment table > >This patch updates the table on members/pay.pl to have consistant ui with the transactions table, using a modal. > >On members/pay.pl if there's no note, a note can still be added without the edit permission to allow for notes at time of payment, consistent with current behavior. >I also updated the logic with the buttons on both pages to show as "add" when there's not a note present. > >To test: >1. Before applying patches, navigate to a user in your test environment (I used 23529000035676) >2. Click "Accounting" in the left hand link list >3. Create manual invoice, give it an amount but no note >4. Create another manual invoice, give it an amount and any note. >5. Navigate to "Transactions" observe both notes have an edit button. >6. Click edit on the one with a note, update it, and save. Note it has been updated. >7. Navigate to "Make a payment" Observe both columns have a text box that's immediately editable. The note should be filled on the charge with a note. >8. Apply the patch >9. Repeat step 5, observe the column with no note says "Add" now. >10. Repeat step 7, observe the payment note field matches the "note" field on transactions. >11. Edit the existing note and save >12. Add a new note for the other transaction and save. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/modules/members/boraccount.tt | 2 +- > .../prog/en/modules/members/pay.tt | 78 +++++++++++++++++-- > members/pay.pl | 20 +++++ > 3 files changed, 91 insertions(+), 9 deletions(-) > >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 d4a337786e..7909d221a3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -144,7 +144,7 @@ > 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 >+ >[% IF account.note %]<i class="fa-solid fa-pen"></i> Edit[% ELSE %]<i class="fa-solid fa-plus"></i>Add[% END %]</button > > > [% END %] > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >index 7cf5df0e4b..14f2c2c279 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -170,15 +170,30 @@ > </td> > <td class="actions"> > [% IF line.note %] >- <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]" style="display:none;"><i class="fa fa-plus"></i> Add note</a> >- <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]" >- ><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="[% line.note | html %]" /> <a href="#" class="cancel-note"><i class="fa fa-times"></i></a >- ></span> >+ [% line.note | html_line_break %] >+ [% IF CAN_user_updatecharges_edit_accountline_notes %] >+ <button >+ type="button" >+ class="btn btn-default btn-xs edit-action" >+ data-bs-toggle="modal" >+ data-bs-target="#editNoteModal" >+ data-accountline="[% line.accountlines_id | html %]" >+ data-note="[% line.note | html %]" >+ data-member="[% line.borrowernumber | html %]" >+ ><i class="fa-solid fa-pen"></i> Edit</button >+ > >+ [% END %] > [% ELSE %] >- <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a> >- <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]" style="display:none" >- ><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="" /> <a href="#" class="cancel-note"><i class="fa fa-times"></i></a >- ></span> >+ <button >+ type="button" >+ class="btn btn-default btn-xs edit-action" >+ data-bs-toggle="modal" >+ data-bs-target="#editNoteModal" >+ data-accountline="[% line.accountlines_id | html %]" >+ data-note="[% line.note | html %]" >+ data-member="[% line.borrowernumber | html %]" >+ ><i class="fa-solid fa-plus"></i> Add</button >+ > > [% END %] > </td> > <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td> >@@ -228,7 +243,47 @@ > </div> > <!-- /.toptabs --> > [% END %] >+<!-- Edit note modal --> >+<div class="modal" id="editNoteModal" tabindex="-1" role="dialog" aria-labelledby="editNoteLabel"> >+ <form id="edit_form" action="/cgi-bin/koha/members/pay.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="[% line.borrowernumber | html %]" /> >+ >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h1 class="modal-title" id="editNoteLabel">Edit note</h1> >+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> >+ </div> >+ >+ <div class="modal-body"> >+ <fieldset class="rows"> >+ <ol> >+ <li> >+ <label for="payment_note">Note: </label> >+ <textarea id="payment_note" name="payment_note" rows="5" cols="30"></textarea> >+ </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-bs-dismiss="modal">Cancel</button> >+ </div> >+ <!-- /.modal-footer --> >+ </div> >+ <!-- /.modal-content --> >+ </div> >+ <!-- /.modal-dialog --> >+ </form> >+ <!-- /#void_form --> >+</div> >+<!-- /#editNoteModal --> > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") | $raw %] >@@ -296,6 +351,13 @@ > table_settings > ); > }); >+ $("#editNoteModal").on("shown.bs.modal", function(e) { >+ var button = $(e.relatedTarget); >+ var accountline = button.data('accountline'); >+ $('#noteline').val(accountline); >+ var note = button.data('note'); >+ $('#payment_note').val(note); >+ }); > </script> > [% END %] > >diff --git a/members/pay.pl b/members/pay.pl >index 8e013f414c..d6b8b4ad3c 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -98,7 +98,27 @@ if ( $op eq 'cud-paycollect' ) { > } elsif ( $op eq 'cud-apply_credits' ) { > apply_credits( { patron => $patron, cgi => $input } ); > } >+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 $schema = Koha::Database->new->schema; >+ 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(); >+ } >+ ); >+} > for (@names) { > if ( $op =~ /^cud-pay_indiv_(\d+)$/ ) { > my $line_no = $1; >-- >2.47.3
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 40795
:
187310
| 188507 |
188508