@@ -, +, @@ authvals where lib_opac is NULL is different from the sort order for OPAC descriptions. Also, ensure that one of the OPAC descriptions is NULL. For example, authorised_value | lib | lib_opac -------------------------------------- ZZZ | A_STAFF | Z_PUBLIC DDD | D_STAFF | NULL AAA | Z_STAFF | A_PUBLIC is NULL will sort first in the OPAC advanced search page, even if the displayed label shouldn't come first. is now correct. has not changed. --- C4/Koha.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/C4/Koha.pm +++ a/C4/Koha.pm @@ -1076,7 +1076,11 @@ sub GetAuthorisedValues { if(@where_strings > 0) { $query .= " WHERE " . join(" AND ", @where_strings); } - $query .= " GROUP BY lib ORDER BY category, " . ($opac ? "lib_opac, lib" : "lib, lib_opac"); + $query .= " GROUP BY lib"; + $query .= ' ORDER BY category, ' . ( + $opac ? 'COALESCE(lib_opac, lib)' + : 'lib, lib_opac' + ); my $sth = $dbh->prepare($query); --