[Koha-patches] [PATCH] Fixes a bug preventing amazon book cover display in OPAC

Frédéric DEMIANS f.demians at tamil.fr
Thu May 29 19:42:18 CEST 2008


On OPAC results and detail page, a bug prevented display of book
cover image from Amazon.
---
  C4/Search.pm        |    3 ++-
  opac/opac-detail.pl |    7 +++++--
  2 files changed, 7 insertions(+), 3 deletions(-)
  mode change 100644 => 100755 C4/Search.pm

diff --git a/C4/Search.pm b/C4/Search.pm
old mode 100644
new mode 100755
index b9ed475..c890cc6
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1258,8 +1258,9 @@ sub searchResults {
  		my $biblio_authorised_value_images = 
C4::Items::get_authorised_value_images( 
C4::Biblio::get_biblio_authorised_values( $oldbiblio->{biblionumber} ) );
  		$oldbiblio->{authorised_value_images} = $biblio_authorised_value_images;
          my $aisbn = $oldbiblio->{'isbn'};
-        $aisbn =~ /(\d*[X]*)/;
+        $aisbn =~ /([\d-]*[X]*)/;
          $oldbiblio->{amazonisbn} = $1;
+        $oldbiblio->{amazonisbn} =~ s/-//g;
  		$oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} 
}->{description};
   # Build summary if there is one (the summary is defined in the 
itemtypes table)
   # FIXME: is this used anywhere, I think it can be commented out? -- JF
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index 2a28ca5..603c37f 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -239,8 +239,11 @@ sub isbn_cleanup ($) {

  # XISBN Stuff
  my $xisbn=$dat->{'isbn'};
-$xisbn =~ /(\d*[X]*)/;
-$template->param(amazonisbn => $1);		# FIXME: so it is OK if the ISBN = 
'XXXXX' ?
+$xisbn =~ /([\d-]*[X]*)/;
+my $amazonisbn = $1;
+$amazonisbn =~ s/-//g;
+
+$template->param(amazonisbn => $amazonisbn);		# 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)){
-- 
1.5.4.2




More information about the Koha-patches mailing list