From 6016ebf15d8933afa50b518db052a2a3386b99b1 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 8 Jun 2016 13:39:02 -0400 Subject: [PATCH] Bug 3534 (QA Followup) Fix indentation, show guarantor form, ignore bad data in pref Switch incorrect == to != when checking skipped fields --- .../prog/en/modules/admin/preferences/patrons.pref | 2 +- .../prog/en/modules/members/memberentrygen.tt | 29 +++++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 61c1bd6..fcb3887 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -103,7 +103,7 @@ Patrons: - pref: PatronQuickAddFields class: multi - (separate columns with |) - - "add these fields to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here" + - "add these fields to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here. If applicable the guarantor form will be shown as well, individual fields in that form will be ignored." - - "Use the SMS::Send::" - pref: SMSSendDriver 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 fe41867..39ac47e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -51,10 +51,12 @@ $(document).ready(function() { $(toggle_from).each(function() { var input_label = $(this).attr('for'); if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) { - $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') ); - return; + $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') ); + return; + } + if( $(this).next().val() != '' ) { + $(toggle_to+"[for='"+input_label+"']").next().val( $(this).next().val() ); } - if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val( $(this).next().val() );} }); $(".toggler").toggle(); @@ -1108,16 +1110,25 @@ $(document).ready(function() { $(document).ready(function () { $("#entryform").hide(); [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %] - var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]"; + var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field %]",[% END %]]; + var skipped_fields = ["contactname","contactfirstname","relationship"]; //Guarantor form is pulled as a whole, ignore individual fields $("#entryform label").each(function () { var input_label = $(this).attr('for'); - if ( input_label == 'sex-female' ) { input_label='sex'; } - else if ( input_label == 'btitle' ) { input_label='title'; } + if ( input_label == 'sex-female' ) { + input_label='sex'; + } + else if ( input_label == 'btitle' ) { + input_label='title'; + } + if ( skipped_fields.indexOf( input_label ) != -1 ) { input_label=""; } if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){ - $(this).parent().clone().appendTo("#quick_add_list"); - if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); + $(this).parent().clone().appendTo("#quick_add_list"); + if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); + } + }); + if( $("#memberentry_guarantor").length ) { + $("#memberentry_guarantor").clone().appendTo("#quick_add_list").css("margin",0); } - }); $("#quick_add_form").show(); }); -- 2.1.4