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

(-)a/C4/Heading/UNIMARC.pm (-6 / +29 lines)
Lines 55-60 my %subdivisions = ( Link Here
55
);
55
);
56
56
57
my $bib_heading_fields;
57
my $bib_heading_fields;
58
my $auth_heading_fields;
58
59
59
=head1 METHODS
60
=head1 METHODS
60
61
Lines 84-89 sub new { Link Here
84
        }
85
        }
85
    }
86
    }
86
87
88
    unless ( defined $auth_heading_fields ) {
89
        my $dbh = C4::Context->dbh;
90
        my $sth = $dbh->prepare(
91
            "SELECT tagfield, authtypecode
92
             FROM auth_tag_structure
93
             WHERE authtypecode <> ''"
94
        );
95
        $sth->execute();
96
        $auth_heading_fields = {};
97
        while ( my ( $tag, $auth_type ) = $sth->fetchrow ) {
98
            $auth_heading_fields->{$tag} = {
99
                auth_type => $auth_type,
100
                subfields => 'abcdefghjklmnopqrstvxyz',
101
            };
102
        }
103
    }
104
87
    return bless {}, $class;
105
    return bless {}, $class;
88
}
106
}
89
107
Lines 92-99 sub new { Link Here
92
=cut
110
=cut
93
111
94
sub valid_heading_tag {
112
sub valid_heading_tag {
95
    my ( $self, $tag ) = @_;
113
    my ( $self, $tag, $frameworkcode, $auth ) = @_;
96
    return $bib_heading_fields->{$tag};
114
    unless ($auth) {
115
        return $bib_heading_fields->{$tag};
116
    } else {
117
        return $auth_heading_fields->{$tag};
118
    }
97
}
119
}
98
120
99
=head2 valid_heading_subfield
121
=head2 valid_heading_subfield
Lines 116-125 sub valid_heading_subfield { Link Here
116
=cut
138
=cut
117
139
118
sub parse_heading {
140
sub parse_heading {
119
    my ( $self, $field ) = @_;
141
    my ( $self, $field, $auth ) = @_;
142
143
    my $tag            = $field->tag;
144
    my $heading_fields = $auth ? {%$auth_heading_fields} : {%$bib_heading_fields};
145
    my $field_info     = $heading_fields->{$tag};
120
146
121
    my $tag             = $field->tag;
122
    my $field_info      = $bib_heading_fields->{$tag};
123
    my $auth_type       = $field_info->{'auth_type'};
147
    my $auth_type       = $field_info->{'auth_type'};
124
    my $search_heading  = _get_search_heading( $field, $field_info->{'subfields'} );
148
    my $search_heading  = _get_search_heading( $field, $field_info->{'subfields'} );
125
    my $display_heading = _get_display_heading( $field, $field_info->{'subfields'} );
149
    my $display_heading = _get_display_heading( $field, $field_info->{'subfields'} );
126
- 

Return to bug 40578