From ff7417fa916523ba293785c32d6d70a126dfdec8 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 27 Aug 2012 16:04:48 -0400 Subject: [PATCH] Bug 8679 [REVISED] Remove usage of Amazon API This patch removes the AmazonReviews and AmazonSimilarItems features from the OPAC and staff client. With on Amazon feature remaining, cover images, the *AmazonEnabled preference is also removed in favor of checking the *AmazonCoverImages preference. Two other system preferences, AWSAccessKeyID and AWSPrivateKey are removed as they were required only by the removed features. Handling of book cover images from Amazon is unchanged. Signed-off-by: Nicole C. Engard Turned on amazon covers in opac and staff client and all worked as expected. Then tested to make sure other cover image services still worked and they do. Signing off. Signed-off-by: Paul Poulain --- C4/Auth.pm | 7 - C4/External/Amazon.pm | 128 ------------------ C4/External/BakerTaylor.pm | 1 - C4/Koha.pm | 2 +- C4/Search.pm | 2 - admin/systempreferences.pl | 8 -- catalogue/detail.pl | 41 +----- installer/data/mysql/sysprefs.sql | 8 -- installer/data/mysql/updatedatabase.pl | 14 ++ .../admin/preferences/enhanced_content.pref | 50 ------- .../prog/en/modules/catalogue/detail.tt | 36 +---- .../prog/en/modules/catalogue/results.tt | 8 +- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 10 -- .../opac-tmpl/prog/en/modules/opac-detail.tt | 74 +--------- .../prog/en/modules/opac-opensearch.tt | 2 +- .../prog/en/modules/opac-readingrecord.tt | 2 +- .../prog/en/modules/opac-results-grouped.tt | 2 +- .../opac-tmpl/prog/en/modules/opac-results.tt | 2 +- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 2 +- .../prog/en/modules/opac-showreviews-rss.tt | 2 +- .../prog/en/modules/opac-showreviews.tt | 2 +- opac/opac-ISBDdetail.pl | 37 ----- opac/opac-detail.pl | 42 +----- 23 files changed, 42 insertions(+), 440 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index f9b15ef89c..59c99551d7 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -334,10 +334,7 @@ sub get_template_and_user { if ( $in->{'type'} eq "intranet" ) { $template->param( - AmazonContent => C4::Context->preference("AmazonContent"), AmazonCoverImages => C4::Context->preference("AmazonCoverImages"), - AmazonEnabled => C4::Context->preference("AmazonEnabled"), - AmazonSimilarItems => C4::Context->preference("AmazonSimilarItems"), AutoLocation => C4::Context->preference("AutoLocation"), "BiblioDefaultView".C4::Context->preference("IntranetBiblioDefaultView") => 1, CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1, @@ -390,7 +387,6 @@ sub get_template_and_user { } $template->param( opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"), - AmazonContent => "" . C4::Context->preference("AmazonContent"), AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), BranchesLoop => GetBranchesLoop($opac_name), @@ -398,10 +394,7 @@ sub get_template_and_user { LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"", - OPACAmazonEnabled => C4::Context->preference("OPACAmazonEnabled"), - OPACAmazonSimilarItems => C4::Context->preference("OPACAmazonSimilarItems"), OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"), - OPACAmazonReviews => C4::Context->preference("OPACAmazonReviews"), OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"), OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"), OPACItemHolds => C4::Context->preference("OPACItemHolds"), diff --git a/C4/External/Amazon.pm b/C4/External/Amazon.pm index 53ebbd3230..1e70f11352 100644 --- a/C4/External/Amazon.pm +++ b/C4/External/Amazon.pm @@ -17,14 +17,6 @@ package C4::External::Amazon; # with Koha; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -use XML::Simple; -use LWP::Simple; -use LWP::UserAgent; -use HTTP::Request::Common; -use C4::Koha; -use URI::Escape; -use POSIX; -use Digest::SHA qw(hmac_sha256_base64); use strict; use warnings; @@ -36,7 +28,6 @@ BEGIN { $VERSION = 3.07.00.049; @ISA = qw(Exporter); @EXPORT = qw( - get_amazon_details get_amazon_tld ); } @@ -68,35 +59,6 @@ This module provides facilities for retrieving Amazon.com content in Koha =over -=item get_amazon_detail( $isbn, $record, $marcflavour, $services ) - -Get editorial reviews, customer reviews, and similar products using Amazon Web Services. - -Parameters: - -=over - -=item $isbn - -Biblio record isbn - -=item $record - -Biblio MARC record - -=item $marcflavour - -MARC flavor, MARC21 or UNIMARC - -=item $services - -Requested Amazon services: A ref to an array. For example, -[ 'Similarities', 'EditorialReviews', 'Reviews' ]. -No other service will be accepted. Services must be spelled exactly. -If no sercice is requested, AWS isn't called. - -=back - =item get_amazon_tld() Get Amazon Top Level Domain depending on Amazon local preference: AmazonLocal. @@ -106,96 +68,6 @@ For example, if AmazonLocal is 'UK', returns '.co.uk'. =cut - -sub get_amazon_details { - my ( $isbn, $record, $marcflavour, $aws_ref ) = @_; - - return unless defined $aws_ref; - my @aws = @$aws_ref; - return if $#aws == -1; - - # Normalize the fields - $isbn = GetNormalizedISBN($isbn); - my $upc = GetNormalizedUPC($record,$marcflavour); - my $ean = GetNormalizedEAN($record,$marcflavour); - # warn "ISBN: $isbn | UPC: $upc | EAN: $ean"; - - # Choose the appropriate and available item identifier - my ( $id_type, $item_id ) = - defined($isbn) && length($isbn) == 13 ? ( 'EAN', $isbn ) : - $isbn ? ( 'ASIN', $isbn ) : - $upc ? ( 'UPC', $upc ) : - $ean ? ( 'EAN', $upc ) : ( undef, undef ); - return unless defined($id_type); - - # grab the item format to determine Amazon search index - my %hformat = ( a => 'Books', g => 'Video', j => 'Music' ); - my $search_index = $hformat{ substr($record->leader(),6,1) } || 'Books'; - - my $parameters={Service=>"AWSECommerceService" , - "AWSAccessKeyId"=> C4::Context->preference('AWSAccessKeyID') , - "Operation"=>"ItemLookup", - "AssociateTag"=> C4::Context->preference('AmazonAssocTag') , - "Version"=>"2009-06-01", - "ItemId"=>$item_id, - "IdType"=>$id_type, - "ResponseGroup"=> join( ',', @aws ), - "Timestamp"=>strftime("%Y-%m-%dT%H:%M:%SZ", gmtime) - }; - $$parameters{"SearchIndex"} = $search_index if $id_type ne 'ASIN'; - my @params; - while (my ($key,$value)=each %$parameters){ - push @params, qq{$key=}.uri_escape($value, "^A-Za-z0-9\-_.~" ); - } - - my $url; - if (C4::Context->preference('AWSPrivateKey')) { - $url = qq{http://webservices.amazon} . get_amazon_tld() . - "/onca/xml?" . join("&",sort @params) . qq{&Signature=} . uri_escape(SignRequest(@params),"^A-Za-z0-9\-_.~" ); - } else { - $url = qq{http://webservices.amazon} . get_amazon_tld() . "/onca/xml?" .join("&",sort @params); - warn "MUST set AWSPrivateKey syspref after 2009-08-15 in order to access Amazon web services"; - } - - my $content = get($url); - warn "could not retrieve $url" unless $content; - my $xmlsimple = XML::Simple->new(); - my $response = $xmlsimple->XMLin( - $content, - forcearray => [ qw(SimilarProduct EditorialReview Review Item) ], - ) unless !$content; - return $response; -} - -sub SignRequest{ - my @params=@_; - my $tld=get_amazon_tld(); - my $string = qq{GET\nwebservices.amazon$tld\n/onca/xml\n} . join("&",sort @params); - return hmac_sha256_base64($string,C4::Context->preference('AWSPrivateKey')) . '='; -} - -sub check_search_inside { - my $isbn = shift; - my $ua = LWP::UserAgent->new( - agent => "Mozilla/4.76 [en] (Win98; U)", - keep_alive => 1, - env_proxy => 1, - ); - my $available = 1; - my $uri = "http://www.amazon.com/gp/reader/$isbn/ref=sib_dp_pt/002-7879865-0184864#reader-link"; - my $req = HTTP::Request->new(GET => $uri); - $req->header ( - 'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*', - 'Accept-Charset' => 'iso-8859-1,*,utf-8', - 'Accept-Language' => 'en-US' ); - my $res = $ua->request($req); - my $content = $res->content(); - if ($content =~ m/This book is temporarily unavailable/) { - undef $available; - } - return $available; -} - 1; __END__ diff --git a/C4/External/BakerTaylor.pm b/C4/External/BakerTaylor.pm index 3503db0ba8..d7526774a3 100644 --- a/C4/External/BakerTaylor.pm +++ b/C4/External/BakerTaylor.pm @@ -134,7 +134,6 @@ Such response will trigger a warning for each request (potentially many). Point =head1 SEE ALSO -C4::External::Amazon LWP::UserAgent =head1 AUTHOR diff --git a/C4/Koha.pm b/C4/Koha.pm index 4f386e469d..22afed6f2a 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1232,7 +1232,7 @@ sub GetNormalizedUPC { } # Normalizes and returns the first valid ISBN found in the record -# ISBN13 are converted into ISBN10. This is required to get Amazon cover book. +# ISBN13 are converted into ISBN10. This is required to get some book cover images. sub GetNormalizedISBN { my ($isbn,$record,$marcflavour) = @_; my @fields; diff --git a/C4/Search.pm b/C4/Search.pm index 9f843c38e9..a06dcf6bba 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1823,8 +1823,6 @@ sub searchResults { $oldbiblio->{intransitcount} = $item_in_transit_count; $oldbiblio->{onholdcount} = $item_onhold_count; $oldbiblio->{orderedcount} = $ordered_count; - # deleting - in isbn to enable amazon content - $oldbiblio->{isbn} =~ s/-//g; if (C4::Context->preference("AlternateHoldingsField") && $items_count == 0) { my $fieldspec = C4::Context->preference("AlternateHoldingsField"); diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index fcc3df9cdf..f7a7d05838 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -266,18 +266,10 @@ $tabsysprefs{AdvancedSearchTypes} = "Searching"; $tabsysprefs{DisplayMultiPlaceHold} = "Searching"; # EnhancedContent -$tabsysprefs{AmazonEnabled} = "EnhancedContent"; -$tabsysprefs{OPACAmazonEnabled} = "EnhancedContent"; $tabsysprefs{AmazonCoverImages} = "EnhancedContent"; $tabsysprefs{OPACAmazonCoverImages} = "EnhancedContent"; -$tabsysprefs{AWSAccessKeyID} = "EnhancedContent"; -$tabsysprefs{AWSPrivateKey} = "EnhancedContent"; $tabsysprefs{AmazonLocale} = "EnhancedContent"; $tabsysprefs{AmazonAssocTag} = "EnhancedContent"; -$tabsysprefs{AmazonSimilarItems} = "EnhancedContent"; -$tabsysprefs{OPACAmazonSimilarItems} = "EnhancedContent"; -$tabsysprefs{AmazonReviews} = "EnhancedContent"; -$tabsysprefs{OPACAmazonReviews} = "EnhancedContent"; # Babelthèque $tabsysprefs{Babeltheque} = "EnhancedContent"; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index d110740ee8..f2ad4ebe5f 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -325,7 +325,7 @@ foreach ( keys %{$dat} ) { # does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 'EnableViews'); # method query not found?!?! - +$template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("AmazonCoverImages")); $template->param( itemloop => \@itemloop, biblionumber => $biblionumber, @@ -352,45 +352,6 @@ if (C4::Context->preference("FRBRizeEditions")==1) { }; if ($@) { warn "XISBN Failed $@"; } } -if ( C4::Context->preference("AmazonEnabled") == 1 ) { - $template->param( AmazonTld => get_amazon_tld() ); - my $amazon_reviews = C4::Context->preference("AmazonReviews"); - my $amazon_similars = C4::Context->preference("AmazonSimilarItems"); - my @services; - if ( $amazon_reviews ) { - $template->param( AmazonReviews => 1 ); - push( @services, 'EditorialReview' ); - } - if ( $amazon_similars ) { - $template->param( AmazonSimilarItems => 1 ); - push( @services, 'Similarities' ); - } - my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour, \@services ); - if ( $amazon_similars ) { - my $similar_products_exist; - my @similar_products; - for my $similar_product (@{$amazon_details->{Items}->{Item}->[0]->{SimilarProducts}->{SimilarProduct}}) { - # 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 - 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} }; - } - } - $template->param( AmazonSimilarItems => $similar_products_exist ); - $template->param( AMAZON_SIMILAR_PRODUCTS => \@similar_products ); - } - if ( $amazon_reviews ) { - my $item = $amazon_details->{Items}->{Item}->[0]; - my $editorial_reviews = \@{ $item->{EditorialReviews}->{EditorialReview} }; - #my $customer_reviews = \@{$amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{Review}}; - #my $average_rating = $amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{AverageRating} || 0; - #$template->param( amazon_average_rating => $average_rating * 20 ); - #$template->param( AMAZON_CUSTOMER_REVIEWS => $customer_reviews ); - $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews ); - } -} if ( C4::Context->preference("LocalCoverImages") == 1 ) { my @images = ListImagesForBiblio($biblionumber); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f5a18b2089..7219e374ab 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -2,13 +2,7 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('advancedMARCeditor',0,"If ON, the MARC editor won't display field/subfield descriptions",'','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowHoldDateInFuture','0','If set a date field is displayed on the Hold screen of the Staff Interface, allowing the hold date to be set in the future.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACAllowHoldDateInFuture','0','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonEnabled',0,'Turn ON Amazon Content - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonReviews',0,'Display Amazon review on staff interface - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonSimilarItems',0,'Turn ON Amazon Similar Items feature - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonEnabled',0,'Turn ON Amazon Content in the OPAC - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonSimilarItems',0,'Turn ON Amazon Similar Items feature - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonLocale','US','Use to set the Locale of your Amazon.com Web Services','US|CA|DE|FR|JP|UK','Choice'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSAccessKeyID','','See: http://aws.amazon.com','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonAssocTag','','See: http://aws.amazon.com','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AnonSuggestions',0,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AnonymousPatron', '0', 'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',NULL,''); @@ -255,7 +249,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectPassword',NULL,'Enable Novelist user Profile',NULL,'free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectView','tab','Where to display Novelist Select content','tab|above|below|right','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonReviews', '0', 'Display Amazon readers reviews on OPAC','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'StaffSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the Staff client', 'Integer'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'OPACSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the OPAC', 'Integer'); @@ -271,7 +264,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('v INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('FilterBeforeOverdueReport','0','Do not run overdue report until filter selected','','YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '', '30|10', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example .', 'Textarea'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSPrivateKey','','See: http://aws.amazon.com. Note that this is required after 2009/08/15 in order to retrieve any enhanced content other than book covers from Amazon.','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACFineNoRenewals','100','Fine limit above which user cannot renew books via OPAC','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OverdueNoticeBcc','','Email address to bcc outgoing overdue notices sent by email','','free'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'NewItemsDefaultLocation', '', '', 'If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )', ''); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ed0c6749e2..ab3a1a2b65 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5635,6 +5635,20 @@ if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("DELETE FROM systempreferences WHERE variable='AmazonReviews'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AmazonSimilarItems'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AWSAccessKeyID'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AWSPrivateKey'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='OPACAmazonReviews'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='OPACAmazonSimilarItems'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AmazonEnabled'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='OPACAmazonEnabled'"); + print "Upgrade to $DBversion done ('Remove preferences controlling broken Amazon features (Bug 8679')\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref index bb3bc2d89e..d1f281490f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref @@ -17,20 +17,6 @@ Enhanced Content: no: "Don't show" - other editions of an item on the OPAC. Amazon: - - - - pref: AmazonEnabled - default: 0 - choices: - yes: Use - no: "Don't use" - - data from Amazon on the staff interface (including reviews and "Search Inside" links on item detail pages). This requires that you have signed up for and entered an access key. - - - - pref: OPACAmazonEnabled - default: 0 - choices: - yes: Use - no: "Don't use" - - data from Amazon on the OPAC (including reviews and "Search Inside" links on item detail pages). This requires that you have signed up for and entered an access key. - - Use Amazon data from its - pref: AmazonLocale @@ -42,14 +28,6 @@ Enhanced Content: JP: Japanese UK: British - website. - - - - Access Amazon content using the access key - - pref: AWSAccessKeyID - - (free, at http://aws.amazon.com/). - - - - Access Amazon content (other than book jackets) using the private key - - pref: AWSPrivateKey - - (free, at http://aws.amazon.com/). - - Put the associate tag - pref: AmazonAssocTag @@ -61,20 +39,6 @@ Enhanced Content: yes: Show no: "Don't show" - cover images from Amazon on search results and item detail pages on the staff interface. - - - - pref: AmazonReviews - default: 1 - choices: - yes: Show - no: "Don't show" - - reviews from Amazon on item detail pages on the staff interface. - - - - pref: AmazonSimilarItems - default: 1 - choices: - yes: Show - no: "Don't show" - - similar items, as determined by Amazon, on item detail pages on the staff interface. - - pref: OPACAmazonCoverImages default: 1 @@ -82,20 +46,6 @@ Enhanced Content: yes: Show no: "Don't show" - cover images from Amazon on search results and item detail pages on the OPAC. - - - - pref: OPACAmazonSimilarItems - default: 1 - choices: - yes: Show - no: "Don't show" - - similar items, as determined by Amazon, on item detail pages on the OPAC. - - - - pref: OPACAmazonReviews - default: 1 - choices: - yes: Show - no: "Don't show" - - reviews from Amazon on item detail pages on the OPAC. Babelthèque: - - pref: Babeltheque diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 4f005247fe..22f7908aa1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -39,7 +39,7 @@ function verify_images() { $('#bibliodetails').tabs(); $('#search-form').focus(); }); - [% IF ( AmazonEnabled ) %]$(window).load(function() { + [% IF ( AmazonCoverImages ) %]$(window).load(function() { verify_images(); });[% END %] //]]> @@ -74,7 +74,7 @@ function verify_images() { [% END %] - [% IF ( AmazonEnabled ) %] + [% IF ( AmazonCoverImages ) %] [% IF ( XSLTDetailsDisplay ) %]
@@ -117,8 +117,8 @@ function verify_images() { [% END %] [% IF ( holdcount ) %]Holds: [% holdcount %][% ELSE %][% END %] - [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]
- [% END %][% END %] + [% IF ( AmazonCoverImages ) %]
+ [% END %] [% ELSE %]

[% title |html %]

@@ -177,8 +177,8 @@ function verify_images() {
-[% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]
-
[% END %][% END %] +[% IF ( AmazonCoverImages ) %]
+
[% END %]
    @@ -260,7 +260,6 @@ function verify_images() {
  • Descriptions
  • [% IF ( subscriptionsnumber ) %]
  • Subscriptions
  • [% END %] [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]
  • Editions
  • [% END %][% END %] -[% IF ( AmazonSimilarItems ) %]
  • Related titles
  • [% END %] [% IF ( LocalCoverImages ) %][% IF ( localimages || CAN_user_tools_upload_local_cover_images ) %]
  • Images
  • [% END %][% END %]
@@ -449,14 +448,6 @@ function verify_images() {
-[% IF ( AmazonEnabled ) %] -[% FOREACH AMAZON_EDITORIAL_REVIEW IN AMAZON_EDITORIAL_REVIEWS %] - [% IF ( AMAZON_EDITORIAL_REVIEW.Content ) %] -

From [% AMAZON_EDITORIAL_REVIEW.Source %]:

-

[% AMAZON_EDITORIAL_REVIEW.Content %]

- [% END %] -[% END %] -[% END %] [% IF ( MARCNOTES ) %] [% FOREACH MARCNOTE IN MARCNOTES %] @@ -522,7 +513,7 @@ function verify_images() { [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]

Editions

-[% FOREACH XISBN IN XISBNS %][% IF ( XISBN.AmazonEnabled ) %][% END %] +[% FOREACH XISBN IN XISBNS %][% IF ( AmazonCoverImages ) %][% END %] [% UNLESS ( item_level_itypes ) %][% END %]
[% IF ( noItemTypeImages ) %][% XISBN.description %][% ELSE %][% XISBN.description %][% END %][% XISBN.title |html %] by [% XISBN.author %] ©[% XISBN.copyrightdate %] [% IF ( XISBN.publishercode ) %] @@ -536,19 +527,6 @@ function verify_images() {
[% END %] [% END %] -[% IF ( AmazonEnabled ) %][% IF ( AmazonSimilarItems ) %] - -[% END %][% END %] - [% IF ( LocalCoverImages ) %]
[% IF ( localimages.0 ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 1ebc86290d..09c946e1e3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -6,7 +6,7 @@ var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold."); var q_array = new Array(); // will hold search terms, if present -[% IF ( AmazonEnabled ) %] +[% IF ( AmazonCoverImages ) %] // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html function verify_images() { $("img").each(function(i){ @@ -440,20 +440,20 @@ YAHOO.util.Event.onContentReady("searchheader", function () { - [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %][% END %][% END %] + [% IF ( AmazonCoverImages ) %][% END %] [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] [% IF ( loop.odd ) %][% ELSE %][% END %] - [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %] + [% IF ( AmazonCoverImages ) %] - [% END %][% END %] + [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 1e259fb19c..68dc01b1bd 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -1797,16 +1797,6 @@ div#menu li.active a:hover { padding : 2px; } -#amazonreviews h4 { - font-size : 90%; - margin : 0; - padding : 0; -} -#amazonreviews h3 { - font-size : 100%; - margin : 0; - padding : 0; -} span.starFull { background: url(../../images/star-ratings.gif) top left no-repeat; display : block; diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 75f16aae06..6c4ecdceb9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -296,7 +296,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% IF ( OPACLocalCoverImages ) %]
[% END %] - [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( OPACurlOpenInNewWindow ) %]Cover image[% ELSE %]Cover image[% END %][% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( OPACurlOpenInNewWindow ) %]Cover image[% ELSE %]Cover image[% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( content_identifier_exists ) %][% IF ( using_https ) %] @@ -654,17 +654,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %] [% END %] -[% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonSimilarItems ) %][% IF ( AMAZON_SIMILAR_PRODUCTS ) %] - -[% END %][% END %][% END %] - [% IF ( OPACFRBRizeEditions ) %][% IF ( XISBNS ) %]
  • Editions
  • [% END %][% END %] -[% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonReviews ) %] -
  • Amazon reviews
  • -[% END %][% END %] [% IF ( Babeltheque ) %]
  • Babelthèque
  • [% END %] @@ -798,7 +791,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
    [% FOREACH PREVIOUS_SHELF_BROWS IN PREVIOUS_SHELF_BROWSE %]
      Results Location
    Previous - [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( PREVIOUS_SHELF_BROWS.browser_normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( PREVIOUS_SHELF_BROWS.browser_normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( content_identifier_exists ) %] [% IF ( using_https ) %] @@ -814,8 +807,8 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% FOREACH NEXT_SHELF_BROWS IN NEXT_SHELF_BROWSE %] - [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( NEXT_SHELF_BROWS.browser_normalized_isbn ) %] - [% ELSE %]No cover image available[% END %][% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( NEXT_SHELF_BROWS.browser_normalized_isbn ) %] + [% ELSE %]No cover image available[% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( content_identifier_exists ) %] [% IF ( using_https ) %] @@ -851,16 +844,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
    -[% IF ( OPACAmazonEnabled ) %] -[% IF ( OPACAmazonReviews ) %] -[% FOREACH AMAZON_EDITORIAL_REVIEW IN AMAZON_EDITORIAL_REVIEWS %] - [% IF ( AMAZON_EDITORIAL_REVIEW.Content ) %] -

    From [% AMAZON_EDITORIAL_REVIEW.Source %]:

    -
    [% AMAZON_EDITORIAL_REVIEW.Content %]
    - [% END %] -[% END %] -[% END %] -[% END %] + [% IF ( SyndeticsEnabled ) %] [% IF ( SyndeticsSummary ) %] [% IF ( SYNDETICS_SUMMARY ) %] @@ -1100,7 +1084,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% FOREACH XISBN IN XISBNS %]
    -[% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% END %][% END %] +[% IF ( OPACAmazonCoverImages ) %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( XISBN.content_identifier_exists ) %] [% IF ( using_https ) %] @@ -1119,52 +1103,6 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
    [% END %][% END %] -[% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonSimilarItems ) %][% IF ( AMAZON_SIMILAR_PRODUCTS ) %] - -
    -

    Related Titles

    - -[% FOREACH AMAZON_SIMILAR_PRODUCT IN AMAZON_SIMILAR_PRODUCTS %] -[% FOREACH similar_biblionumber IN AMAZON_SIMILAR_PRODUCT.similar_biblionumbers %] - -[% END %] -[% END %] -
    [% IF ( OPACAmazonCoverImages ) %][% END %] - [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( similar_biblionumber.content_identifier_exists ) %] - [% IF ( using_https ) %] - - [% ELSE %][% END %] - [% ELSE %]No cover image available[% END %][% END %][% END %] -[% similar_biblionumber.title |html %]
    -
    [% END %] -[% END %][% END %] - -[% IF ( OPACAmazonEnabled ) %] -[% IF ( OPACAmazonReviews ) %] - -
    - [% IF ( amazon_average_rating ) %] -

    Average rating (from Amazon[% AmazonTld %]):

    [% IF ( normalized_isbn ) %][% IF ( OPACurlOpenInNewWindow ) %]Add your own review[% ELSE %]Add your own review[% END %][% END %]
    - - [% FOREACH AMAZON_CUSTOMER_REVIEW IN AMAZON_CUSTOMER_REVIEWS %] -
    -

    [% AMAZON_CUSTOMER_REVIEW.Summary |html %]

    [% AMAZON_CUSTOMER_REVIEW.Date | $KohaDates %] - [% IF ( AMAZON_CUSTOMER_REVIEW.Content ) %] -

    [% AMAZON_CUSTOMER_REVIEW.Content |html %]

    - [% END %] -
    - [% END %] - [% ELSE %] - -

    Sorry, there are no reviews from this library available for this title. [% IF ( normalized_isbn ) %][% IF ( OPACurlOpenInNewWindow ) %]Add your own review[% ELSE %]Add your own review[% END %][% END %]

    - - [% END %] -
    - -[% END %] -[% END %] - - [% IF ( OPACLocalCoverImages ) %]

    Click on an image to view it in the image viewer

    diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt index 14a5f3ea95..e761402ebf 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt @@ -36,7 +36,7 @@ ISBN [% SEARCH_RESULT.isbn |html %] [% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %][% OPACBaseURL %]/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %][% ELSE %][% IF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %][% OPACBaseURL %]/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %][% ELSE %][% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %][% END %][% END %] [% END %][% END %][% END %] +[% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %][% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( SEARCH_RESULT.content_identifier_exists ) %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt index 878692515e..69b27a47b4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt @@ -65,7 +65,7 @@ You have never borrowed anything from this library. [% UNLESS ( loop.odd ) %][% ELSE %][% END %] -[% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( READING_RECOR.normalized_isbn ) %]Cover Image[% ELSE %]No cover image available[% END %][% END %][% END %] +[% IF ( OPACAmazonCoverImages ) %][% IF ( READING_RECOR.normalized_isbn ) %]Cover Image[% ELSE %]No cover image available[% END %][% END %] [% IF ( GoogleJackets ) %][% IF ( READING_RECOR.normalized_isbn ) %]
    [% ELSE %]No cover image available[% END %][% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt index 99c31bdcac..bbdd618d43 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt @@ -198,7 +198,7 @@ function highlightOn() { [% ELSE %] [% END %] - [% IF ( OPACAmazonEnabled ) %] + [% IF ( OPACAmazonCoverImages ) %] [% IF ( GROUP_RESULT.isbn ) %][% ELSE %][% END %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index 67b1686a14..81f825a5bb 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -603,7 +603,7 @@ $(document).ready(function(){ [% IF ( OPACLocalCoverImages ) %][% END %] - [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] [% IF ( SyndeticsEnabled ) %] [% IF ( SyndeticsCoverImages ) %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt index 716f2e122c..18f3da5893 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -408,7 +408,7 @@ $(function() { - [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( itemsloo.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( itemsloo.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt index 54cc959fb7..215902258a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt @@ -13,7 +13,7 @@ New comment on [% review.title |html %] [% FOREACH subtitl IN review.subtitle %], [% subtitl.subfield |html %][% END %] [% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% review.biblionumber %]#comments [% END %][% END %][% END %] +[% IF ( OPACAmazonCoverImages ) %][% IF ( review.normalized_isbn ) %][% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( review.content_identifier_exists ) %][% IF ( using_https ) %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt index 9fcc532c2b..5b22722c48 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt @@ -80,7 +80,7 @@ $(document).ready(function(){ [% END %] - [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( review.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( review.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %] diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 435859d682..773ed51eb1 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -54,7 +54,6 @@ use C4::Review; use C4::Serials; # uses getsubscriptionfrom biblionumber use C4::Koha; use C4::Members; # GetMember -use C4::External::Amazon; my $query = CGI->new(); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -192,40 +191,4 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $template->param('OPACSearchForTitleIn' => $search_for_title); } -## Amazon.com stuff -#not used unless preference set -if ( C4::Context->preference("OPACAmazonEnabled") == 1 ) { - - my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour ); - - foreach my $result ( @{ $amazon_details->{Details} } ) { - $template->param( item_description => $result->{ProductDescription} ); - $template->param( image => $result->{ImageUrlMedium} ); - $template->param( list_price => $result->{ListPrice} ); - $template->param( amazon_url => $result->{url} ); - } - - my @products; - my @reviews; - for my $details ( @{ $amazon_details->{Details} } ) { - next unless $details->{SimilarProducts}; - for my $product ( @{ $details->{SimilarProducts}->{Product} } ) { - push @products, +{ Product => $product }; - } - next unless $details->{Reviews}; - for my $product ( @{ $details->{Reviews}->{AvgCustomerRating} } ) { - $template->param( rating => $product * 20 ); - } - for my $reviews ( @{ $details->{Reviews}->{CustomerReview} } ) { - push @reviews, - +{ - Summary => $reviews->{Summary}, - Comment => $reviews->{Comment}, - }; - } - } - $template->param( SIMILAR_PRODUCTS => \@products ); - $template->param( AMAZONREVIEWS => \@reviews ); -} - output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 0bafabdce0..c1af478976 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -747,46 +747,6 @@ if (C4::Context->preference("OPACLocalCoverImages")){ $template->param(OPACLocalCoverImages => 1); } -# Amazon.com Stuff -if ( C4::Context->preference("OPACAmazonEnabled") ) { - $template->param( AmazonTld => get_amazon_tld() ); - my $amazon_reviews = C4::Context->preference("OPACAmazonReviews"); - my $amazon_similars = C4::Context->preference("OPACAmazonSimilarItems"); - my @services; - if ( $amazon_reviews ) { - push( @services, 'EditorialReview', 'Reviews' ); - } - if ( $amazon_similars ) { - push( @services, 'Similarities' ); - } - my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour, \@services ); - my $similar_products_exist; - if ( $amazon_reviews ) { - my $item = $amazon_details->{Items}->{Item}->[0]; - my $customer_reviews = \@{ $item->{CustomerReviews}->{Review} }; - my $editorial_reviews = \@{ $item->{EditorialReviews}->{EditorialReview} }; - my $average_rating = $item->{CustomerReviews}->{AverageRating} || 0; - $template->param( amazon_average_rating => $average_rating * 20); - $template->param( AMAZON_CUSTOMER_REVIEWS => $customer_reviews ); - $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews ); - } - if ( $amazon_similars ) { - my $item = $amazon_details->{Items}->{Item}->[0]; - my @similar_products; - for my $similar_product (@{ $item->{SimilarProducts}->{SimilarProduct} }) { - # 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 - 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} }; - } - } - $template->param( OPACAmazonSimilarItems => $similar_products_exist ); - $template->param( AMAZON_SIMILAR_PRODUCTS => \@similar_products ); - } -} - my $syndetics_elements; if ( C4::Context->preference("SyndeticsEnabled") ) { @@ -907,6 +867,8 @@ if (C4::Context->preference("OPACShelfBrowser")) { } } +$template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("OPACAmazonCoverImages")); + if (C4::Context->preference("BakerTaylorEnabled")) { $template->param( BakerTaylorEnabled => 1, -- 2.39.5