In fact, the previous patch worked when no similar items were shown.
But It failed when some were found.
This is fixing the problem :
- xISBN returned only a loop containing only biblionumbers and not hashs as 
expected by template
- using $value->[$index] rather than [EMAIL PROTECTED] which also caused the 
problem.
---
 C4/XISBN.pm         |    5 +----
 catalogue/detail.pl |    2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/C4/XISBN.pm b/C4/XISBN.pm
index 11bc2c7..04558ff 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 [EMAIL PROTECTED];
+    return $sth->fetchall_arrayref({});
 }
 =head1 NAME
 
diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 9d195b3..421162e 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -217,7 +217,7 @@ if ( C4::Context->preference("AmazonContent") == 1 ) {
         my $similar_biblionumbers = 
get_biblionumber_from_isbn($similar_product->{ASIN});
         # verify that there is at least one similar item
        if (scalar(@$similar_biblionumbers)){
-              $similar_products_exist++ if ($similar_biblionumbers && [EMAIL 
PROTECTED]);
+              $similar_products_exist++ if ($similar_biblionumbers && 
$similar_biblionumbers->[0]);
                push @similar_products, +{ similar_biblionumbers => 
$similar_biblionumbers, title => $similar_product->{Title}, ASIN => 
$similar_product->{ASIN}  };
        }
     }
-- 
1.5.4.3

_______________________________________________
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to