From 661526beab158a77b814652a6e829f57eb368cc5 Mon Sep 17 00:00:00 2001 From: David Bourgault Date: Fri, 24 Nov 2017 10:20:13 -0500 Subject: [PATCH] Bug 19691 - Move code to opac-search.pl Removes the hidden input from masthead.inc, and adds a line to opac-search.pl to enforce the limit. Test plan: Before: 0) Set OPAC_SEARCH_LIMIT and OPAC_LIMIT_OVERRIDE to valid values in koha-httpd.conf (they should be commented) 1) Reload apache 2) Perform a search in the OPAC. You'll see the limit you specified appended to the URL and reflected in the results. 3) Manually remove the limit from the URL and load the page; the search results will not reflect the limit. After: 0) With the same apache config 1) Perform a search from the OPAC. The limit will not show up in the URL, but will be reflected in the search results. There should be no way of circumventing the limit. --- koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 12 +++--------- opac/opac-search.pl | 1 + 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index e2ff5fa..a837a90 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -253,15 +253,9 @@ [% ELSE %] - [% IF ( opac_limit_override ) %] - [% IF ( opac_search_limit ) %] - - [% END %] - [% ELSE %] - [% IF ( mylibraryfirst ) %] - - [% END %] - [% END # / opac_limit_override %] + [% IF ( mylibraryfirst ) %] + + [% END %] [% END # / OpacAddMastheadLibraryPulldown %] diff --git a/opac/opac-search.pl b/opac/opac-search.pl index ccde617..7370d65 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -470,6 +470,7 @@ if ($operands[0] && !$operands[1]) { # limits are use to limit to results to a pre-defined category such as branch or language my @limits = $cgi->multi_param('limit'); +push @limits, $ENV{OPAC_SEARCH_LIMIT} if ( $ENV{OPAC_SEARCH_LIMIT} and $ENV{OPAC_LIMIT_OVERRIDE} ); @limits = map { uri_unescape($_) } @limits; my @nolimits = $cgi->multi_param('nolimit'); @nolimits = map { uri_unescape($_) } @nolimits; -- 2.7.4