Bugzilla – Attachment 88105 Details for
Bug 14715
Results per page setting for catalog search in staff client and OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14715: [QA Follow up] Rebase and fix up
Bug-14715-QA-Follow-up-Rebase-and-fix-up.patch (text/plain), 11.76 KB, created by
Liz Rea
on 2019-04-16 19:31:39 UTC
(
hide
)
Description:
Bug 14715: [QA Follow up] Rebase and fix up
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-04-16 19:31:39 UTC
Size:
11.76 KB
patch
obsolete
>From 81fa0ab087a3aa1dd672594a2bf8303c56dc233f Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Mon, 11 Jun 2018 02:47:52 +0000 >Subject: [PATCH] Bug 14715: [QA Follow up] Rebase and fix up > >I noticed that the two sysprefs initially created with this patch >weren't really being used, so I removed them. Instead I've added two new >sysprefs: >numSearchResultsDropdown >OPACnumSearchResultsDropdown >that control whether the dropdown shows or not. Otherwise the defaults >in numSearchResults and OPACnumSearchResults are used to decide number >of search results per page. > >When testing: >Run updatedatabase.pl >Test with values in numSearchResults and OPACnumSearchResults. Use >original test plan in Comment 12 but test with the dropdown sysprefs off >and on. > >Sponsored-by: Region Halland > >Signed-off-by: Cab Vinton <bibliwho@gmail.com> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > catalogue/search.pl | 13 ++++--------- > .../atomicupdate/bug_14715-searchresults_syspref.sql | 2 -- > .../bug_14715_-_results_per_page_dropdown_sysprefs.sql | 3 +++ > .../prog/en/modules/admin/preferences/searching.pref | 16 ++++++++++++++++ > .../intranet-tmpl/prog/en/modules/catalogue/results.tt | 4 +++- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 5 +++-- > opac/opac-search.pl | 7 +++++-- > 7 files changed, 34 insertions(+), 16 deletions(-) > delete mode 100644 installer/data/mysql/atomicupdate/bug_14715-searchresults_syspref.sql > create mode 100644 installer/data/mysql/atomicupdate/bug_14715_-_results_per_page_dropdown_sysprefs.sql > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index e45b2e43a9..c27e04be03 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -148,7 +148,6 @@ use C4::Koha; > use URI::Escape; > use POSIX qw(ceil floor); > use C4::Search::History; >-use String::Random; > use Koha::ItemTypes; > use Koha::Library::Groups; > use Koha::Patrons; >@@ -454,14 +453,10 @@ for (my $ii = 0; $ii < @operands; ++$ii) > # Params that can only have one value > my $scan = $params->{'scan'}; > my $count = C4::Context->preference('numSearchResults') || 20; >-my @results_per_page_options = grep /^\d+$/, >- map {s/\s+//g;$_;} >- split /,/, C4::Context->preference('numSearchResultsPerPage'); >-push(@results_per_page_options, $count); >-@results_per_page_options = do { my %seen; grep { !$seen{$_}++ } @results_per_page_options }; >-@results_per_page_options = sort {$a <=> $b} @results_per_page_options; >- >-my $results_per_page = $params->{'results_per_page'} || $cgi->cookie("results_per_page") || $count; >+my $results_per_page = $count; >+if ( C4::Context->preference('numSearchResultsDropdown') ){ >+ $results_per_page = $params->{'results_per_page'} || $cgi->cookie("results_per_page"); >+} > my $page = $cgi->param('page') || 1; > my $offset = $params->{'offset'} || 0; > $offset = 0 if $offset < 0; >diff --git a/installer/data/mysql/atomicupdate/bug_14715-searchresults_syspref.sql b/installer/data/mysql/atomicupdate/bug_14715-searchresults_syspref.sql >deleted file mode 100644 >index 4cc263a42b..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_14715-searchresults_syspref.sql >+++ /dev/null >@@ -1,2 +0,0 @@ >-INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`,`type`) VALUES ('OPACnumSearchResultsPerPage', '10,20,40,60,80,100', NULL, 'Option list of number of results per page to show in OPAC search results','YesNo'); >-INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`,`type`) VALUES ('numSearchResultsPerPage', '10,20,40,60,80,100', NULL, 'Option list of number of results per page to show in staff client search results','YesNo'); >diff --git a/installer/data/mysql/atomicupdate/bug_14715_-_results_per_page_dropdown_sysprefs.sql b/installer/data/mysql/atomicupdate/bug_14715_-_results_per_page_dropdown_sysprefs.sql >new file mode 100644 >index 0000000000..ef97362647 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14715_-_results_per_page_dropdown_sysprefs.sql >@@ -0,0 +1,3 @@ >+INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`,`type`) VALUES >+('OPACnumSearchResultsDropdown', 0, NULL, 'Option list of number of results per page to show in OPAC search results','YesNo'), >+('numSearchResultsDropdown', 0, NULL, 'Option list of number of results per page to show in staff client search results','YesNo'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index f1b87d89c9..6999b7e334 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -132,6 +132,22 @@ Searching: > - 'the operator "phr" in the callnumber and standard number staff client searches' > Results Display: > - >+ - pref: numSearchResultsDropdown >+ type: boolean >+ default: no >+ choices: >+ yes: Show >+ no: "Don't show" >+ - results per page dropdown on staff client search results. >+ - >+ - pref: OPACnumSearchResultsDropdown >+ type: boolean >+ default: no >+ choices: >+ yes: Show >+ no: "Don't show" >+ - results per page dropdown on OPAC search results. >+ - > - By default, sort search results in the staff client by > - pref: defaultSortField > default: relevance >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index 43b75fa840..55ae1c4b71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -17,7 +17,6 @@ > [% ELSE %] > [% SET DetailPage="detail.pl" %] > [% END %] >-<<<<<<< HEAD > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -79,14 +78,17 @@ > </select> > <!-- RESORT END --> > <!-- RESULTS_PER_PAGE START --> >+ [% IF Koha.Preference('numSearchResultsDropdown') %] > <label for="results_per_page">Results per page: </label> > <select id="results_per_page" name="results_per_page"> >+ [% IF Koha.Preference('numSearchResults') %]<option value="[% Koha.Preference('numSearchResults') %]" selected="selected">Library default: [% Koha.Preference('numSearchResults') %]</option>[% ELSE %]<option value="[% Koha.Preference('numSearchResults') %]">Library default: [% Koha.Preference('numSearchResults') %]</option>[% END %] > [% IF results_per_page == '20' %]<option value="20" selected="selected">20</option>[% ELSE %]<option value="20">20</option>[% END %] > [% IF results_per_page == '40' %]<option value="40" selected="selected">40</option>[% ELSE %]<option value="40">40</option>[% END %] > [% IF results_per_page == '60' %]<option value="60" selected="selected">60</option>[% ELSE %]<option value="60">60</option>[% END %] > [% IF results_per_page == '80' %]<option value="80" selected="selected">80</option>[% ELSE %]<option value="80">80</option>[% END %] > [% IF results_per_page == '100' %]<option value="100" selected="selected">100</option>[% ELSE %]<option value="100">100</option>[% END %] > </select> >+ [% END %] > <!-- RESULTS_PER_PAGE END --> > <input type="submit" value="Go" /> > </form> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index edd66ffa48..dfdecd964a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -164,16 +164,17 @@ > [% UNLESS tag %] > <div class="sort_by pull-right"> > <select id="sort_by" class="resort" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select> >- >+ [% IF Koha.Preference('OPACnumSearchResultsDropdown') %] > <label for="results_per_page">Results per page: </label> > <select id="results_per_page" name="results_per_page"> >+ [% IF Koha.Preference('OPACnumSearchResults') %]<option value="[% Koha.Preference('OPACnumSearchResults') %]" selected="selected">Library default: [% Koha.Preference('OPACnumSearchResults') %]</option>[% ELSE %]<option value="[% Koha.Preference('OPACnumSearchResults') %]">Library default: [% Koha.Preference('OPACnumSearchResults') %]</option>[% END %] > [% IF results_per_page == '20' %]<option value="20" selected="selected">20</option>[% ELSE %]<option value="20">20</option>[% END %] > [% IF results_per_page == '40' %]<option value="40" selected="selected">40</option>[% ELSE %]<option value="40">40</option>[% END %] > [% IF results_per_page == '60' %]<option value="60" selected="selected">60</option>[% ELSE %]<option value="60">60</option>[% END %] > [% IF results_per_page == '80' %]<option value="80" selected="selected">80</option>[% ELSE %]<option value="80">80</option>[% END %] > [% IF results_per_page == '100' %]<option value="100" selected="selected">100</option>[% ELSE %]<option value="100">100</option>[% END %] > </select> >- >+ [% END %] > <input type="submit" class="btn btn-small clearfix" id="sortsubmit" value="Go" /> > </div> > [% END %] >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 0e7f8c3a7c..27d80ba679 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -523,7 +523,10 @@ if ($params->{'limit-yr'}) { > my $scan = $params->{'scan'}; > my $count = C4::Context->preference('OPACnumSearchResults') || 20; > my $countRSS = C4::Context->preference('numSearchRSSResults') || 50; >-my $results_per_page = $params->{'results_per_page'} || $cgi->cookie("results_per_page") || $count; >+my $results_per_page = $count; >+if ( C4::Context->preference('OPACnumSearchResultsDropdown') ){ >+ $results_per_page = $params->{'results_per_page'} || $cgi->cookie("results_per_page"); >+} > my $page = $cgi->param('page') || 1; > my $offset = $params->{'offset'} || 0; > $offset = 0 if $offset < 0; >@@ -603,7 +606,7 @@ if ($tag) { > # FIXME: No facets for tags search. > } elsif ($build_grouped_results) { > eval { >- ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$query_type,$scan); >+ ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,undef,$query_type,$scan); > }; > } else { > $pasarParams .= '&query=' . uri_escape_utf8($query); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14715
:
41949
|
42003
|
42742
|
42743
|
56002
|
56003
|
56004
|
56005
|
56575
|
56576
|
56577
|
56610
|
56611
|
56612
|
57870
|
61721
|
64250
|
67912
|
67913
|
68000
|
68001
|
68305
|
68327
|
75938
|
75939
|
75940
|
75941
|
78230
|
78298
|
78299
|
78300
|
78301
|
78302
|
79796
|
79797
|
79988
|
81203
|
88097
|
88102
|
88103
|
88104
|
88105
|
88106
|
88107
|
88108
|
88109
|
88126
|
88195
|
88831
|
88832
|
88833
|
88834
|
88835
|
88836
|
88837
|
88838
|
88839
|
95038
|
97004
|
98365
|
99607
|
99677
|
99684
|
99685
|
101775
|
101776
|
101777
|
101778