Browse Source

Bug 19502: (follow-up) Pass parameters to avoid making templates depend on search engine

https://bugs.koha-community.org/show_bug.cgi?id=19502

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
18.11.x
Nick Clemens 6 years ago
parent
commit
78b9a3e450
  1. 2
      catalogue/search.pl
  2. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc
  3. 2
      koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc
  4. 2
      koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc
  5. 1
      opac/opac-search.pl

2
catalogue/search.pl

@ -620,6 +620,7 @@ for (my $i=0;$i<@servers;$i++) {
## Build the page numbers on the bottom of the page
my @page_numbers;
my $hits_to_paginate = C4::Context->preference('SearchEngine') eq 'Elasticsearch' ? 10000 : $hits;
$template->param( hits_to_paginate => $hits_to_paginate );
# total number of pages there will be
my $pages = ceil($hits_to_paginate / $results_per_page);
my $last_page_offset = ( $pages -1 ) * $results_per_page;
@ -676,6 +677,7 @@ for (my $i=0;$i<@servers;$i++) {
last_page_offset => $last_page_offset,
previous_page_offset => $previous_page_offset) unless $pages < 2;
$template->param( next_page_offset => $next_page_offset) unless $pages eq $current_page_number;
warn "topage $hits_to_paginate";
}

2
koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc

@ -1,5 +1,5 @@
[% IF ( PAGE_NUMBERS ) %]<nav><ul class="pagination">
[% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]<h6>10,000 results loaded, refine your search to view other records</h6>[% END %]
[% IF hits_to_paginate < total %]<h6>[% hits_to_paginate %] of [% total %] results loaded, refine your search to view other records</h6>[% END %]
[% IF ( previous_page_offset.defined ) %]
<li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |url %][% END %]">First</a></li>
<!-- Row of numbers corresponding to search result pages -->

2
koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc

@ -1,6 +1,6 @@
[% IF ( PAGE_NUMBERS ) %]
<div class="pagination pagination-small noprint">
[% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]<h6>10000 results loaded, refine your search to view other records</h6>[% END %]
[% IF hits_to_paginate < total %]<h6>[% hits_to_paginate %] of [% total %] results loaded, refine your search to view other records</h6>[% END %]
<ul>
[% IF ( previous_page_offset.defined ) %]
<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">First</a></li>

2
koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc

@ -1,6 +1,6 @@
[% IF ( PAGE_NUMBERS ) %]
<div class="pages">
[% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]<h6>10000 results loaded, refine your search to view other records</h6>[% END %]
[% IF hits_to_paginate < total %]<h6>[% hits_to_paginate %] of [% total %] results loaded, refine your search to view other records</h6>[% END %]
[% IF ( previous_page ) %]
<a class="nav" href="?[% FOREACH fp IN follower_params %][% fp.var |url %]=[% fp.val |url %]&amp;[% END %]page=[% previous_page |url %]">&lt;&lt; Previous</a>
[% END %]

1
opac/opac-search.pl

@ -831,6 +831,7 @@ for (my $i=0;$i<@servers;$i++) {
## Build the page numbers on the bottom of the page
my @page_numbers;
my $hits_to_paginate = C4::Context->preference('SearchEngine') eq 'Elasticsearch' ? 10000 : $hits;
$template->param( hits_to_paginate => $hits_to_paginate );
# total number of pages there will be
my $pages = ceil($hits_to_paginate / $results_per_page);
my $last_page_offset = ( $pages - 1 ) * $results_per_page;

Loading…
Cancel
Save