From 0baa2d810f8b1d8e42593b8bde5cd4de598014aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Sepp=C3=A4l=C3=A4?= Date: Tue, 17 Jun 2014 13:05:10 +0300 Subject: [PATCH] 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. --- koha-tmpl/intranet-tmpl/js/browser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js index b56ff9f..1be3f01 100644 --- a/koha-tmpl/intranet-tmpl/js/browser.js +++ b/koha-tmpl/intranet-tmpl/js/browser.js @@ -81,9 +81,10 @@ KOHA.browser = function (searchid, biblionumber) { } else { prevbutton = '« ' + BROWSER_PREVIOUS + ''; } - if (me.curPos === me.searchCookie.results.length && me.searchCookie.total == me.curPos + me.searchCookie.offset) { + if (me.curPos === me.searchCookie.pagelen - 1 && me.curPos + me.offset === me.searchCookie.pagelen - 1) { nextbutton = '' + BROWSER_NEXT + ' »'; - } else { + } + else { nextbutton = '' + BROWSER_NEXT + ' »'; } $('#menu').before('
' + prevbutton + nextbutton + '
'); -- 1.9.1