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: Michal Denar <black23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
9c2a74a638
commit
f1c93e88d4
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -708,6 +708,7 @@
|
|||
query_cgi: "[% query_cgi | html %]",
|
||||
limit_cgi: "[% limit_cgi | html %]",
|
||||
sort_cgi: "[% sort_cgi | html %]",
|
||||
sort_by: "[% sort_by | html %]",
|
||||
gotoPage: "[% gotoPage | html %]",
|
||||
gotoNumber: "[% gotoNumber | html %]",
|
||||
searchid: "[% searchid | html %]",
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ $(document).ready(function() {
|
|||
|
||||
if( SEARCH_RESULTS ){
|
||||
var browser = KOHA.browser( search_result.searchid, parseInt( biblionumber, 10));
|
||||
browser.create( search_result.first_result_number, search_result.query_cgi, search_result.limit_cgi, search_result.sort_cgi, new_results_browser, search_result.total );
|
||||
browser.create( search_result.first_result_number, search_result.query_cgi, search_result.limit_cgi, search_result.sort_by, new_results_browser, search_result.total );
|
||||
}
|
||||
|
||||
if( search_result.gotoPage && search_result.gotoNumber){
|
||||
|
|
@ -245,7 +245,7 @@ function browse_selection () {
|
|||
var bibnums = getContextBiblioNumbers();
|
||||
if ( bibnums && bibnums.length > 0 ) {
|
||||
var browser = KOHA.browser('', parseInt( biblionumber, 10));
|
||||
browser.create(1, search_result.query_cgi, search_result.limit_cgi, search_result.sort_cgi, bibnums, bibnums.length);
|
||||
browser.create(1, search_result.query_cgi, search_result.limit_cgi, search_result.sort_by, bibnums, bibnums.length);
|
||||
window.location = '/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + bibnums[0] + '&searchid='+browser.searchid;
|
||||
} else {
|
||||
alert(MSG_NO_ITEM_SELECTED);
|
||||
|
|
@ -305,4 +305,4 @@ function verify_images() {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue