'', '', "a" => "" . $field->subfield('a') );
map {
$authfield->add_subfields( $_->[0] => $_->[1] )
- if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a" )
+ if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a"
+ && C4::Heading::valid_bib_heading_subfield(
+ $authority_type->auth_tag_to_report, $_->[0] )
+ );
} $field->subfields();
$marcrecordauth->insert_fields_ordered($authfield);
$sth->execute(
$frameworkcode, $biblio->{'author'}, $biblio->{'title'}, $biblio->{'unititle'}, $biblio->{'notes'},
- $biblio->{'serial'}, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}, $biblio->{'biblionumber'}
+ $biblio->{'serial'}, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'} ? int($biblio->{'copyrightdate'}) : undef, $biblio->{'abstract'}, $biblio->{'biblionumber'}
) if $biblio->{'biblionumber'};
if ( $dbh->errstr || !$biblio->{'biblionumber'} ) {
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
+use Modern::Perl;
+
use strict;
use warnings;
use 5.010;
return $results;
}
+=head2 valid_bib_heading_subfield
+
+ if (C4::Heading::valid_bib_heading_subfield('100', 'e', '')) ...
+
+=cut
+
+sub valid_bib_heading_subfield {
+ my $tag = shift;
+ my $subfield = shift;
+ my $marcflavour = @_ ? shift : C4::Context->preference('marcflavour');
+
+ my $marc_handler = _marc_format_handler($marcflavour);
+
+ return $marc_handler->valid_bib_heading_subfield( $tag, $subfield );
+}
+
=head1 INTERNAL METHODS
=head2 _search
}
+=head2 valid_bib_heading_subfield
+
+=cut
+
+sub valid_bib_heading_subfield {
+ my $self = shift;
+ my $tag = shift;
+ my $subfield = shift;
+
+ if ( exists $bib_heading_fields->{$tag} ) {
+ return 1 if ($bib_heading_fields->{$tag}->{subfields} =~ /$subfield/);
+ }
+ return 0;
+}
+
=head2 parse_heading
=cut