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

(-)a/C4/Languages.pm (+14 lines)
Lines 622-627 sub getlanguage { Link Here
622
    return $language;
622
    return $language;
623
}
623
}
624
624
625
=head2 get_rfc4646_from_iso639
626
627
    Select a language rfc4646 code given an iso639 code
628
629
=cut
630
631
sub get_rfc4646_from_iso639 {
632
633
    my $iso_code = shift;
634
    my $rfc_subtag = Koha::Database->new()->schema->resultset('LanguageRfc4646ToIso639')->find({iso639_2_code=>$iso_code})->rfc4646_subtag;
635
    return $rfc_subtag;
636
637
}
638
625
1;
639
1;
626
640
627
__END__
641
__END__
(-)a/Koha/SearchEngine/Elasticsearch.pm (-1 / +1 lines)
Lines 553-559 sub get_facetable_fields { Link Here
553
553
554
    # These should correspond to the ES field names, as opposed to the CCL
554
    # These should correspond to the ES field names, as opposed to the CCL
555
    # things that zebra uses.
555
    # things that zebra uses.
556
    my @search_field_names = qw( author itype location su-geo se subject ccode holdingbranch homebranch );
556
    my @search_field_names = qw( author itype location su-geo se subject ccode holdingbranch homebranch ln);
557
    my @faceted_fields = Koha::SearchFields->search(
557
    my @faceted_fields = Koha::SearchFields->search(
558
        { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
558
        { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
559
    );
559
    );
(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (+1 lines)
Lines 119-124 sub build_query { Link Here
119
        'su-geo' => { terms => { field => "su-geo__facet" } },
119
        'su-geo' => { terms => { field => "su-geo__facet" } },
120
        se       => { terms => { field => "se__facet" } },
120
        se       => { terms => { field => "se__facet" } },
121
        ccode    => { terms => { field => "ccode__facet" } },
121
        ccode    => { terms => { field => "ccode__facet" } },
122
        ln       => { terms => { field => "ln__facet" } },
122
    };
123
    };
123
124
124
    my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');
125
    my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (+1 lines)
Lines 430-435 sub _convert_facets { Link Here
430
        ccode         => 'CollectionCodes',
430
        ccode         => 'CollectionCodes',
431
        holdingbranch => 'HoldingLibrary',
431
        holdingbranch => 'HoldingLibrary',
432
        homebranch    => 'HomeLibrary',
432
        homebranch    => 'HomeLibrary',
433
        ln            => 'Language',
433
    );
434
    );
434
    my @facetable_fields =
435
    my @facetable_fields =
435
      Koha::SearchEngine::Elasticsearch->get_facetable_fields;
436
      Koha::SearchEngine::Elasticsearch->get_facetable_fields;
(-)a/admin/searchengine/elasticsearch/mappings.yaml (-3 / +4 lines)
Lines 2333-2354 biblios: Link Here
2333
  ln:
2333
  ln:
2334
    label: ln
2334
    label: ln
2335
    mappings:
2335
    mappings:
2336
      - facet: ''
2336
      - facet: '1'
2337
        marc_field: 008_/35-37
2337
        marc_field: 008_/35-37
2338
        marc_type: marc21
2338
        marc_type: marc21
2339
        sort: ~
2339
        sort: ~
2340
        suggestible: ''
2340
        suggestible: ''
2341
      - facet: ''
2341
      - facet: '1'
2342
        marc_field: 008_/35-37
2342
        marc_field: 008_/35-37
2343
        marc_type: normarc
2343
        marc_type: normarc
2344
        sort: ~
2344
        sort: ~
2345
        suggestible: ''
2345
        suggestible: ''
2346
      - facet: ''
2346
      - facet: '1'
2347
        marc_field: 101a
2347
        marc_field: 101a
2348
        marc_type: unimarc
2348
        marc_type: unimarc
2349
        sort: ~
2349
        sort: ~
2350
        suggestible: ''
2350
        suggestible: ''
2351
    type: ''
2351
    type: ''
2352
    facet_order: 10
2352
  local-classification:
2353
  local-classification:
2353
    label: local-classification
2354
    label: local-classification
2354
    mappings:
2355
    mappings:
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc (-1 / +4 lines)
Lines 1-4 Link Here
1
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
2
[% USE Languages %]
2
[% IF ( opacfacets ) %]
3
[% IF ( opacfacets ) %]
3
[% IF ( facets_loop ) %]
4
[% IF ( facets_loop ) %]
4
<div id="search-facets">
5
<div id="search-facets">
Lines 21-27 Link Here
21
[% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
22
[% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
22
[% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
23
[% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
23
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
24
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
24
[% IF facets_loo.type_label_CollectionCodes %]<span id="facet-locations">Collections</span>[% END %]
25
[% IF facets_loo.type_label_CollectionCodes %]<span id="facet-collections">Collections</span>[% END %]
26
[% IF facets_loo.type_label_Language %]<span id="facet-languages">Languages</span>[% END %]
25
<ul>
27
<ul>
26
  [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
28
  [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
27
  [% IF ( sort_by ) %]
29
  [% IF ( sort_by ) %]
Lines 29-34 Link Here
29
  [% END %]
31
  [% END %]
30
  [% FOREACH facet IN facets_loo.facets %]
32
  [% FOREACH facet IN facets_loo.facets %]
31
  [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,0) || facet.facet_label_value %][% END %]
33
  [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,0) || facet.facet_label_value %][% END %]
34
  [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
32
    <li>
35
    <li>
33
      [% IF facet.active %]
36
      [% IF facet.active %]
34
        [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
37
        [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt (+1 lines)
Lines 321-326 a.add, a.delete { Link Here
321
                                                [% CASE 'ccode' %]Collections
321
                                                [% CASE 'ccode' %]Collections
322
                                                [% CASE 'holdingbranch' %]Holding libraries
322
                                                [% CASE 'holdingbranch' %]Holding libraries
323
                                                [% CASE 'homebranch' %]Home libraries
323
                                                [% CASE 'homebranch' %]Home libraries
324
                                                [% CASE 'ln' %]Language
324
                                                [% CASE %][% f %]
325
                                                [% CASE %][% f %]
325
                                                [% END %]
326
                                                [% END %]
326
                                            </td>
327
                                            </td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc (-1 / +4 lines)
Lines 1-4 Link Here
1
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
2
[% USE Languages %]
2
[% IF ( opacfacets && facets_loop && total ) %]
3
[% IF ( opacfacets && facets_loop && total ) %]
3
    <div id="search-facets">
4
    <div id="search-facets">
4
        <h4><a href="#" class="menu-collapse-toggle">Refine your search</a></h4>
5
        <h4><a href="#" class="menu-collapse-toggle">Refine your search</a></h4>
Lines 25-31 Link Here
25
                        [% IF facets_loo.type_label_Places %]<h5 id="facet-places">Places</h5>[% END %]
26
                        [% IF facets_loo.type_label_Places %]<h5 id="facet-places">Places</h5>[% END %]
26
                        [% IF facets_loo.type_label_Series %]<h5 id="facet-series">Series</h5>[% END %]
27
                        [% IF facets_loo.type_label_Series %]<h5 id="facet-series">Series</h5>[% END %]
27
                        [% IF facets_loo.type_label_ItemTypes %]<h5 id="facet-itemtypes">Item types</h5>[% END %]
28
                        [% IF facets_loo.type_label_ItemTypes %]<h5 id="facet-itemtypes">Item types</h5>[% END %]
28
                        [% IF facets_loo.type_label_CollectionCodes %]<h5 id="facet-itemtypes">Collections</h5>[% END %]
29
                        [% IF facets_loo.type_label_CollectionCodes %]<h5 id="facet-collections">Collections</h5>[% END %]
30
                        [% IF facets_loo.type_label_Language %]<h5 id="facet-languages">Languages</h5>[% END %]
29
                        [% UNLESS singleBranchMode %]
31
                        [% UNLESS singleBranchMode %]
30
                            [% IF ( facets_loo.type_label_HomeLibrary ) %]<h5 id="facet-home-libraries">Home libraries</h5>[% END %]
32
                            [% IF ( facets_loo.type_label_HomeLibrary ) %]<h5 id="facet-home-libraries">Home libraries</h5>[% END %]
31
                            [% IF ( facets_loo.type_label_HoldingLibrary ) %]<h5 id="facet-holding-libraries">Holding libraries</h5>[% END %]
33
                            [% IF ( facets_loo.type_label_HoldingLibrary ) %]<h5 id="facet-holding-libraries">Holding libraries</h5>[% END %]
Lines 38-43 Link Here
38
                            [% END %]
40
                            [% END %]
39
                            [% FOREACH facet IN facets_loo.facets %]
41
                            [% FOREACH facet IN facets_loo.facets %]
40
                            [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,1) || facet.facet_label_value %][% END %]
42
                            [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,1) || facet.facet_label_value %][% END %]
43
                            [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
41
                                <li>
44
                                <li>
42
                                  [% IF facet.active %]
45
                                  [% IF facet.active %]
43
                                    [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
46
                                    [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
(-)a/t/db_dependent/Languages.t (-2 / +7 lines)
Lines 6-12 Link Here
6
use strict;
6
use strict;
7
use warnings;
7
use warnings;
8
8
9
use Test::More tests => 17;
9
use Test::More tests => 18;
10
use List::Util qw(first);
10
use List::Util qw(first);
11
use Data::Dumper;
11
use Data::Dumper;
12
use Test::Warn;
12
use Test::Warn;
Lines 95-98 my $LangRfc4646 = $sth->fetchall_arrayref({}); Link Here
95
95
96
is(scalar(@$LangRfc4646),scalar(@$DistinctLangRfc4646),"No unexpected language_rfc4646_to_iso639 duplicates.");
96
is(scalar(@$LangRfc4646),scalar(@$DistinctLangRfc4646),"No unexpected language_rfc4646_to_iso639 duplicates.");
97
97
98
my $i = 0;
99
foreach my $pair (@$DistinctLangRfc4646){
100
    $i++ if $pair->{rfc4646_subtag} eq C4::Languages::get_rfc4646_from_iso639( $pair->{iso639_2_code} );
101
}
102
is($i,scalar(@$DistinctLangRfc4646),"get_rfc4646_from_iso639 returns correct rfc for all iso values.");
103
98
$dbh->rollback;
104
$dbh->rollback;
99
- 

Return to bug 18213