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

(-)a/C4/Search.pm (+3 lines)
Lines 593-598 sub getRecords { Link Here
593
                    $f->{facets} = $sorted_facets;
593
                    $f->{facets} = $sorted_facets;
594
                }
594
                }
595
            }
595
            }
596
            if ( C4::Context->preference('FacetOrder') eq 'Stringwise' ) {
597
                @{ $f->{facets} } = sort { $a->{facet_label_value} cmp $b->{facet_label_value} } @{ $f->{facets} };
598
            }
596
        }
599
        }
597
    }
600
    }
598
601
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (+2 lines)
Lines 575-580 sub _convert_facets { Link Here
575
            if ($sorted_facets) {
575
            if ($sorted_facets) {
576
                $facet->{facets} = $sorted_facets;
576
                $facet->{facets} = $sorted_facets;
577
            }
577
            }
578
        } elsif ( C4::Context->preference('FacetOrder') eq 'Stringwise' ) {
579
            @{ $facet->{facets} } = sort { $a->{facet_label_value} cmp $b->{facet_label_value} } @{ $facet->{facets} };
578
        }
580
        }
579
        push @facets, $facet if exists $facet->{facets};
581
        push @facets, $facet if exists $facet->{facets};
580
    }
582
    }
(-)a/installer/data/mysql/atomicupdate/bug_41287.pl (+29 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "41287",
6
    description => "Add option for stringwise sorting of facets",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        # Do you stuffs here
12
        $dbh->do(
13
            q{
14
            INSERT IGNORE INTO systempreferences
15
            ( variable, value, options, explanation, type ) VALUES
16
            ('FacetOrder','Alphabetical','Alphabetical|Usage|Stringwise','Specify the order of facets within each category','Choice')
17
        }
18
        );
19
        $dbh->do(
20
            q{
21
            UPDATE systempreferences
22
            SET options = 'Alphabetical|Usage|Stringwise'
23
            WHERE variable = 'FacetOrder'
24
        }
25
        );
26
27
        say $out "Added new 'Stringwise' option to system preference 'FacetOrder'";
28
    },
29
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 281-287 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
281
('ExtendedPatronAttributes','1',NULL,'Use extended patron IDs and attributes','YesNo'),
281
('ExtendedPatronAttributes','1',NULL,'Use extended patron IDs and attributes','YesNo'),
282
('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'),
282
('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'),
283
('FacetMaxCount','20',NULL,'Specify the max facet count for each category','Integer'),
283
('FacetMaxCount','20',NULL,'Specify the max facet count for each category','Integer'),
284
('FacetOrder','Alphabetical','Alphabetical|Usage','Specify the order of facets within each category','Choice'),
284
('FacetOrder','Alphabetical','Alphabetical|Usage|Stringwise','Specify the order of facets within each category','Choice'),
285
('FacetSortingLocale','default','','Choose the locale for sorting facet names when FacetOrder is set to Alphabetical. This enables proper Unicode-aware sorting of accented characters and locale-specific alphabetical ordering.','Choice'),
285
('FacetSortingLocale','default','','Choose the locale for sorting facet names when FacetOrder is set to Alphabetical. This enables proper Unicode-aware sorting of accented characters and locale-specific alphabetical ordering.','Choice'),
286
('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'),
286
('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'),
287
('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo'),
287
('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (-3 / +3 lines)
Lines 301-310 Searching: Link Here
301
            - pref: FacetOrder
301
            - pref: FacetOrder
302
              type: choice
302
              type: choice
303
              choices:
303
              choices:
304
                  Alphabetical: "alphabetically"
304
                  Alphabetical: "alphabetically using locale"
305
                  Usage: "by usage count"
305
                  Usage: "by usage count"
306
                  Stringwise: "simple alphabetical"
306
              default: Alphabetical
307
              default: Alphabetical
307
            - for each category.
308
            - for each category. Locale can be set using the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FacetSortingLocale">FacetSortingLocale</a> preference.
308
        -
309
        -
309
            - By default, show
310
            - By default, show
310
            - pref: OPACnumSearchResults
311
            - pref: OPACnumSearchResults
311
- 

Return to bug 41287