From 247486b7854d0ee9ed0e1f0921f63527127be0dd Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 18 Jul 2016 14:44:13 -0400 Subject: [PATCH] Bug 16938: Remove the use of "onclick" from batch patrons modification template This patch revises the batch patrons modification template, removing "onclick" attributes from the markup and defining those events in the script. To test you should have at least one extended patron attribute configured. - Apply the patch and go to Tools -> Batch patron modification. - Submit a batch of patrons for modification. - Confirm that the checkbox next to any required field is disabled. - Select a date in the registration date and expiry date fields. Confirm that the "Clear" link next to each empties the correct field. - Click "New" next to a patron attibute. A copy of the patron attribute line should be created. - Click "Delete" next to a cloned patron attribute. The correct line should be removed. Signed-off-by: Hector Castro Works as advertised Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../prog/en/modules/tools/modborrowers.tt | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt index bbf64f69ce..982e1af1ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt @@ -60,7 +60,20 @@ $('select[name="patron_attributes"]').change(); - } ); + $(".clear-date").on("click",function(e){ + e.preventDefault(); + var fieldID = this.id.replace("clear-date-",""); + $("#" + fieldID).val(""); + }); + $("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){ + e.preventDefault(); + add_attributes(); + }); + $("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){ + e.preventDefault(); + del_attributes(this); + }); + }); function updateAttrValues (select_attr) { var attr_code = $(select_attr).val(); @@ -86,8 +99,8 @@ function add_attributes() { var li_node = $("li.attributes:last"); var li_clone = $(li_node).clone(); - if ( $(li_clone).find("a.delete").length == 0 ) { - $(li_clone).append(' Delete'); + if ( $(li_clone).find("a.del_attributes").length == 0 ) { + $(li_clone).append(' Delete'); } $(li_clone).find('select[name="patron_attributes"]').change(function() { updateAttrValues(this); @@ -337,7 +350,7 @@ [% END %] [% IF field.mandatory %] - + [% ELSE %] [% END %] @@ -357,7 +370,7 @@ [% END %] [% IF ( field.type == 'date' ) %] - Clear + Clear [% END %] [% IF field.mandatory %] Required fields cannot be cleared @@ -375,7 +388,7 @@ - New + New [% END %] -- 2.39.5