From 1c8c9bb0fe23addc624e2a97331c8ec9cd80a9dd Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 20 Aug 2013 09:07:25 -0400 Subject: [PATCH] Bug 10769 - Simplify clearing of input fields when duplicating a patron When duplicating a patron record an onclick event is added to many fields in order to make then clear when focused. This patch updates the template so that the logic for this can be simplified. A template variable is set based on the 'opduplicate' variable, and a class added to the relevant fields. All fields with that class are cleared on focus. Also changed are several markup issues which were causing validation errors. To test, find or create a patron record which has all standard text fields filled with data. Use the "duplicate" button on the detail view of that patron to initiate the duplication process. Focus on each field in the patron entry form in succession. Fields which contain data should be cleared in the same way they were before the patch. Also test a regular edit operation to confirm that fields are not cleared. Signed-off-by: Campbell Reid-Tait Signed-off-by: Kyle M Hall Passes koha-qa.pl, works as advertised. Signed-off-by: Galen Charlton --- .../prog/en/modules/members/memberentrygen.tt | 265 ++++-------------- 1 file changed, 58 insertions(+), 207 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 7a2d29e43f..2cb1bb3876 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1,3 +1,4 @@ +[% IF ( opduplicate ) %][% SET focusAction = "clearDupe" %][% END %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › [% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] [% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %][% UNLESS ( opadd ) %] [% surname %], [% firstname %][% END %] @@ -23,6 +24,9 @@ document.form.state.value=RegExp.$3; document.form.country.value=RegExp.$4; }); + $(".clearDupe").on("focus",function(){ + $(this).val(""); + }) [% IF categorycode %] update_category_code( "[% categorycode %]" ); @@ -102,7 +106,6 @@
- [% IF error_alert %] [% IF ( error_alert == "no_email" ) %]
This member has no email
@@ -238,17 +241,9 @@ [% END %] Surname: [% IF ( uppercasesurnames ) %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% END %] [% IF ( mandatorysurname ) %]Required[% END %] @@ -294,11 +289,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryinitials ) %]Required[% END %] [% END %] @@ -310,12 +301,8 @@ [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + Other name: + [% IF ( mandatoryothernames ) %]Required[% END %] [% IF ( I ) %][% END %] @@ -364,11 +351,7 @@ [% contactname %] [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% END %] [% ELSE %] @@ -387,11 +370,7 @@ [% contactname %] [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% END %] [% END %] @@ -402,11 +381,7 @@ [% contactfirstname %] [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% END %] [% END %] @@ -450,11 +425,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatorystreetnumber ) %]Required[% END %] [% END %] @@ -480,11 +451,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaddress ) %]Required[% END %] [% END %] @@ -496,11 +463,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaddress2 ) %]Required[% END %] [% END %] @@ -512,11 +475,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( city_cgipopup ) %]or choose + [% IF ( mandatorystate ) %]Required[% END %] [% END %] @@ -553,11 +512,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryzipcode ) %]Required[% END %] [% END %] @@ -569,11 +524,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatorycountry ) %]Required[% END %] [% END %] @@ -592,11 +543,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryphone ) %]Required[% END %]
Shows on transit slips
@@ -609,11 +556,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryphonepro ) %]Required[% END %] [% END %] @@ -625,11 +568,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatorymobile ) %]Required[% END %] [% END %] @@ -641,11 +580,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryemail ) %]Required[% END %]
Shows on transit slips
@@ -658,11 +593,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryemailpro ) %]Required[% END %] [% END %] @@ -674,11 +605,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryfax ) %]Required[% END %] [% END %] @@ -701,11 +628,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryB_address ) %]Required[% END %] [% END %] @@ -717,11 +640,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryB_address2 ) %]Required[% END %] [% END %] @@ -733,7 +652,7 @@ - + [% IF ( mandatoryB_city ) %]Required[% END %] [% END %] @@ -745,7 +664,7 @@ - + [% IF ( mandatoryB_state ) %]Required[% END %] [% END %] @@ -757,11 +676,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryB_zipcode ) %]Required[% END %] [% END %] @@ -773,11 +688,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryB_country ) %]Required[% END %] [% END %] @@ -789,11 +700,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryB_phone ) %]Required[% END %] [% END %] @@ -805,11 +712,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryB_email ) %]Required[% END %] [% END %] [% UNLESS nocontactnote %] @@ -840,11 +743,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaltcontactsurname ) %]Required[% END %] [% END %] @@ -856,11 +755,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaltcontactfirstname ) %]Required[% END %] [% END %] @@ -872,11 +767,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaltcontactaddress1 ) %]Required[% END %] [% END %] @@ -888,11 +779,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaltcontactaddress2 ) %]Required[% END %] [% END %] @@ -904,7 +791,7 @@ - + [% IF ( mandatoryaltcontactaddress3 ) %]Required[% END %] [% END %] @@ -916,7 +803,7 @@ - + [% IF ( mandatoryaltcontactstate ) %]Required[% END %] [% END %] @@ -928,11 +815,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaltcontactzipcode ) %]Required[% END %] [% END %] @@ -944,11 +827,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaltcontactcountry ) %]Required[% END %] [% END %] @@ -960,11 +839,7 @@ - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatoryaltcontactphone ) %]Required[% END %] [% END %] @@ -989,8 +864,8 @@ [% END %] [% UNLESS nobranchcode %]
  • - - [%- FOREACH branchloo IN branchloop %] [% IF ( branchloo.selected ) -%] @@ -1008,12 +883,12 @@ [% FOREACH typeloo IN typeloop %] [% FOREACH categoryloo IN typeloo.categoryloop %] [% IF ( loop.first ) %] - [% IF ( typeloo.typename_C ) %][% END %] - [% IF ( typeloo.typename_A ) %][% END %] - [% IF ( typeloo.typename_S ) %][% END %] - [% IF ( typeloo.typename_I ) %][% END %] - [% IF ( typeloo.typename_P ) %][% END %] - [% IF ( typeloo.typename_X ) %][% END %] + [% IF ( typeloo.typename_C ) %][% END %] + [% IF ( typeloo.typename_A ) %][% END %] + [% IF ( typeloo.typename_S ) %][% END %] + [% IF ( typeloo.typename_I ) %][% END %] + [% IF ( typeloo.typename_P ) %][% END %] + [% IF ( typeloo.typename_X ) %][% END %] [% END %] [% IF ( categoryloo.categorycodeselected ) %] @@ -1039,11 +914,7 @@ [% IF ( CGIsort1 ) %] [% CGIsort1 %] [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatorysort1 ) %]Required[% END %] [% END %]
  • @@ -1059,11 +930,7 @@ [% IF ( CGIsort2 ) %] [% CGIsort2 %] [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] + [% IF ( mandatorysort2 ) %]Required[% END %] [% END %] @@ -1308,20 +1175,12 @@ [% END %] - [% IF opduplicate %] - - [% ELSE %] - - [% END %] + (optional)
  • - [% IF ( opduplicate ) %] - - [% ELSE %] - - [% END %] +
  • @@ -1333,8 +1192,8 @@ [% IF ( step_4 ) %][% IF ( ExtendedPatronAttributes ) %][% UNLESS ( no_patron_attribute_types ) %]
    - Additional attributes and identifiers + [% FOREACH pa_loo IN patron_attributes %] [% IF pa_loo.class %]
    @@ -1347,7 +1206,7 @@ [% IF ( patron_attribute.use_dropdown ) %] [% ELSE %] - [% IF ( opduplicate ) %] - - [% ELSE %] - [% END %] [% END %] [% IF ( patron_attribute.password_allowed ) %] ( + Patron messaging preferences [% IF ( opadd ) %]