Bug 4460: Amazon's AssociateID tag not used in links so referred revenue lost

Reworking based on output of:
git grep "gp\/reader"
Additionally, some changes might be in order though gp/reader works.
https://affiliate-program.amazon.com/help/topic/t64/a1
suggests using dp
A dp was discovered, so that part of the URL was left unchanged.
The "/ref..." part was changed to just an Amazon tag ("?tag={AAT}")
if defined.

TEST PLAN
---------
 1) Added:
     "100 years of Canadian foreign policy /
      edited by Robert Bothwell and Jean Daudelin."
 2) Added a second book with the word foreign in the title.
 3) Waited for reindex
 4) Checked out the Canadian foreign policy book.
 5) Applied patch
 6) Made sure that:
    - AmazonAssocTag was set to TEST (easy to notice)
    - AmazonCoverImages was set to 'Show'
    - OPACAmazonCoverImages was set to 'Show'
 7) Searched intranet for 'foreign' to find the detail page
    -- hovering over picture shows URL with ?tag=TEST in it.
 8) Went to the OPAC Detail page
 9) Toggling OPACURLOpenInNewWindow, confirmed that URL for
    the picture contained ?tag=TEST in it.
10) Logged into the OPAC
11) Confirmed the URL in the checked out list on your summary
    page contained ?tag=TEST in it.
12) Confirmed the URL in the checked out list on your reading
    history page contained ?tag=TEST in it.
13) Confirmed links worked (went to expected page)
14) run koha qa test tools

Followed test plan. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer  <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Mark Tompsett 2016-06-21 14:49:32 -04:00 committed by Kyle M Hall
parent 9a3ad32e46
commit 463c5a0f25
4 changed files with 31 additions and 8 deletions

View file

