Bugzilla – Attachment 15600 Details for
Bug 9274
Software error in bibtex export
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 9274: Software error in bibtex export
SIGNED-OFF-Bug-9274-Software-error-in-bibtex-expor.patch (text/plain), 3.22 KB, created by
Bernardo Gonzalez Kriegel
on 2013-02-21 20:38:12 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 9274: Software error in bibtex export
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2013-02-21 20:38:12 UTC
Size:
3.22 KB
patch
obsolete
>From 8622704a9f5eb2c62dd341ab477b6364fb18a123 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Wed, 12 Dec 2012 15:47:55 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 9274: Software error in bibtex export > >Exporting to Bibtex from OPAC returns a software error. >This is because call to C4::Biblio::GetMarcAuthors does not return only authors but also authority link. >This patch replaces this call by a direct read of MARC::Record, like for other Bibtex datas. >C4::Biblio::GetMarcAuthors is really destinated to a direct use in a template. >Also, actually all author subfields are joined with 'and'. According to Bibtext format, authors should be "firstname surname and ..." or "surname, firstname and ...". I have choosen second one because in non-UNIMARC it corresponds to $a content. > >For example UNIMARC : >700 $aDoe $bJohn >700 $aDoe $bJanne >Gives : Doe, John and Doe, Janne >For example MARC21 : >700 $aDoe, John >700 $aDoe, Janne >Gives : Doe, John and Doe, Janne > >Test plan : >Without patch : >Exporting to Bibtex from OPAC returns a software error. >With patch : >Exporting to Bibtex from OPAC succeeds. >Authors are composed using : $a, $b and ... for UNIMARC, $a ... for other marc flavours. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >Comment: Works as decribed. All record export that produces >error pre-patch, now export without error. >No koha-qa errors >--- > C4/Record.pm | 32 +++++++++++++++++++++++++++----- > 1 file changed, 27 insertions(+), 5 deletions(-) > >diff --git a/C4/Record.pm b/C4/Record.pm >index f75195f..be1912c 100644 >--- a/C4/Record.pm >+++ b/C4/Record.pm >@@ -647,18 +647,40 @@ 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 ( $mintag, $maxtag, $fields_filter ); >+ if ( $marcflavour eq "UNIMARC" ) { >+ $mintag = "700"; >+ $maxtag = "712"; >+ $fields_filter = '7..'; > } >+ else { >+ $mintag = "700"; >+ $maxtag = "720"; >+ $fields_filter = '7..'; >+ } >+ foreach my $field ( $record->field($fields_filter) ) { >+ next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; >+ # author formatted surname, firstname >+ my $texauthor = ''; >+ if ( $marcflavour eq "UNIMARC" ) { >+ $texauthor = join ', ', >+ ( $field->subfield('a'), $field->subfield('b') ); >+ } >+ else { >+ $texauthor = $field->subfield('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 >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9274
:
14041
|
14387
|
14631
|
14693
|
15527
|
15600
|
17059