From e9e59078f09b4b0257b1552ab66fab0dcb5ce6c3 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 25 Nov 2019 11:50:46 -0500 Subject: [PATCH] Bug 23905: Button "Search to add" doesn't work on Quick add new patron This issue is caused by duplicating the patron guarantor fieldset. The solution is to move it between the two forms insetad. In addition, this patch moves the guarantor information fieldset to the area below the "Quick add" fieldset, instead of *inside* it. This change preserves the correct styling and layout of the Guarantor information fieldset whilst it is moved back and forth by the "quick add"/"full form" toggle. Test Plan: 1) Quick add a child patron 2) Attempt to use the "Search to add" button 3) Note it does nothing 4) Apply this patch 5) Repeat steps 1 and 2 6) It works now! 7) Test toggling between the quick add and full form views, note the "Guarantor information" fieldset shows correctly in the full form view. --- .../prog/en/modules/members/memberentrygen.tt | 18 ++++++++++-------- koha-tmpl/intranet-tmpl/prog/js/members.js | 4 +--- 2 files changed, 11 insertions(+), 11 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 f36d98314b..71bfab77bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -320,6 +320,7 @@ [% IF show_guarantor || guarantor %] [% SET possible_relationships = Koha.Preference('borrowerRelationship') %] +
Guarantor information @@ -357,6 +358,7 @@ [% END %]
  • + [% r.relationship | html %]
  • @@ -446,6 +448,7 @@ [% END %]
    +
    [% END %] @@ -1273,9 +1276,11 @@ if( $("#entryform:visible").length ) { toggle_to = "#quick_add_form label"; toggle_from = "#entryform label"; + $("#memberentry_guarantor").appendTo("#quick_add_form"); } else { toggle_to="#entryform label"; toggle_from = "#quick_add_form label"; + $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor"); } $(toggle_from).each(function() { var input_label = $(this).attr('for'); @@ -1293,6 +1298,7 @@ $("#quick_add_form").validate(); if( $("#quick_add_form").valid()){ $('.toggle_quick_add').click(); + $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor"); $('#saverecord').click(); } else {return false;} @@ -1340,7 +1346,6 @@ $("#entryform,#saverecord").hide(); [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %] var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field | html %]",[% 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' ) { @@ -1349,7 +1354,6 @@ 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"); [% UNLESS mandatorypassword %] @@ -1357,15 +1361,13 @@ [% END %] } }); - if( $("#memberentry_guarantor").length ) { - $("#memberentry_guarantor").clone().appendTo("#quick_add_list").css("margin",0); - $("#quick_add_form #memberentry_guarantor").append("

    " + _("Note: Quick add guarantor form populates address fields in full form") + "

    "); - $("#quick_add_list #guarantordelete").prop('id','qagd'); - } - $("#qagd").click(function() { $("#guarantordelete").click(); }); + if ( $("#memberentry_guarantor").length ) { + $("#memberentry_guarantor").appendTo("#quick_add_form"); + } $("#quick_add_form").show(); }); [% END %] + $("#guarantor_template").hide(); [% Asset.js("js/members.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js index 3579dbeed5..ec2d58d8a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -281,9 +281,7 @@ $(document).ready(function(){ $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit"); - $('#guarantor_template').hide(); - - $('#guarantor_search').on('click', function(e) { + $('body').on('click', '#guarantor_search', function(e) { e.preventDefault(); var newin = window.open('guarantor_search.pl','popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top'); }); -- 2.21.0 (Apple Git-122.2)