From 552617f8fc0982968eec9f2ae918f54b640bab6c Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 26 Feb 2014 17:14:04 +0100 Subject: [PATCH] [PASSED QA] Bug 11369 - General searchid in browser.js The search browser feature uses nearly only the browser.js file. That is why I propose to move the searchid generation from search.pl to browser.js. We then use Date.getTime() to use current timestamp as searchid, prefixed by 'scs_' like before. Test by using test plan of main patch : Too many search cursor cookies overflow HTTP-header size, when making multiple searches in the staff client Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Passes tests and QA script. Tested the browse functionality in staff by using the different options (back to results, next, previous, etc) and the batch modifications for items. An old cookie can cause a Javascript error, but after restarting the browser/deleting cookies it all works correctly. --- catalogue/search.pl | 9 +-------- koha-tmpl/intranet-tmpl/js/browser.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index bf1ddc2..b85e880 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -678,14 +678,7 @@ for (my $i=0;$i<@servers;$i++) { } #/end of the for loop #$template->param(FEDERATED_RESULTS => \@results_array); -if ($cgi->param('searchid')) { - $template->{'VARS'}->{'searchid'} = $cgi->param('searchid'); -} -else { - my $dt = DateTime->now(time_zone => 'local'); - #We are generating a clean numeric datetime representation so we can easily compare them using the default javascript lexigraphic sorter. - $template->{'VARS'}->{'searchid'} = 'scs_'.$dt->ymd('').$dt->hms(''); #scs == Staff Client -} +$template->{'VARS'}->{'searchid'} = $cgi->param('searchid'); my $gotonumber = $cgi->param('gotoNumber'); if ($gotonumber eq 'last' || $gotonumber eq 'first') { diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js index 4ebc29c..b56ff9f 100644 --- a/koha-tmpl/intranet-tmpl/js/browser.js +++ b/koha-tmpl/intranet-tmpl/js/browser.js @@ -2,13 +2,16 @@ if ( KOHA === undefined ) var KOHA = {}; KOHA.browser = function (searchid, biblionumber) { var me = this; + + if (!searchid) { + // We are generating a clean numeric datetime representation so we can easily compare them using the default javascript lexigraphic sorter. + searchid = 'scs_' + (new Date()).getTime(); // scs for Staff Client Search + } this.searchid = searchid; - if (me.searchid) { - var cookie = $.cookie(me.searchid) - if (cookie) { - me.searchCookie = JSON.parse(cookie); - } + var cookie = $.cookie(me.searchid) + if (cookie) { + me.searchCookie = JSON.parse(cookie); } var browseRecords = function (movement) { -- 1.8.3.2