@@ -, +, @@ HTTP-header size, when making multiple searches in the staff client. ------------- - TEST PLAN - ------------- ------------ - DRAWBACK - ------------ --- catalogue/search.pl | 11 +++++++++-- koha-tmpl/intranet-tmpl/js/browser.js | 13 +++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) --- a/catalogue/search.pl +++ a/catalogue/search.pl @@ -675,8 +675,15 @@ for (my $i=0;$i<@servers;$i++) { } #/end of the for loop #$template->param(FEDERATED_RESULTS => \@results_array); -$template->{'VARS'}->{'searchid'} = $cgi->param('searchid') - || String::Random::random_string('ssssssss'); +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 +} + my $gotonumber = $cgi->param('gotoNumber'); if ($gotonumber eq 'last' || $gotonumber eq 'first') { $template->{'VARS'}->{'gotoNumber'} = $gotonumber; --- a/koha-tmpl/intranet-tmpl/js/browser.js +++ a/koha-tmpl/intranet-tmpl/js/browser.js @@ -40,6 +40,19 @@ KOHA.browser = function (searchid, biblionumber) { pagelen: newresults.length, results: newresults }; + + //Bug_11369 Cleaning up excess searchCookies to prevent cookie overflow in the browser memory. + var allVisibleCookieKeys = Object.keys( $.cookie() ); + var scsCookieKeys = $.grep( allVisibleCookieKeys, + function(elementOfArray, indexInArray) { + return ( elementOfArray.search(/^scs_\d/) != -1 ); //We are looking for specifically staff client searchCookies. + } + ); + if (scsCookieKeys.length > 10) { + scsCookieKeys.sort(); //Make sure they are in order, oldest first! + $.removeCookie( scsCookieKeys[0], { path: '/' } ); + } + //<