From cb2b85ccd163d7f54e336057d2a7b6db0d0b1ac6 Mon Sep 17 00:00:00 2001 From: Jared CAMINS-ESAKOV Date: Mon, 12 Apr 2010 09:56:39 -0400 Subject: [PATCH 1/3] Begin work on COinS Content-Type: text/plain; charset="utf-8" Begin work on improving COinS support. It still doesn't work right, but at least it seems to be following the standard now. --- C4/Biblio.pm | 83 ++++++++++++++++++++++++++++++---------------------------- 1 files changed, 43 insertions(+), 40 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index e24bee8..f2e506b 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1163,50 +1163,56 @@ sub GetCOinSBiblio { my $isbn = ''; my $issn = ''; my $publisher = ''; - - if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) { - my $fmts6; - my $fmts7; - %$fmts6 = ( - 'a' => 'book', - 'b' => 'manuscript', - 'c' => 'book', - 'd' => 'manuscript', - 'e' => 'map', - 'f' => 'map', - 'g' => 'film', - 'i' => 'audioRecording', - 'j' => 'audioRecording', - 'k' => 'artwork', - 'l' => 'document', - 'm' => 'computerProgram', - 'r' => 'document', - - ); - %$fmts7 = ( - 'a' => 'journalArticle', - 's' => 'journal', - ); - - $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book'; - - if ( $genre eq 'book' ) { + my $titletype = 'b'; + + # For the purposes of generating COinS metadata, LDR/06-07 can be + # considered the same for UNIMARC and MARC21 + my $fmts6; + my $fmts7; + %$fmts6 = ( + 'a' => 'book', + 'b' => 'manuscript', + 'c' => 'book', + 'd' => 'manuscript', + 'e' => 'map', + 'f' => 'map', + 'g' => 'film', + 'i' => 'audioRecording', + 'j' => 'audioRecording', + 'k' => 'artwork', + 'l' => 'document', + 'm' => 'computerProgram', + 'o' => 'document', + 'r' => 'document', + ); + %$fmts7 = ( + 'a' => 'journalArticle', + 's' => 'journal', + ); + + $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book'; + + if ( $genre eq 'book' ) { $genre = $fmts7->{$pos7} if $fmts7->{$pos7}; - } + } - ##### We must transform mtx to a valable mtx and document type #### - if ( $genre eq 'book' ) { + ##### We must transform mtx to a valable mtx and document type #### + if ( $genre eq 'book' ) { $mtx = 'book'; - } elsif ( $genre eq 'journal' ) { + } elsif ( $genre eq 'journal' ) { $mtx = 'journal'; - } elsif ( $genre eq 'journalArticle' ) { + $titletype = 'j'; + } elsif ( $genre eq 'journalArticle' ) { $mtx = 'journal'; $genre = 'article'; - } else { + $titletype = 'a'; + } else { $mtx = 'dc'; - } + } + + $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre"; - $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre"; + if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) { # Setting datas $aulast = $record->subfield( '700', 'a' ); @@ -1230,9 +1236,6 @@ sub GetCOinSBiblio { } else { # MARC21 need some improve - my $fmts; - $mtx = 'book'; - $genre = "&rft.genre=book"; # Setting datas if ( $record->field('100') ) { @@ -1245,7 +1248,7 @@ sub GetCOinSBiblio { $oauthors .= "&rft.au=$au"; } } - $title = "&rft.btitle=" . $record->subfield( '245', 'a' ); + $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' ); $subtitle = $record->subfield( '245', 'b' ) || ''; $title .= $subtitle; $pubyear = $record->subfield( '260', 'c' ) || ''; -- 1.7.0.4