From f7be35d2637adb550f499c65c8722eb316c4a796 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Thu, 1 Sep 2011 18:57:20 +1200 Subject: [PATCH] Bug 6129 - [master] 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 --- C4/Biblio.pm | 6 ++++-- basket/basket.pl | 4 ++-- catalogue/detail.pl | 10 ++++++++-- .../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 96baaef..ddae223 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1624,7 +1624,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) @@ -1632,7 +1632,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') ) { @@ -1642,6 +1642,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 8fc15e4..90c4cf8 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 8738737..ac94cc0 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 d4f763f..c8d8c3b 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 5e92d15..e56509e 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 e18e046..8511456 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( -- 1.7.4.1