From 534aa49297dc3dc1b9ab698743be1ce55eb0965f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 1 Aug 2013 09:14:08 -0400 Subject: [PATCH] Bug 10656: improve sorting of shelving location and collections on OPAC advanced search form Collection codes and shelving locations are displayed in the OPAC and staff client via GetAuthorisedValues which currently sorts results by "lib, lib_opac." Consequently if lib (the description for the staff client) doesn't match lib_opac (the description for the OPAC) sorting will appear to be nonsensical in the OPAC. GetAuthorisedValues can be passed an $opac parameter, so this should be used to switch how reuslts are sorted. This patch implements such a switch. To test, modify your collection code or shelving location authorized values so that lib and lib_opac do not match. Set your AdvancedSearchTypes system preference to display the modified authorized values and view the advanced search page in the OPAC and staff client. Sorting should be correct in each case according to the correct value (lib in the staff client, lib_opac in the OPAC). Signed-off-by: Nicole C. Engard Tested in staff and opac and it works perfectly! Signed-off-by: Galen Charlton Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall Signed-off-by: Galen Charlton (cherry picked from commit dd13998837ebd28b3b97e28da470ec341251b9b2) Signed-off-by: Tomas Cohen Arazi --- C4/Koha.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 4dcf341d11..33063d94b3 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1064,7 +1064,7 @@ sub GetAuthorisedValues { if(@where_strings > 0) { $query .= " WHERE " . join(" AND ", @where_strings); } - $query .= " GROUP BY lib ORDER BY category, lib, lib_opac"; + $query .= " GROUP BY lib ORDER BY category, " . ($opac ? "lib_opac, lib" : "lib, lib_opac"); my $sth = $dbh->prepare($query); -- 2.39.5