X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FRecord.pm;h=9d72d5acfae15f312a0877c3c8af1690052775dd;hb=568f32606c2c9c247b2b477193a2d6814f738fa6;hp=f75195fdaf069e3fc1709459a237fef931f8b888;hpb=6760dc0f17883ee031956c22daa1dfa8722d208b;p=koha.git diff --git a/C4/Record.pm b/C4/Record.pm index f75195fdaf..9d72d5acfa 100644 --- a/C4/Record.pm +++ b/C4/Record.pm @@ -310,9 +310,9 @@ sub _transformWithStylesheet { my $xslt = XML::LibXSLT->new(); my $source = $parser->parse_string($xmlrecord); my $style_doc = $parser->parse_file($xslfile); - my $stylesheet = $xslt->parse_stylesheet($style_doc); - my $results = $stylesheet->transform($source); - my $newxmlrecord = $stylesheet->output_string($results); + my $style_sheet = $xslt->parse_stylesheet($style_doc); + my $results = $style_sheet->transform($source); + my $newxmlrecord = $style_sheet->output_string($results); return ($newxmlrecord); } @@ -461,7 +461,7 @@ sub marcrecord2csv { $csv->sep_char($csvseparator); # Getting the marcfields - my $marcfieldslist = $profile->{marcfields}; + my $marcfieldslist = $profile->{content}; # Getting the marcfields as an array my @marcfieldsarray = split('\|', $marcfieldslist); @@ -647,18 +647,30 @@ C<$id> - an id for the BibTex record (might be the biblionumber) sub marc2bibtex { my ($record, $id) = @_; my $tex; + my $marcflavour = C4::Context->preference("marcflavour"); # Authors - my $marcauthors = GetMarcAuthors($record,C4::Context->preference("marcflavour")); my $author; - for my $authors ( map { map { @$_ } values %$_ } @$marcauthors ) { - $author .= " and " if ($author && $$authors{value}); - $author .= $$authors{value} if ($$authors{value}); + my @texauthors; + my @authorFields = ('100','110','111','700','710','711'); + @authorFields = ('700','701','702','710','711','721') if ( $marcflavour eq "UNIMARC" ); + + foreach my $field ( @authorFields ) { + # author formatted surname, firstname + my $texauthor = ''; + if ( $marcflavour eq "UNIMARC" ) { + $texauthor = join ', ', + ( $record->subfield($field,"a"), $record->subfield($field,"b") ); + } else { + $texauthor = $record->subfield($field,"a"); + } + push @texauthors, $texauthor if $texauthor; } + $author = join ' and ', @texauthors; # Defining the conversion hash according to the marcflavour my %bh; - if (C4::Context->preference("marcflavour") eq "UNIMARC") { + if ( $marcflavour eq "UNIMARC" ) { # FIXME, TODO : handle repeatable fields # TODO : handle more types of documents @@ -704,7 +716,7 @@ sub marc2bibtex { } $tex .= "\@book{"; - $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = "$bh{$_}") : () } keys %bh); + $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = {$bh{$_}}) : () } keys %bh); $tex .= "\n}\n"; return $tex;