Bug 14371: Facets should be sorted by label (displayed) not title (link value)

This patch changes one small line in catalogue/search.pl and opac/opac-search to sort facets by:
facet_label_value
instead of
facet_title_value

To test:
1 - Perform a search with results in two branches e.g. Centerville (code CPL) and Fairfield (code FPL)
2 - Notice that branch facets appear correctly sorted
3 - Rename the branches Centervile->Zebra and Fairfeild->Aardvark (but don't change codes)
4 - Repeat original search
5 - Note that branch facets are no longer correctly sorted
6 - Apply patch
7 - Repeat search
8 - Facets should be correctly sorted
9 - Test in both staff and opac search
10 - Ensure there are no unintended consequences/regressions

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described,  staff AND opac
No errors

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
This commit is contained in:
Nick Clemens 2015-06-09 21:51:44 -04:00 committed by Tomas Cohen Arazi
parent 6d9d66e32a
commit 219f7b5c8f
2 changed files with 2 additions and 2 deletions

View file

@ -536,7 +536,7 @@ eval {
# This sorts the facets into alphabetical order
if ($facets) {
foreach my $f (@$facets) {
$f->{facets} = [ sort { uc($a->{facet_title_value}) cmp uc($b->{facet_title_value}) } @{ $f->{facets} } ];
$f->{facets} = [ sort { uc($a->{facet_label_value}) cmp uc($b->{facet_label_value}) } @{ $f->{facets} } ];
}
}
if ($@ || $error) {

View file

@ -579,7 +579,7 @@ if ($tag) {
# This sorts the facets into alphabetical order
if ($facets) {
foreach my $f (@$facets) {
$f->{facets} = [ sort { uc($a->{facet_title_value}) cmp uc($b->{facet_title_value}) } @{ $f->{facets} } ];
$f->{facets} = [ sort { uc($a->{facet_label_value}) cmp uc($b->{facet_label_value}) } @{ $f->{facets} } ];
}
@$facets = sort {$a->{expand} cmp $b->{expand}} @$facets;
}