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

(-)a/Koha/Filter/MARC/EmbedSeeFromHeadings.pm (-2 / +15 lines)
Lines 88-93 include in facets, sorting, or suggestion fields) Link Here
88
sub fields {
88
sub fields {
89
    my ($self, $record) = @_;
89
    my ($self, $record) = @_;
90
90
91
    my $params = $self->params;
92
    my $other_headings = $params->{options}->{other_headings} || [ 'see_from' ];
93
94
    my @auth_others;
95
    foreach my $other_heading ( @$other_headings ) {
96
        if ( $other_heading eq 'see_from' ) {
97
            push @auth_others, '4..';
98
        }
99
        if ( $other_heading eq 'see_also_from' ) {
100
            push @auth_others, '5..';
101
        }
102
    }
103
91
    my ($item_tag) = GetMarcFromKohaField( "items.itemnumber" );
104
    my ($item_tag) = GetMarcFromKohaField( "items.itemnumber" );
92
    $item_tag ||= '';
105
    $item_tag ||= '';
93
106
Lines 102-109 sub fields { Link Here
102
        my $authority = Koha::MetadataRecord::Authority->get_from_authid($authid);
115
        my $authority = Koha::MetadataRecord::Authority->get_from_authid($authid);
103
        next unless $authority;
116
        next unless $authority;
104
        my $auth_marc = $authority->record;
117
        my $auth_marc = $authority->record;
105
        my @seefrom = $auth_marc->field('4..');
118
        my @authfields = $auth_marc->field(@auth_others);
106
        foreach my $authfield (@seefrom) {
119
        foreach my $authfield (@authfields) {
107
            my $tag = substr($field->tag(), 0, 1) . substr($authfield->tag(), 1, 2);
120
            my $tag = substr($field->tag(), 0, 1) . substr($authfield->tag(), 1, 2);
108
            next if MARC::Field->is_controlfield_tag($tag);
121
            next if MARC::Field->is_controlfield_tag($tag);
109
            my $newfield = MARC::Field->new($tag,
122
            my $newfield = MARC::Field->new($tag,
(-)a/Koha/SearchEngine/Elasticsearch.pm (-2 / +17 lines)
Lines 664-671 sub marc_records_to_documents { Link Here
664
            }
664
            }
665
        }
665
        }
666
666
667
        if (C4::Context->preference('IncludeSeeFromInSearches') and $self->index eq 'biblios') {
667
        if ( $self->index eq $BIBLIOS_INDEX and ( C4::Context->preference('IncludeSeeFromInSearches') || C4::Context->preference('IncludeSeeAlsoFromInSearches') ) ) {
668
            foreach my $field (Koha::Filter::MARC::EmbedSeeFromHeadings->new->fields($record)) {
668
            my $marc_filter = Koha::Filter::MARC::EmbedSeeFromHeadings->new;
669
            my @other_headings;
670
            if ( C4::Context->preference('IncludeSeeFromInSearches') ) {
671
                push @other_headings, 'see_from';
672
            }
673
            if ( C4::Context->preference('IncludeSeeAlsoFromInSearches') ) {
674
                push @other_headings, 'see_also_from';
675
            }
676
            $marc_filter->initialize(
677
                {
678
                    options => {
679
                        other_headings => \@other_headings
680
                    }
681
                }
682
            );
683
            foreach my $field ($marc_filter->fields($record)) {
669
                my $data_field_rules = $data_fields_rules->{$field->tag()};
684
                my $data_field_rules = $data_fields_rules->{$field->tag()};
670
                if ($data_field_rules) {
685
                if ($data_field_rules) {
671
                    my $subfields_mappings = $data_field_rules->{subfields};
686
                    my $subfields_mappings = $data_field_rules->{subfields};
(-)a/installer/data/mysql/atomicupdate/bug_34481.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "34481",
5
    description => "Add IncludeSeeAlsoFromInSearches like IncludeSeeFromInSearches",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{
11
            INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`)
12
            VALUES ('IncludeSeeAlsoFromInSearches','0','','Include see-also-from references in searches.','YesNo')
13
        });
14
15
        say $out "Added new system preference 'IncludeSeeAlsoFromInSearches'";
16
    },
17
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 327-332 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
327
('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),
327
('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),
328
('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'),
328
('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'),
329
('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo'),
329
('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo'),
330
('IncludeSeeAlsoFromInSearches','0','','Include see-also-from references in searches.','YesNo'),
330
('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'),
331
('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'),
331
('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
332
('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
332
('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'),
333
('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (+7 lines)
Lines 66-71 Searching: Link Here
66
                  1: Include
66
                  1: Include
67
                  0: "Don't include"
67
                  0: "Don't include"
68
            - "<em>see from</em> (non-preferred form) headings in bibliographic searches. Please note: you will need to reindex your bibliographic database when changing this preference."
68
            - "<em>see from</em> (non-preferred form) headings in bibliographic searches. Please note: you will need to reindex your bibliographic database when changing this preference."
69
        -
70
            - pref: IncludeSeeAlsoFromInSearches
71
              default: 0
72
              choices:
73
                  1: Include
74
                  0: "Don't include"
75
            - "<em>see also from</em> headings in bibliographic searches. Please note: you will need to reindex your bibliographic database when changing this preference."
69
        -
76
        -
70
            - pref: EnableSearchHistory
77
            - pref: EnableSearchHistory
71
              default: 0
78
              default: 0
(-)a/misc/migration_tools/rebuild_zebra.pl (-4 / +18 lines)
Lines 660-670 sub get_corrected_marc_record { Link Here
660
        elsif ( $record_type eq 'biblio' ) {
660
        elsif ( $record_type eq 'biblio' ) {
661
661
662
            my @filters;
662
            my @filters;
663
            my @other_headings;
663
            push @filters, 'EmbedItemsAvailability';
664
            push @filters, 'EmbedItemsAvailability';
664
            push @filters, 'EmbedSeeFromHeadings'
665
            if ( C4::Context->preference('IncludeSeeFromInSearches') || C4::Context->preference('IncludeSeeAlsoFromInSearches') ){
665
                if C4::Context->preference('IncludeSeeFromInSearches');
666
                push @filters, 'EmbedSeeFromHeadings';
667
                if ( C4::Context->preference('IncludeSeeFromInSearches') ) {
668
                    push @other_headings, 'see_from';
669
                }
670
                if ( C4::Context->preference('IncludeSeeAlsoFromInSearches') ) {
671
                    push @other_headings, 'see_also_from';
672
                }
673
            }
666
674
667
            my $normalizer = Koha::RecordProcessor->new( { filters => \@filters } );
675
            my $normalizer = Koha::RecordProcessor->new(
676
                {
677
                    filters => \@filters,
678
                    options => {
679
                        other_headings => \@other_headings
680
                    }
681
                }
682
            );
668
            $marc = $normalizer->process($marc);
683
            $marc = $normalizer->process($marc);
669
        }
684
        }
670
        if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
685
        if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
671
- 

Return to bug 34481