From 39374480b0190e072baa041d2912d2cbb7cc2b85 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 12 Mar 2018 16:56:16 +0000 Subject: [PATCH] Bug 20346 - New wording above the patron table on the patron page Now the wording of the text above the patron result table is in the format 'Users found for: filtered by ' Test plan: Same as the two previous patches for this bug, however notice after applying this patch and perform a search and filter event that the wording of this text above the patron result table is changed to the format 'Users found for: filtered by ' Sponsored-By: Catalyst IT --- .../prog/en/modules/members/member.tt | 66 ++++++++++++++++++---- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index f4a2b07..8877521 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -274,6 +274,7 @@ $("#searchform").on("submit", function(e) { e.preventDefault(); search = 1; + update_searched(); dtMemberResults.fnDraw(); }); }); @@ -444,25 +445,66 @@ } // Update the string "Results found ..." function update_searched(){ - var searched = $("#searchfieldstype_filter").find("option:selected").text(); - if ( $("#searchmember_filter").val() ) { - if ( $("#searchtype_filter").val() == 'start_with' ) { + var first_query = document.getElementById("searchmember").value; + var searchmember = document.getElementById("searchmember_filter").value; + var searched = $("#searchfieldstype").find("option:selected").text(); + var filtered; + + //Creating the searched message for the settings set for the search event + if ( $("#searchmember").val() ) { + if ( $("#searchtype").val() == 'start_with' ) { searched += _(" starting with "); } else { searched += _(" containing "); } - searched += "'" + $("#searchmember_filter").val() + "'"; - } - if ( $("#firstletter_filter").val() ) { - searched += _(" begins with ") + "'" + $("#firstletter_filter").val() +"'"; + searched += "'" + $("#searchmember").val() + "'"; } - if ( $("#categorycode_filter").val() ) { - searched += _(" with category ") + "'" + $("#categorycode_filter").find("option:selected").text() + "'"; + if ( $("#categorycode").val() ) { + searched += _(" with category ") + "'" + $("#categorycode").find("option:selected").text() + "'"; } - if ( $("#branchcode_filter").val() ) { - searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); + if ( $("#branchcode").val() ) { + searched += _(" in library ") + $("#branchcode").find("option:selected").text(); } - $("#searchpattern").text(searched); + + //Creating the searched message for the settings set for the filtered event + if ( $("#searchmember_filter").val() ) { + if ( $("#searchtype_filter").val() == 'start_with' ) { + filtered = " starting with "; + } else { + filtered = " containing "; + } + filtered += "'" + $("#searchmember_filter").val() + "'"; + } + if ( $("#firstletter_filter").val() ) { + if ( $("#searchmember_filter").val() || $("#categorycode_filter").val() || $("#branchcode_filter").val()) { + filtered += " begins with " + "'" + $("#firstletter_filter").val() +"'"; + } else { + filtered = " begins with " + "'" + $("#firstletter_filter").val() +"'"; + } + } + if ( $("#categorycode_filter").val() ) { + if ( $("#searchmember_filter").val() || $("#firstletter_filter").val() || $("#branchcode_filter").val()) { + filtered += " with category " + "'" + $("#categorycode_filter").find("option:selected").text() + "'"; + } else { + filtered = " with category " + "'" + $("#categorycode_filter").find("option:selected").text() + "'"; + } + } + if ( $("#branchcode_filter").val() ) { + if ( $("#searchmember_filter").val() || $("#firstletter_filter").val() || $("#categorycode_filter").val()) { + filtered += " in library " + $("#branchcode_filter").find("option:selected").text(); + } else { + filtered = " in library " + $("#branchcode_filter").find("option:selected").text(); + } + } + + var searchevent; + //Concatenate the searched and filtered messages into a single message + if (first_query != searchmember) { + searchevent = searched + " filtered by " + filtered; + $("#searchpattern").text(searchevent); + } else { + $("#searchpattern").text(searched); + } } // Redraw the table -- 2.1.4