Bugzilla – Attachment 96390 Details for
Bug 24219
Elasticsearch needs to remember sort preference when returning to result list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24219: Preserve sort order when returning to result list
Bug-24219-Preserve-sort-order-when-returning-to-re.patch (text/plain), 5.35 KB, created by
Lucas Gass (lukeg)
on 2019-12-17 18:11:48 UTC
(
hide
)
Description:
Bug 24219: Preserve sort order when returning to result list
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2019-12-17 18:11:48 UTC
Size:
5.35 KB
patch
obsolete
>From 2ea0db67019ba3155cdba5462ea45e88d9eb71f9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 17 Dec 2019 10:45:11 +0100 >Subject: [PATCH] Bug 24219: Preserve sort order when returning to result list > >There is a mismatch between sort_cgi, sort and sort_by variables. > > * sort_cgi >I did not find relevant occurrences of sort_cgi in the git log of both >search.pl and results.tt. So it seems that it never worked correctly. > * sort >It is the JS variable use in browser.js > * sort_by is the search.pl parameter to set the sort_by option > >Test plan: >1. Perform a search in the staff client >2. Change the sort order to something different (try Author A-Z) >3. Click on a result to view the record >4. Click on "Results" button on left side to return to result list >=> Without this patch the result list is sorted by relevancy >=> With this patch applied the Author A-Z is kept > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > koha-tmpl/intranet-tmpl/js/browser.js | 6 +++--- > koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt | 4 ++-- > 2 files changed, 5 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js >index 3b9ca87cbb..09f1d02d38 100644 >--- a/koha-tmpl/intranet-tmpl/js/browser.js >+++ b/koha-tmpl/intranet-tmpl/js/browser.js >@@ -32,9 +32,9 @@ KOHA.browser = function (searchid, biblionumber) { > var browseRecords = function (movement) { > var newSearchPos = me.curPos + movement; > if (newSearchPos > current_search.results.length - 1) { >- window.location = '/cgi-bin/koha/catalogue/search.pl?' + decodeURIComponent(current_search.query) + '&limit=' + decodeURIComponent(current_search.limit) + '&sort=' + current_search.sort + '&gotoPage=detail.pl&gotoNumber=first&searchid=' + me.searchid + '&offset=' + newSearchPos; >+ window.location = '/cgi-bin/koha/catalogue/search.pl?' + decodeURIComponent(current_search.query) + '&limit=' + decodeURIComponent(current_search.limit) + '&sort_by=' + current_search.sort + '&gotoPage=detail.pl&gotoNumber=first&searchid=' + me.searchid + '&offset=' + newSearchPos; > } else if (newSearchPos < 0) { >- window.location = '/cgi-bin/koha/catalogue/search.pl?' + decodeURIComponent(current_search.query) + '&limit=' + decodeURIComponent(current_search.limit) + '&sort=' + current_search.sort + '&gotoPage=detail.pl&gotoNumber=last&searchid=' + me.searchid + '&offset=' + (me.offset - current_search.pagelen); >+ window.location = '/cgi-bin/koha/catalogue/search.pl?' + decodeURIComponent(current_search.query) + '&limit=' + decodeURIComponent(current_search.limit) + '&sort_by=' + current_search.sort + '&gotoPage=detail.pl&gotoNumber=last&searchid=' + me.searchid + '&offset=' + (me.offset - current_search.pagelen); > } else { > window.location = window.location.href.replace('biblionumber=' + biblionumber, 'biblionumber=' + current_search.results[newSearchPos]); > } >@@ -91,7 +91,7 @@ KOHA.browser = function (searchid, biblionumber) { > > $(document).ready(function () { > if (me.curPos > -1) { >- var searchURL = '/cgi-bin/koha/catalogue/search.pl?' + decodeURIComponent(current_search.query) + '&limit=' + decodeURIComponent(current_search.limit) + '&sort=' + current_search.sort + '&searchid=' + me.searchid + '&offset=' + me.offset; >+ var searchURL = '/cgi-bin/koha/catalogue/search.pl?' + decodeURIComponent(current_search.query) + '&limit=' + decodeURIComponent(current_search.limit) + '&sort_by=' + current_search.sort + '&searchid=' + me.searchid + '&offset=' + me.offset; > var prevbutton; > var nextbutton; > if (me.curPos === 0 && current_search.offset === 1) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index fe22771aa1..70eaf696f8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -797,7 +797,7 @@ > [%- END -%] > ]; > var browser = KOHA.browser('[% searchid | html %]', parseInt('[% biblionumber | html %]', 10)); >- browser.create([% SEARCH_RESULTS.first.result_number | html %], '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_cgi | html %]', >+ browser.create([% SEARCH_RESULTS.first.result_number | html %], '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_by| html %]', > newresults, '[% total | html %]'); > [% END %] > >@@ -935,7 +935,7 @@ > var bibnums = getContextBiblioNumbers(); > if ( bibnums && bibnums.length > 0 ) { > var browser = KOHA.browser('', parseInt('[% biblionumber | html %]', 10)); >- browser.create(1, '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_cgi | html %]', bibnums, bibnums.length); >+ browser.create(1, '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_by | html %]', bibnums, bibnums.length); > window.location = '/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + bibnums[0] + '&searchid='+browser.searchid; > } else { > alert(MSG_NO_ITEM_SELECTED); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24219
:
96359
|
96390
|
99512
|
99847
|
100266