Lines 647-664
C<$id> - an id for the BibTex record (might be the biblionumber)
Link Here
|
647 |
sub marc2bibtex { |
647 |
sub marc2bibtex { |
648 |
my ($record, $id) = @_; |
648 |
my ($record, $id) = @_; |
649 |
my $tex; |
649 |
my $tex; |
|
|
650 |
my $marcflavour = C4::Context->preference("marcflavour"); |
650 |
|
651 |
|
651 |
# Authors |
652 |
# Authors |
652 |
my $marcauthors = GetMarcAuthors($record,C4::Context->preference("marcflavour")); |
|
|
653 |
my $author; |
653 |
my $author; |
654 |
for my $authors ( map { map { @$_ } values %$_ } @$marcauthors ) { |
654 |
my @texauthors; |
655 |
$author .= " and " if ($author && $$authors{value}); |
655 |
my ( $mintag, $maxtag, $fields_filter ); |
656 |
$author .= $$authors{value} if ($$authors{value}); |
656 |
if ( $marcflavour eq "UNIMARC" ) { |
|
|
657 |
$mintag = "700"; |
658 |
$maxtag = "712"; |
659 |
$fields_filter = '7..'; |
657 |
} |
660 |
} |
658 |
|
661 |
else { |
|
|
662 |
$mintag = "700"; |
663 |
$maxtag = "720"; |
664 |
$fields_filter = '7..'; |
665 |
} |
666 |
foreach my $field ( $record->field($fields_filter) ) { |
667 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
668 |
my $texauthor = join ' ', ( |
669 |
$field->subfield('b'), |
670 |
$field->subfield('a'), |
671 |
); |
672 |
push @texauthors, $texauthor if $texauthor; |
673 |
} |
674 |
$author = join ' and ', @texauthors; |
675 |
|
659 |
# Defining the conversion hash according to the marcflavour |
676 |
# Defining the conversion hash according to the marcflavour |
660 |
my %bh; |
677 |
my %bh; |
661 |
if (C4::Context->preference("marcflavour") eq "UNIMARC") { |
678 |
if ( $marcflavour eq "UNIMARC" ) { |
662 |
|
679 |
|
663 |
# FIXME, TODO : handle repeatable fields |
680 |
# FIXME, TODO : handle repeatable fields |
664 |
# TODO : handle more types of documents |
681 |
# TODO : handle more types of documents |
665 |
- |
|
|