@ -4,6 +4,12 @@
[% USE Branches %] [% USE Branches %]
[% USE Biblio %] [% USE Biblio %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
[% ELSE %]
[% AmazonAssocTag = '' %]
[% END %]
[% ShowCourseReserves = 0 %] [% ShowCourseReserves = 0 %]
[% IF UseCourseReserves %] [% IF UseCourseReserves %]
[% FOREACH item IN itemloop %] [% FOREACH item IN itemloop %]
@ -434,7 +440,7 @@ function verify_images() {
[% END %] [% END %]
[% IF ( AmazonCoverImages ) %] [% IF ( AmazonCoverImages ) %]
<div id="amazon-bookcoverimg"> <div id="amazon-bookcoverimg">
<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"> <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %][% AmazonAssocTag %]#reader-link">
<img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /> <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" />
</a></div> </a></div>
[% END %] [% END %]
@ -508,7 +514,7 @@ function verify_images() {
[% END %] [% END %]
[% IF ( AmazonCoverImages ) %] [% IF ( AmazonCoverImages ) %]
<div id="amazon-bookcoverimg"> <div id="amazon-bookcoverimg">
<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"> <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %][% AmazonAssocTag %]#reader-link">
<img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /> <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" />
</a> </a>
</div> </div>
@ -1045,7 +1051,7 @@ function verify_images() {
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %] [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]
<div id="editions"><h4>Editions</h4> <div id="editions"><h4>Editions</h4>
<table> <table>
[% FOREACH XISBN IN XISBNS %]<tr>[% IF ( AmazonCoverImages ) %]<td><a href="http://www.amazon.com/gp/reader/[% XISBN.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% XISBN.normalized_isbn %].01._AA75_PU_PU-5_.jpg" /></a></td>[% END %] [% FOREACH XISBN IN XISBNS %]<tr>[% IF ( AmazonCoverImages ) %]<td><a href="http://www.amazon.com/gp/reader/[% XISBN.normalized_isbn %][% AmazonAssocTag %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% XISBN.normalized_isbn %].01._AA75_PU_PU-5_.jpg" /></a></td>[% END %]
[% UNLESS ( item_level_itypes ) %]<td>[% IF ( noItemTypeImages ) %][% XISBN.description %][% ELSE %]<img src="[% XISBN.imageurl %]" alt="[% XISBN.description %]" title="[% XISBN.description %]">[% END %]</td>[% END %] [% UNLESS ( item_level_itypes ) %]<td>[% IF ( noItemTypeImages ) %][% XISBN.description %][% ELSE %]<img src="[% XISBN.imageurl %]" alt="[% XISBN.description %]" title="[% XISBN.description %]">[% END %]</td>[% END %]
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% XISBN.biblionumber %]">[% XISBN.title |html %]</a> by [% XISBN.author | html %] &copy;[% XISBN.copyrightdate %] <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% XISBN.biblionumber %]">[% XISBN.title |html %]</a> by [% XISBN.author | html %] &copy;[% XISBN.copyrightdate %]
[% IF ( XISBN.publishercode ) %] [% IF ( XISBN.publishercode ) %]

View file

@ -5,6 +5,11 @@
[% USE AuthorisedValues %] [% USE AuthorisedValues %]
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %]
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
[% ELSE %]
[% AmazonAssocTag = '' %]
[% END %]
[% ShowCourseReservesHeader = 0 %] [% ShowCourseReservesHeader = 0 %]
[% IF Koha.Preference( 'UseCourseReserves' ) == 1 %] [% IF Koha.Preference( 'UseCourseReserves' ) == 1 %]
@ -55,9 +60,9 @@
[% END %] [% END %]
[% IF ( OPACAmazonCoverImages ) %] [% IF ( OPACAmazonCoverImages ) %]
[% IF ( OPACURLOpenInNewWindow ) %] [% IF ( OPACURLOpenInNewWindow ) %]
<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank" rel="noreferrer"> <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %][% AmazonAssocTag %]#reader-link" target="_blank" rel="noreferrer">
[% ELSE %] [% ELSE %]
<a href="http://www.amazon[% AmazonTld %]/dp/[% normalized_isbn %]"> <a href="http://www.amazon[% AmazonTld %]/dp/[% normalized_isbn %][% AmazonAssocTag %]">
[% END %] [% END %]
<img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="Cover image" /></a> <img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="Cover image" /></a>
[% END %] [% END %]

View file

@ -10,6 +10,12 @@
[% INCLUDE 'bodytag.inc' bodyid='opac-readingrecord' %] [% INCLUDE 'bodytag.inc' bodyid='opac-readingrecord' %]
[% INCLUDE 'masthead.inc' %] [% INCLUDE 'masthead.inc' %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
[% ELSE %]
[% AmazonAssocTag = '' %]
[% END %]
<div class="main"> <div class="main">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li> <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
@ -89,7 +95,7 @@
<td> <td>
[% IF OPACAmazonCoverImages %] [% IF OPACAmazonCoverImages %]
[% IF issue.normalized_isbn %] [% IF issue.normalized_isbn %]
<a href="http://www.amazon.com/gp/reader/[% issue.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% issue.normalized_isbn %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail" /></a> <a href="http://www.amazon.com/gp/reader/[% issue.normalized_isbn %][% AmazonAssocTag %]#reader-link"><img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% issue.normalized_isbn %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail" /></a>
[% ELSE %] [% ELSE %]
<span class="no-image">No cover image available</span> <span class="no-image">No cover image available</span>
[% END %] [% END %]

View file

@ -15,6 +15,12 @@
[% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %] [% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %] [% INCLUDE 'masthead.inc' %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
[% ELSE %]
[% AmazonAssocTag = '' %]
[% END %]
<div class="main"> <div class="main">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li> <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
@ -197,7 +203,7 @@ Using this account is not recommended because some parts of Koha will not functi
[% IF ( OPACAmazonCoverImages ) %] [% IF ( OPACAmazonCoverImages ) %]
[% IF ( ISSUE.normalized_isbn ) %] [% IF ( ISSUE.normalized_isbn ) %]
<a href="http://www.amazon.com/gp/reader/[% ISSUE.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% ISSUE.normalized_isbn %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail"/></a> <a href="http://www.amazon.com/gp/reader/[% ISSUE.normalized_isbn %][% AmazonAssocTag %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% ISSUE.normalized_isbn %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail"/></a>
[% ELSE %] [% ELSE %]
<a href="#"><span class="no-image">No cover image available</span></a> <a href="#"><span class="no-image">No cover image available</span></a>
[% END %] [% END %]
@ -467,7 +473,7 @@ Using this account is not recommended because some parts of Koha will not functi
<td class="jacketcell"> <td class="jacketcell">
[% IF ( OPACAmazonCoverImages ) %] [% IF ( OPACAmazonCoverImages ) %]
[% IF ( OVERDUE.normalized_isbn ) %] [% IF ( OVERDUE.normalized_isbn ) %]
<a href="http://www.amazon.com/gp/reader/[% OVERDUE.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% OVERDUE.normalized_isbn %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail" /></a> <a href="http://www.amazon.com/gp/reader/[% OVERDUE.normalized_isbn %][% AmazonAssocTag %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% OVERDUE.normalized_isbn %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail" /></a>
[% ELSE %] [% ELSE %]
<a href="#"><span class="no-image">No cover image available</span></a> <a href="#"><span class="no-image">No cover image available</span></a>
[% END %] [% END %]