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 648-655 sub marc_records_to_documents { Link Here
648
            }
648
            }
649
        }
649
        }
650
650
651
        if (C4::Context->preference('IncludeSeeFromInSearches') and $self->index eq 'biblios') {
651
        if ( $self->index eq $BIBLIOS_INDEX and ( C4::Context->preference('IncludeSeeFromInSearches') || C4::Context->preference('IncludeSeeAlsoFromInSearches') ) ) {
652
            foreach my $field (Koha::Filter::MARC::EmbedSeeFromHeadings->new->fields($record)) {
652
            my $marc_filter = Koha::Koha::Filter::MARC::EmbedSeeFromHeadings->new;
653
            my @other_headings;
654
            if ( C4::Context->preference('IncludeSeeFromInSearches') ) {
655
                push @other_headings, 'see_from';
656
            }
657
            if ( C4::Context->preference('IncludeSeeAlsoFromInSearches') ) {
658
                push @other_headings, 'see_also_from';
659
            }
660
            $marc_filter->initialize(
661
                {
662
                    options => {
663
                        other_headings => \@other_headings
664
                    }
665
                }
666
            );
667
            foreach my $field ($marc_filter->fields($record)) {
653
                my $data_field_rules = $data_fields_rules->{$field->tag()};
668
                my $data_field_rules = $data_fields_rules->{$field->tag()};
654
                if ($data_field_rules) {
669
                if ($data_field_rules) {
655
                    my $subfields_mappings = $data_field_rules->{subfields};
670
                    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 318-323 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
318
('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),
318
('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),
319
('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'),
319
('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'),
320
('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo'),
320
('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo'),
321
('IncludeSeeAlsoFromInSearches','0','','Include see-also-from references in searches.','YesNo'),
321
('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'),
322
('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'),
322
('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
323
('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
323
('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'),
324
('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 65-70 Searching: Link Here
65
                  1: Include
65
                  1: Include
66
                  0: "Don't include"
66
                  0: "Don't include"
67
            - "<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."
67
            - "<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
        -
69
            - pref: IncludeSeeAlsoFromInSearches
70
              default: 0
71
              choices:
72
                  1: Include
73
                  0: "Don't include"
74
            - "<em>see also from</em> headings in bibliographic searches. Please note: you will need to reindex your bibliographic database when changing this preference."
68
        -
75
        -
69
            - pref: EnableSearchHistory
76
            - pref: EnableSearchHistory
70
              default: 0
77
              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