Bugzilla – Attachment 100971 Details for
Bug 16457
Remove the use of "onclick" from the patron entry form
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16457: Remove the use of "onclick" from the patron entry form
Bug-16457-Remove-the-use-of-onclick-from-the-patro.patch (text/plain), 13.26 KB, created by
Owen Leonard
on 2020-03-18 17:19:05 UTC
(
hide
)
Description:
Bug 16457: Remove the use of "onclick" from the patron entry form
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-03-18 17:19:05 UTC
Size:
13.26 KB
patch
obsolete
>From 1cf3ecb5d8cb5262cf0b7f7c2cea150fccbb749f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 17 Mar 2020 23:57:06 +0000 >Subject: [PATCH] Bug 16457: Remove the use of "onclick" from the patron entry > form > >This patch removes several event attributes from the patron entry form >and replaces them with event handlers in the <script> block. > >Some event attributes were removed altogether because they weren't >functional: Onchange events on jQueryUI datepickers don't work, and they >would have been redundant even if they did work. > >To test you should have some patron attributes configured >(Administration -> Patron attribute types). At least one attribute >should be configured to apply to one particular patron category. > >Apply the patch and begin the process of adding a new patron. > >1. Try to add a patron with details matching a patron which already > exists. You should get a confirmation message on screen which asks if > the patron is a duplicte. Test the link which shows the existing > record. It should trigger a popup window with details about the > patron. > >2. Test the process of setting a patron's date of birth. Selecting a > date should trigger the display of the patron's age immedately below > the field. > >3. Test that you cannot set a patron's expiration to a date which > precedes the date in the registration date field. > >4. Test that you can add a manual restriction's expiration date, and > that the "Clear date" link works correctly. > >5. Test that the "clear" and "new" controls links work with additional > attributes and identifiers. > >6. Test that changing the patron's category correctly affects the > display of available attributes and identifiers: The attribute you > have associated with a particular patron category should only show if > that category is selected under "Category." >--- > .../prog/en/modules/members/memberentrygen.tt | 79 +++++++++++++--------- > 1 file changed, 48 insertions(+), 31 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 d4db2e37b3..394e1b47fc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -94,13 +94,9 @@ > [% IF ( check_member ) %] > <div class="dialog alert"> > <h3>Duplicate patron record?</h3> >- <p><a href="#" onclick="Dopop('moremember.pl?print=brief&borrowernumber=[% check_member | uri %]');return false;" ><i class="fa fa-window-restore"></i> View existing record</a></p> >- <button id="duplicate" type="submit" class="new"> >- <i class="fa fa-pencil"></i> It is a duplicate. Edit existing record >- </button> >- <button type="submit" id="not-duplicate" class="new"> >- <i class="fa fa-plus"></i> Not a duplicate. Save as new record >- </button> >+ <p><a class="popup_patronview" href="/cgi-bin/koha/members/moremember.pl?print=brief&borrowernumber=[% check_member | uri %]"><i class="fa fa-window-restore"></i> View existing record</a></p> >+ <button id="duplicate" type="submit" class="new"> <i class="fa fa-pencil"></i> It is a duplicate. Edit existing record </button> >+ <button type="submit" id="not-duplicate" class="new"> <i class="fa fa-plus"></i> Not a duplicate. Save as new record </button> > </div> > [% END %] > >@@ -291,7 +287,7 @@ > [% END %] > Date of birth: > </label> >- <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="write_age();" value="[% dateofbirth | html UNLESS opduplicate %]" class="datepicker" /> >+ <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% dateofbirth | html UNLESS opduplicate %]" class="datepicker" /> > [% IF ( mandatorydateofbirth ) %] > <span class="required">Required</span> > [% END %] >@@ -753,7 +749,7 @@ > > <li> > <label for="categorycode_entry" class="required">Category: </label> >- <select id="categorycode_entry" name="categorycode" onchange="update_category_code(this);"> >+ <select id="categorycode_entry" name="categorycode"> > [% FOREACH typeloo IN typeloop %] > [% FOREACH categoryloo IN typeloo.categoryloop %] > [% IF ( loop.first ) %] >@@ -871,11 +867,7 @@ > [% END %] > Registration date: > </label> >- [% IF ( dateformat == "metric" ) %] >- <input type="text" id="from" name="dateenrolled" maxlength="10" size="10" onchange="CheckDate(document.form.dateenrolled);check_manip_date('verify');" value="[% dateenrolled | html %]" class="datepickerfrom" /> >- [% ELSE %] >- <input type="text" id="from" name="dateenrolled" maxlength="10" size="10" value="[% dateenrolled | html %]" class="datepickerfrom" /> >- [% END %] >+ <input type="text" id="from" name="dateenrolled" maxlength="10" size="10" value="[% dateenrolled | html %]" class="datepickerfrom" /> > [% IF ( mandatorydateenrolled ) %] > <span class="required">Required</span> > [% END %] >@@ -898,19 +890,11 @@ > [% END %] > Expiry date (leave blank for auto calc): > </label> >- [% IF ( dateformat == "metric" ) %] >- [% UNLESS ( opadd ) %] >- <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" value="[% dateexpiry | html UNLESS opduplicate %]" class="datepickerto" /> >- [% ELSE %] >- <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" class="datepickerto" /> >- [% END %] >+ [% UNLESS ( opadd ) %] >+ <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% dateexpiry | html UNLESS opduplicate %]" class="datepickerto" /> > [% ELSE %] >- [% UNLESS ( opadd ) %] >- <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% dateexpiry | html UNLESS opduplicate %]" class="datepickerto" /> >- [% ELSE %] >- <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% dateexpiry | html %]" class="datepickerto" /> >- [% END %] >- [% END # /IF ( dateformat == "metric" ) %] >+ <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% dateexpiry | html %]" class="datepickerto" /> >+ [% END %] > [% IF ( mandatorydateexpiry ) %] > <span class="required">Required</span> > [% END %] >@@ -1197,12 +1181,12 @@ > <ol> > <li> > <label for="debarred_comment">Comment: </label> >- <input type="text" id="debarred_comment" name="debarred_comment" onchange="$('#add_debarment').val(1);" /> >+ <input type="text" id="debarred_comment" name="debarred_comment" /> > </li> > <li> > <label for="debarred_expiration">Expiration: </label> >- <input name="debarred_expiration" id="debarred_expiration" size="10" value="" class="datepicker" onchange="$('#add_debarment').val(1);" type="text" /> >- <a href='javascript:void(0)' onclick="$('#debarred_expiration').val('');">Clear date</a> >+ <input name="debarred_expiration" id="debarred_expiration" size="10" value="" class="datepicker" type="text" /> >+ <a href="#" id="clear_debarred_expiration">Clear date</a> > </li> > </ol> > <p> >@@ -1290,9 +1274,9 @@ > <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea> > [% END # /IF ( patron_attribute.use_dropdown ) %] > <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" /> >- <a href="#" onclick="clear_entry(this); return false;"><i class="fa fa-fw fa-trash"></i> Clear</a> >+ <a href="#" class="clear_attribute"><i class="fa fa-fw fa-trash"></i> Clear</a> > [% IF ( patron_attribute.repeatable ) %] >- <a href="#" onclick="clone_entry(this); return false;"><i class="fa fa-fw fa-plus"></i> New</a> >+ <a href="#" class="clone_attribute"><i class="fa fa-fw fa-plus"></i> New</a> > [% END %] > </li> > [% END # /FOREACH patron_attribute %] >@@ -1470,6 +1454,39 @@ > $("input[name='nodouble']").val('1'); > $('#entryform').submit(); > }); >+ >+ $(".popup_patronview").on("click", function(e){ >+ e.preventDefault(); >+ var url = $(this).attr("href"); >+ openWindow( url, "patronview" ); >+ }); >+ >+ $("#dateofbirth").on("change", function(){ >+ write_age(); >+ }); >+ >+ $("#debarred_comment, #debarred_expiration").on("change", function(){ >+ $("#add_debarment").val(1); >+ }); >+ >+ $("#clear_debarred_expiration").on("click", function(e){ >+ e.preventDefault(); >+ $('#debarred_expiration').val(""); >+ }); >+ >+ $(".clear_attribute").on("click", function(e){ >+ e.preventDefault(); >+ clear_entry( this ); >+ }); >+ >+ $(".clone_attribute").on("click", function(e){ >+ e.preventDefault(); >+ clone_entry( this ); >+ }); >+ >+ $("#categorycode_entry").on("change", function(){ >+ update_category_code(this); >+ }); > }); > > var MSG_SEPARATOR = _("Separator must be / in field %s"); >-- >2.11.0
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 16457
:
100971
|
101391
|
101554
|
101770
|
101771