Bugzilla – Attachment 140808 Details for
Bug 31497
Quick add: mandatory fields save as empty when not filled in before first save attempt
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31497: Prevent ID clash on quick add fields
Bug-31497-Prevent-ID-clash-on-quick-add-fields.patch (text/plain), 3.28 KB, created by
Chris Cormack
on 2022-09-20 21:38:27 UTC
(
hide
)
Description:
Bug 31497: Prevent ID clash on quick add fields
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2022-09-20 21:38:27 UTC
Size:
3.28 KB
patch
obsolete
>From 20bb2a8a9fa5de18d083189c68afbd76a92ffecc Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 13 Sep 2022 12:19:57 +0000 >Subject: [PATCH] Bug 31497: Prevent ID clash on quick add fields > >The quick add clones the original fields, including ids. This can cause some clash when >other JS is running on the page. > >This patch updates the ids of the fields before adding to the form, which prevents bad >copying/clearing of fields > >To test: >* Go to patrons module >* Click on Quick add new patron (I chose Patron as category) >* On sample database these fields are marked as mandatory: > * Surname > * Cardnumber > * Library > * Category >* Fill in Surname, leave cardnumber empty >* Save - mandatory message is shown >* Fill in cardnumber - save >* The patron is saved >* BUT: cardnumber is empty! >APPLY PATCH >* Repeat plan above >* Cardnumber is correctly saved > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > .../prog/en/modules/members/memberentrygen.tt | 22 +++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 2988157361..2b9e1f472f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1836,10 +1836,24 @@ legend:hover { > input_label='title'; > } > if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){ >- $(this).parent().clone().appendTo("#quick_add_list"); >- [% UNLESS mandatorypassword %] >- if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); >- [% END %] >+ let orig_li = $(this).parent(); >+ if( orig_li.attr('class') == 'radio' ){ >+ let new_field = orig_li.clone(); >+ new_field.children('label').each(function(){ >+ let child_input = $(this).children('input'); >+ child_input.attr("id",child_input.attr("id") + "_qa"); >+ }); >+ new_field.appendTo("#quick_add_list"); >+ } else { >+ let orig_input_id = orig_li.children("input,textarea,select").attr("id"); >+ console.log( orig_input_id); >+ let new_field = orig_li.clone(); >+ new_field.children("#"+orig_input_id).attr("id",orig_input_id + "_qa"); >+ new_field.appendTo("#quick_add_list"); >+ [% UNLESS mandatorypassword %] >+ if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); >+ [% END %] >+ } > } > }); > if ( $("#memberentry_guarantor").length ) { >-- >2.20.1
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 31497
:
140568
|
140603
|
140606
|
140703
| 140808 |
140809