From 1c2adfe7ffcca15eb59069d74b6d151beecc3d36 Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Fri, 12 Oct 2007 03:05:34 -0500 Subject: [PATCH] adding GetMarcUrls() fcn to display 856's - adding also output to opac-detail. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 42 +++++++++++++++++++- koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl | 20 ++++++---- opac/opac-detail.pl | 4 +- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index b142ad8f5a..f99ca5dd94 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -65,6 +65,7 @@ push @EXPORT, qw( &GetMarcBiblio &GetMarcAuthors &GetMarcSeries + GetMarcUrls &GetUsedMarcStructure &GetItemsInfo @@ -1922,11 +1923,50 @@ sub GetMarcAuthors { return \@marcauthors; } +=head2 GetMarcUrls + +=over 4 + +$marcurls = GetMarcUrls($record,$marcflavour); +Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop. +Assumes web resources (not uncommon in MARC21 to omit resource type ind) + +=back + +=cut + +sub GetMarcUrls { + my ($record, $marcflavour) = @_; + my @marcurls; + my $marcurl; + for my $field ($record->field('856')) { + my $url = $field->subfield('u'); + my @notes; + for my $note ( $field->subfield('z')) { + push @notes , {note => $note}; + } + $marcurl = { MARCURL => $url, + notes => \@notes, + }; + if($marcflavour eq 'MARC21') { + my $s3 = $field->subfield('3'); + my $link = $field->subfield('y'); + $marcurl->{'linktext'} = $link || $s3 || $url ;; + $marcurl->{'part'} = $s3 if($link); + $marcurl->{'toc'} = 1 if($s3 =~ /^[Tt]able/) ; + } else { + $marcurl->{'linktext'} = $url; + } + push @marcurls, $marcurl; + } + return \@marcurls; +} #end GetMarcUrls + =head2 GetMarcSeries =over 4 -$marcseriessarray = GetMarcSeries($record,$marcflavour); +$marcseriesarray = GetMarcSeries($record,$marcflavour); Get all series from the MARC record and returns them in an array. The series are stored in differents places depending on MARC flavour diff --git a/koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl index bea2e84b16..e31277d15b 100644 --- a/koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl @@ -148,13 +148,6 @@

- -

- - "> |  - -

-

@@ -162,6 +155,19 @@

+ + +

+

    +
  • +
    + + "> +
  • +
+

+ + diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 90e0fbc27c..293327865f 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -99,12 +99,14 @@ $template->param( norequests => $norequests, RequestOnOpac=>$RequestOnOpac ); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $marcseriesarray = GetMarcSeries($record,$marcflavour); + my $marcurlsarray = GetMarcUrls($record,$marcflavour); $template->param( MARCNOTES => $marcnotesarray, MARCSUBJCTS => $marcsubjctsarray, MARCAUTHORS => $marcauthorsarray, - MARCSERIES => $marcseriesarray + MARCSERIES => $marcseriesarray, + MARCURLS => $marcurlsarray, ); my @results = ( $dat, ); -- 2.39.2