From 5d01574d431a6b04214009b93a29c9b16122b617 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Sat, 9 Aug 2008 08:01:14 -0500 Subject: [PATCH] Bug 2410: Can't use string ("0") as an ARRAY ref while "strict refs" in use at detail.pl line 219 Thanks to HDL for your patch, I couldn't get it to apply so I did it manually No change to documentation --- C4/XISBN.pm | 5 +---- catalogue/detail.pl | 6 ++++-- opac/opac-detail.pl | 6 ++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/C4/XISBN.pm b/C4/XISBN.pm index 11bc2c77a3..50acc11876 100644 --- a/C4/XISBN.pm +++ b/C4/XISBN.pm @@ -49,10 +49,7 @@ sub get_biblionumber_from_isbn { my $query = "SELECT biblionumber FROM biblioitems WHERE isbn LIKE ? LIMIT 10"; my $sth = $dbh->prepare($query); $sth->execute($isbn); - while ( my $biblionumber = $sth->fetchrow_hashref() ) { - push (@biblionumbers, $biblionumber); - } - return \@biblionumbers; + return $sth->fetchall_arrayref({}); } =head1 NAME diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 091a1ea7ac..7dd96dd377 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -209,8 +209,10 @@ if ( C4::Context->preference("AmazonContent") == 1 ) { # do we have any of these isbns in our collection? my $similar_biblionumbers = get_biblionumber_from_isbn($similar_product->{ASIN}); # verify that there is at least one similar item - $similar_products_exist++ if ${@$similar_biblionumbers}[0]; - push @similar_products, +{ similar_biblionumbers => $similar_biblionumbers, title => $similar_product->{Title}, ASIN => $similar_product->{ASIN} }; + if (scalar(@$similar_biblionumbers)){ + $similar_products_exist++ if ($similar_biblionumbers && $similar_biblionumbers->[0]); + push @similar_products, +{ similar_biblionumbers => $similar_biblionumbers, title => $similar_product->{Title}, ASIN => $similar_product->{ASIN} }; + } } my $editorial_reviews = \@{$amazon_details->{Items}->{Item}->{EditorialReviews}->{EditorialReview}}; my $average_rating = $amazon_details->{Items}->{Item}->{CustomerReviews}->{AverageRating}; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 05114d3993..6f6b7cab71 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -282,8 +282,10 @@ if ( C4::Context->preference("OPACAmazonContent") == 1 ) { # do we have any of these isbns in our collection? my $similar_biblionumbers = get_biblionumber_from_isbn($similar_product->{ASIN}); # verify that there is at least one similar item - $similar_products_exist++ if ${@$similar_biblionumbers}[0]; - push @similar_products, +{ similar_biblionumbers => $similar_biblionumbers, title => $similar_product->{Title}, ASIN => $similar_product->{ASIN} }; + if (scalar(@$similar_biblionumbers)){ + $similar_products_exist++ if ($similar_biblionumbers && $similar_biblionumbers->[0]); + push @similar_products, +{ similar_biblionumbers => $similar_biblionumbers, title => $similar_product->{Title}, ASIN => $similar_product->{ASIN} }; + } } my $editorial_reviews = \@{$amazon_details->{Items}->{Item}->{EditorialReviews}->{EditorialReview}}; my $average_rating = $amazon_details->{Items}->{Item}->{CustomerReviews}->{AverageRating}; -- 2.39.5