Browse Source

Bug 12261: Staff client next/previous links lead to unknown record

When using Staff client next/previous links after a search :
If the current record is the last of the results, clicking on "next"
will lead to the page of an unknown record with message :

The record you requested does not exist (NaN).

To test:
1) Do an intranet catalog search that has more than 1 results.
2) Click on the last search result and then click the "Next"-button from
   the top-left navigation.
3) Confirm that you get thrown to a page with the message: "The record
   you requested does not exist (NaN).".
4) Apply patch.
5) Repeat steps 1 - 2.
6) Confirm that the navigation button for "Next" is greyed out.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

This patch fixes the problem with last result in both single pages of
search results and multiple pages of search results.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
MM-OPAC/theme_dep
Juhani Seppälä 10 years ago
committed by Tomas Cohen Arazi
parent
commit
fa5bc09926
  1. 2
      koha-tmpl/intranet-tmpl/js/browser.js

2
koha-tmpl/intranet-tmpl/js/browser.js

@ -81,7 +81,7 @@ KOHA.browser = function (searchid, biblionumber) {
} else {
prevbutton = '<a href="#" id="browse-previous" class="browse-button">« ' + BROWSER_PREVIOUS + '</a>';
}
if (me.curPos === me.searchCookie.results.length && me.searchCookie.total == me.curPos + me.searchCookie.offset) {
if (me.curPos === me.searchCookie.pagelen - 1) {
nextbutton = '<span id="browse-next" class="browse-button">' + BROWSER_NEXT + ' »</span>';
} else {
nextbutton = '<a href="#" id="browse-next" class="browse-button">' + BROWSER_NEXT + ' »</a>';

Loading…
Cancel
Save