@@ -, +, @@ search results can occur --- C4/Output.pm | 14 ++++++++++++-- opac/opac-search.pl | 2 ++ opac/opac-user.pl | 10 +++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) --- a/C4/Output.pm +++ a/C4/Output.pm @@ -271,6 +271,8 @@ sub output_with_http_headers { }; $options->{expires} = 'now' if $extra_options->{force_no_caching}; + my $redirect_url = $extra_options->{redirect_url}; + $options->{cookie} = $cookie if $cookie; if ($content_type eq 'html') { # guaranteed to be one of the content_type_map keys, else we'd have died $options->{'Content-Style-Type' } = 'text/css'; @@ -281,7 +283,16 @@ sub output_with_http_headers { # We need to fix the encoding as it comes out of the database, or when we pass the variables to templates $data =~ s/\&\;amp\; /\&\; /g; - print $query->header($options), $data; + + if ( $redirect_url =~ /opac-search/ ) { + print $query->redirect( + -URL => $redirect_url, + -COOKIE => $cookie, + ); + } + else { + print $query->header($options), $data; + } } sub output_html_with_http_headers { @@ -289,7 +300,6 @@ sub output_html_with_http_headers { output_with_http_headers( $query, $cookie, $data, 'html', $status, $extra_options ); } - sub output_ajax_with_http_headers { my ( $query, $js ) = @_; print $query->header( --- a/opac/opac-search.pl +++ a/opac/opac-search.pl @@ -985,6 +985,8 @@ if (C4::Context->preference('GoogleIndicTransliteration')) { $template->param('GoogleIndicTransliteration' => 1); } +$template->param( full_url => $cgi->url() ); + $template->{VARS}->{DidYouMean} = ( defined C4::Context->preference('OPACdidyoumean') && C4::Context->preference('OPACdidyoumean') =~ m/enable/ ); --- a/opac/opac-user.pl +++ a/opac/opac-user.pl @@ -80,6 +80,8 @@ my $canrenew = 1; $template->param( shibbolethAuthentication => C4::Context->config('useshibboleth') ); +my $full_url = $ENV{HTTP_REFERER}; + if (!$borrowernumber) { $template->param( adminWarning => 1 ); } @@ -338,4 +340,10 @@ $template->param( failed_holds => scalar $query->param('failed_holds'), ); -output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; +warn "URL: $full_url"; +if ( $full_url =~ /opac-search/ ) { + output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1, redirect_url => $full_url }; +} +else { + output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; +} --