From aa2284e1113cb74b94c7da2fa43e423b690a9566 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Mon, 5 Sep 2011 12:19:50 +1200 Subject: [PATCH] Bug 6129 - [3.4.x] this adds an ISSN to serialssolutions URLs If a URL is a serialssolutions URLs that doesn't already have an ISSN parameter, this adds one on the OPAC. Author: Srdjan Jankovic Author: Robin Sheat Signed-off-by: Chris Nighswonger --- C4/Biblio.pm | 6 ++++-- basket/basket.pl | 4 ++-- catalogue/detail.pl | 10 ++++++++-- .../opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl | 5 ++++- opac/opac-basket.pl | 2 +- opac/opac-detail.pl | 12 ++++++------ 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 808955dab8..ad9b9f8f75 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1606,7 +1606,7 @@ sub GetMarcAuthors { =head2 GetMarcUrls - $marcurls = GetMarcUrls($record,$marcflavour); + $marcurls = GetMarcUrls($record,$marcflavour,$issn); 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) @@ -1614,7 +1614,7 @@ Assumes web resources (not uncommon in MARC21 to omit resource type ind) =cut sub GetMarcUrls { - my ( $record, $marcflavour ) = @_; + my ( $record, $marcflavour, $issn ) = @_; my @marcurls; for my $field ( $record->field('856') ) { @@ -1624,6 +1624,8 @@ sub GetMarcUrls { } my @urls = $field->subfield('u'); foreach my $url (@urls) { + $url .= "?sid=&ISSN=$issn" + if $issn && ($url =~ m/\bserialssolutions\b/o) && ($url !~ m/\bISSN=/o); my $marcurl; if ( $marcflavour eq 'MARC21' ) { my $s3 = $field->subfield('3'); diff --git a/basket/basket.pl b/basket/basket.pl index 8fc15e4b73..90c4cf88c3 100755 --- a/basket/basket.pl +++ b/basket/basket.pl @@ -65,8 +65,8 @@ foreach my $biblionumber ( @bibs ) { my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $marcseriesarray = GetMarcSeries ($record,$marcflavour); - my $marcurlsarray = GetMarcUrls ($record,$marcflavour); - my @items = GetItemsInfo( $biblionumber ); + my $marcurlsarray = GetMarcUrls ($record,$marcflavour,$dat->{issn}); + my @items = GetItemsInfo( $biblionumber, 'opac' ); my $hasauthors = 0; if($dat->{'author'} || @$marcauthorsarray) { diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 87387375e7..ac94cc08ed 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -99,12 +99,19 @@ $template->param( normalized_isbn => $isbn, ); +unless (defined($record)) { + print $query->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} + +my $dat = &GetBiblioData($biblionumber); + my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); my $marcisbnsarray = GetMarcISBN( $record, $marcflavour ); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $marcseriesarray = GetMarcSeries($record,$marcflavour); -my $marcurlsarray = GetMarcUrls ($record,$marcflavour); +my $marcurlsarray = GetMarcUrls ($record,$marcflavour,$dat->{issn}); my $subtitle = GetRecordValue('subtitle', $record, $fw); # Get Branches, Itemtypes and Locations @@ -117,7 +124,6 @@ my @items; for my $itm (@all_items) { push @items, $itm unless ( $itm->{itemlost} && GetHideLostItemsPreference($borrowernumber) && !$showallitems); } -my $dat = &GetBiblioData($biblionumber); # get count of holds my ( $holdcount, $holds ) = GetReservesFromBiblionumber($biblionumber,1); diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index d4f763f8b2..c8d8c3bf1c 100755 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -436,6 +436,7 @@ + @@ -539,7 +540,9 @@ Online Resources: - + + + ?sid=&ISSN= _blank diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index 5e92d15a77..e56509e611 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -67,7 +67,7 @@ foreach my $biblionumber ( @bibs ) { my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $marcseriesarray = GetMarcSeries ($record,$marcflavour); - my $marcurlsarray = GetMarcUrls ($record,$marcflavour); + my $marcurlsarray = GetMarcUrls ($record,$marcflavour,$dat->{issn}); my @items = &GetItemsLocationInfo( $biblionumber ); my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6345da1c98..2198bea48e 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -97,12 +97,12 @@ my $hideitems = 1 if C4::Context->preference('hidelostitems') or scalar(@hiddeni # Hide items if ($hideitems) { for my $itm (@all_items) { - if ( C4::Context->preference('hidelostitems') ) { - push @items, $itm unless $itm->{itemlost} or any { $itm->{'itemnumber'} eq $_ } @hiddenitems; - } else { - push @items, $itm unless any { $itm->{'itemnumber'} eq $_ } @hiddenitems; + if ( C4::Context->preference('hidelostitems') ) { + push @items, $itm unless $itm->{itemlost} or any { $itm->{'itemnumber'} eq $_ } @hiddenitems; + } else { + push @items, $itm unless any { $itm->{'itemnumber'} eq $_ } @hiddenitems; + } } -} } else { # Or not @items = @all_items; @@ -223,7 +223,7 @@ my $marcisbnsarray = GetMarcISBN ($record,$marcflavour); my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour); my $marcseriesarray = GetMarcSeries ($record,$marcflavour); -my $marcurlsarray = GetMarcUrls ($record,$marcflavour); +my $marcurlsarray = GetMarcUrls ($record,$marcflavour,$dat->{issn}); my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); $template->param( -- 2.39.5