From 28a7b360be18ff4ce5e6d45d918a7dfc8c6b9416 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 20 Jan 2009 19:18:20 -0600 Subject: [PATCH] Block warning on detail.pl. If Amazon doesn't have an avg. rating number defined, then we cannot multiply it by 20 without the following warning: detail.pl: Use of uninitialized value in multiplication (*) at /home/user/kohaclone/catalogue/detail.pl line 228. So the important part of this patch is || 0 on the $average_rating assignment. [RM note: applying for whitespace cleanup] Signed-off-by: Galen Charlton --- catalogue/detail.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 4529064d46..663f7703f2 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -225,8 +225,8 @@ if (C4::Context->preference("FRBRizeEditions")==1) { if ( C4::Context->preference("AmazonEnabled") == 1 ) { my $similar_products_exist; my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour ); - my $item_attributes = \%{$amazon_details->{Items}->{Item}->{ItemAttributes}}; - my $customer_reviews = \@{$amazon_details->{Items}->{Item}->{CustomerReviews}->{Review}}; + my $item_attributes = \%{$amazon_details->{Items}->{Item}->{ItemAttributes}}; + my $customer_reviews = \@{$amazon_details->{Items}->{Item}->{CustomerReviews}->{Review}}; my @similar_products; for my $similar_product (@{$amazon_details->{Items}->{Item}->{SimilarProducts}->{SimilarProduct}}) { # do we have any of these isbns in our collection? @@ -239,10 +239,10 @@ if ( C4::Context->preference("AmazonEnabled") == 1 ) { } my $editorial_reviews = \@{$amazon_details->{Items}->{Item}->{EditorialReviews}->{EditorialReview}}; my $average_rating = $amazon_details->{Items}->{Item}->{CustomerReviews}->{AverageRating} || 0; - $template->param( AmazonSimilarItems => $similar_products_exist ); - $template->param( amazon_average_rating => $average_rating * 20); - $template->param( AMAZON_CUSTOMER_REVIEWS => $customer_reviews ); - $template->param( AMAZON_SIMILAR_PRODUCTS => \@similar_products ); - $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews ); + $template->param( AmazonSimilarItems => $similar_products_exist ); + $template->param( amazon_average_rating => $average_rating * 20 ); + $template->param( AMAZON_CUSTOMER_REVIEWS => $customer_reviews ); + $template->param( AMAZON_SIMILAR_PRODUCTS => \@similar_products ); + $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews ); } output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5