From e9a02522d8254f8d16f8f5a6579bfc98a5b5af7f Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 2 Nov 2009 12:46:11 +0100 Subject: [PATCH] Fix 3741 : Amazon cover image not displayed Opac detail page would not show amazon cover image any longer --- C4/Auth.pm | 1 + .../prog/en/modules/opac-detail.tmpl | 2 +- opac/opac-detail.pl | 55 +++++-------------- 3 files changed, 15 insertions(+), 43 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index dc328c482a..973197a2f7 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -310,6 +310,7 @@ sub get_template_and_user { } $template->param( OPACAmazonContent => "" . C4::Context->preference("OPACAmazonContent"), + OPACAmazonCoverImages => "" . C4::Context->preference("OPACAmazonCoverImages"), AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), LibraryName => "" . C4::Context->preference("LibraryName"), diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index e22cfa9ab5..070f9c3621 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -69,7 +69,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
- /gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank">.01.MZZZZZZZ.jpg" alt="Cover Image" />/gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link">.01.MZZZZZZZ.jpg" alt="Cover Image" /> + /gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank">.01.MZZZZZZZ.jpg" alt="Cover Image" />/gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link">.01.MZZZZZZZ.jpg" alt="Cover Image" /> /.GIF&client=&type=xw10&upc=&oclc=" alt="" class="thumbnail" />No cover image available
" class="" id="gbs-thumbnail">
" target="_blank">See Baker & Taylor" />">See Baker & Taylor" /> diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index a95329f0cb..0fec800d03 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -176,14 +176,18 @@ for my $itm (@items) { ## get notes and subjects from MARC record my $dbh = C4::Context->dbh; my $marcflavour = C4::Context->preference("marcflavour"); -my $marcnotesarray = GetMarcNotes ($record,$marcflavour); -my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); -my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour); -my $marcseriesarray = GetMarcSeries ($record,$marcflavour); -my $marcurlsarray = GetMarcUrls ($record,$marcflavour); +my $normalized_isbn = GetNormalizedISBN($dat->{isbn},$record,$marcflavour); +my $marcnotesarray = GetMarcNotes ($record,$marcflavour); +my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); +my $marcsubjctsarray = GetMarcSubjects ($record,$marcflavour); +my $marcseriesarray = GetMarcSeries ($record,$marcflavour); +my $marcurlsarray = GetMarcUrls ($record,$marcflavour); my $subtitle = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $record, ''); $template->param( + normalized_oclc => GetNormalizedOCLCNumber($record,$marcflavour), + normalized_upc => GetNormalizedUPC ($record,$marcflavour), + normalized_isbn => $normalized_isbn, MARCNOTES => $marcnotesarray, MARCSUBJCTS => $marcsubjctsarray, MARCAUTHORS => $marcauthorsarray, @@ -241,36 +245,13 @@ $template->param( loggedincommenter => $loggedincommenter ); -sub isbn_cleanup ($) { - my $isbn=shift; - ($isbn) = $isbn =~ /([\d-]*[X]*)/; - $isbn =~ s/-//g; - if ( - $isbn =~ /\b(\d{13})\b/ or - $isbn =~ /\b(\d{10})\b/ or - $isbn =~ /\b(\d{9}X)\b/i - ) { - return $1; - } - return undef; -} # XISBN Stuff -my $xisbn=$dat->{'isbn'}; -(my $aisbn) = $xisbn =~ /([\d-]*[X]*)/; -$aisbn =~ s/-//g; -$template->param(amazonisbn => $aisbn); # FIXME: so it is OK if the ISBN = 'XXXXX' ? -my ($clean,$clean2); -# these might be overkill, but they are better than the regexp above. -if ($clean = isbn_cleanup($xisbn)){ - $template->param(clean_isbn => $clean); -} if (C4::Context->preference("OPACFRBRizeEditions")==1) { eval { $template->param( - xisbn => $xisbn, - XISBNS => get_xisbns($xisbn) + XISBNS => get_xisbns($normalized_isbn) ); }; if ($@) { warn "XISBN Failed $@"; } @@ -284,7 +265,7 @@ if ( C4::Context->preference("OPACAmazonEnabled") && C4::Context->preference("OP my $amazon_reviews = C4::Context->preference("AmazonReviews"); my $amazon_similars = C4::Context->preference("AmazonSimilarItems"); my @services; - my $amazon_details = &get_amazon_details( $dat->{isbn}, $record, $marcflavour, \@services ); + my $amazon_details = &get_amazon_details( $normalized_isbn, $record, $marcflavour, \@services ); if ( $amazon_reviews ) { @@ -373,11 +354,6 @@ if (C4::Context->preference("OPACShelfBrowser")) { $sth_get_biblio->execute($this_item->{biblionumber}); while (my $this_biblio = $sth_get_biblio->fetchrow_hashref()) { $this_item->{'title'} = $this_biblio->{'title'}; - if ($clean2 = isbn_cleanup($this_biblio->{'isbn'})) { - $this_item->{'isbn'} = $clean2; - } else { - $this_item->{'isbn'} = $this_biblio->{'isbn'}; - } } unshift @previous_items, $this_item; } @@ -412,11 +388,6 @@ if (C4::Context->preference("OPACShelfBrowser")) { $sth_get_biblio->execute($this_item->{biblionumber}); while (my $this_biblio = $sth_get_biblio->fetchrow_hashref()) { $this_item->{'title'} = $this_biblio->{'title'}; - if ($clean2 = isbn_cleanup($this_biblio->{'isbn'})) { - $this_item->{'isbn'} = $clean2; - } else { - $this_item->{'isbn'} = $this_biblio->{'isbn'}; - } } push @next_items, $this_item; } @@ -447,14 +418,14 @@ if (C4::Context->preference("BakerTaylorEnabled")) { BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'), ); my ($bt_user, $bt_pass); - if ($clean and + if ($normalized_isbn and $bt_user = C4::Context->preference('BakerTaylorUsername') and $bt_pass = C4::Context->preference('BakerTaylorPassword') ) { $template->param( BakerTaylorContentURL => sprintf("http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y", - $bt_user,$bt_pass,$clean) + $bt_user,$bt_pass,$normalized_isbn) ); } } -- 2.39.5