View | Details | Raw Unified | Return to bug 28826
Collapse All | Expand All

(-)a/C4/Search.pm (-1 / +4 lines)
Lines 586-592 sub getRecords { Link Here
586
    # This sorts the facets into alphabetical order
586
    # This sorts the facets into alphabetical order
587
    if (@facets_loop) {
587
    if (@facets_loop) {
588
        foreach my $f (@facets_loop) {
588
        foreach my $f (@facets_loop) {
589
            $f->{facets} = [ sort { uc($a->{facet_label_value}) cmp uc($b->{facet_label_value}) } @{ $f->{facets} } ];
589
            if( C4::Context->preference('FacetOrder') eq 'Alphabetical' ){
590
                $f->{facets} =
591
                    [ sort { uc($a->{facet_label_value}) cmp uc($b->{facet_label_value}) } @{ $f->{facets} } ];
592
            }
590
        }
593
        }
591
    }
594
    }
592
595
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (+5 lines)
Lines 500-508 sub _convert_facets { Link Here
500
                type_link_value => $type,
500
                type_link_value => $type,
501
            };
501
            };
502
        }
502
        }
503
        if( C4::Context->preference('FacetOrder') eq 'Alphabetical' ){
504
            @{ $facet->{facets} } =
505
                sort { $a->{facet_label_value} cmp $b->{facet_label_value} } @{ $facet->{facets} };
506
        }
503
        push @facets, $facet if exists $facet->{facets};
507
        push @facets, $facet if exists $facet->{facets};
504
    }
508
    }
505
509
510
506
    @facets = sort { $a->{order} <=> $b->{order} } @facets;
511
    @facets = sort { $a->{order} <=> $b->{order} } @facets;
507
    return \@facets;
512
    return \@facets;
508
}
513
}
(-)a/installer/data/mysql/atomicupdate/bug_28826_add_FacetSort_syspref.perl (+9 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT IGNORE INTO systempreferences
5
        ( variable, value, options, explanation, type ) VALUES
6
        ('FacetOrder','Alphabetical','Alphabetical|Usage','Specify the order of facets within each category','Choice')
7
    });
8
    NewVersion( $DBversion, 28826, "Add system preference FacetOrder");
9
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 211-216 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
211
('ExtendedPatronAttributes','1',NULL,'Use extended patron IDs and attributes','YesNo'),
211
('ExtendedPatronAttributes','1',NULL,'Use extended patron IDs and attributes','YesNo'),
212
('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'),
212
('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'),
213
('FacetMaxCount','20',NULL,'Specify the max facet count for each category','Integer'),
213
('FacetMaxCount','20',NULL,'Specify the max facet count for each category','Integer'),
214
('FacetOrder','Alphabetical','Alphabetical|Usage','Specify the order of facets within each category','Choice'),
214
('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'),
215
('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'),
215
('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo'),
216
('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo'),
216
('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is charged','YesNo'),
217
('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is charged','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (-1 / +9 lines)
Lines 231-236 Searching: Link Here
231
              class: integer
231
              class: integer
232
              default: 20
232
              default: 20
233
            - facets for each category.
233
            - facets for each category.
234
        -
235
            - Sort facets
236
            - pref: FacetOrder
237
              type: choice
238
              choices:
239
                  Alphabetical: "alphabetically"
240
                  Usage: "by usage count"
241
              default: Alphabetical
242
            - for each category.
234
        -
243
        -
235
            - By default, show
244
            - By default, show
236
            - pref: OPACnumSearchResults
245
            - pref: OPACnumSearchResults
237
- 

Return to bug 28826