From d2dca2ec9482233d97bcd410e5aaf2c8ceef3474 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 30 Aug 2013 11:22:27 -0400 Subject: [PATCH] Have TPAC put user input at the end in all cases Signed-off-by: Mike Rylander Signed-off-by: Jason Etheridge --- .../lib/OpenILS/WWW/EGCatLoader/Search.pm | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index efac1faa3f..4d455c7c80 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -75,29 +75,30 @@ sub _prepare_biblio_search { foreach (grep /^fg:/, $cgi->param) { /:(-?\w+)$/ or next; my $term = join(",", $cgi->param($_)); - $query .= " filter_group_entry($term)" if length $term; + $query = "filter_group_entry($term) $query" if length $term; } if ($cgi->param("bookbag")) { - $query .= " container(bre,bookbag," . int($cgi->param("bookbag")) . ")"; + $query = "container(bre,bookbag," . int($cgi->param("bookbag")) . ") $query"; } # Journal title hackery complete if ($cgi->param("qtype") && $cgi->param("qtype") eq "jtitle") { - $query .= " bib_level(s)"; + $query = "bib_level(s) $query"; } if ($cgi->param('pubdate') && $cgi->param('date1')) { if ($cgi->param('pubdate') eq 'between') { - $query .= ' between(' . $cgi->param('date1'); - $query .= ',' . $cgi->param('date2') if $cgi->param('date2'); - $query .= ')'; + my $btw = 'between(' . $cgi->param('date1'); + $btw .= ',' . $cgi->param('date2') if $cgi->param('date2'); + $btw .= ')'; + $query = "$btw $query"; } elsif ($cgi->param('pubdate') eq 'is') { - $query .= ' between(' . $cgi->param('date1') . - ',' . $cgi->param('date1') . ')'; # sic, date1 twice + $query = 'between(' . $cgi->param('date1') . + ',' . $cgi->param('date1') . ") $query"; # sic, date1 twice } else { - $query .= ' ' . $cgi->param('pubdate') . - '(' . $cgi->param('date1') . ')'; + $query = $cgi->param('pubdate') . + '(' . $cgi->param('date1') . ") $query"; } } @@ -110,9 +111,9 @@ sub _prepare_biblio_search { if ($cgi->param('sort')) { $query =~ s/sort\([^\)]*\)//g; # override existing sort(). no stacking. my ($axis, $desc) = split /\./, $cgi->param('sort'); - $query .= " sort($axis)"; + $query = "sort($axis) $query"; if ($desc and not $query =~ /\#descending/) { - $query .= '#descending'; + $query = "#descending $query"; } elsif (not $desc) { $query =~ s/\#descending//; } @@ -131,11 +132,11 @@ sub _prepare_biblio_search { my $pref_ou = $ctx->{pref_ou}; if (defined($pref_ou) and $pref_ou ne '' and $pref_ou != $org and ($pref_ou ne $ctx->{aou_tree}->()->id)) { my $plib = $ctx->{get_aou}->($pref_ou)->shortname; - $query .= " pref_ou($plib)"; + $query = "pref_ou($plib) $query"; } if (my $grp = $ctx->{copy_location_group}) { - $query .= " location_groups($grp)"; + $query = "location_groups($grp) $query"; } if(!$site) { @@ -405,7 +406,7 @@ sub load_rresults { # Stuff these into the TT context so that templates can use them in redrawing forms $ctx->{processed_search_query} = $query; - $query .= " $_" for @facets; + $query = "$_ $query" for @facets; $logger->activity("EGWeb: [search] $query"); -- 2.43.2