Koha/C4/External/Amazon.pm
Owen Leonard d1bf2238c4 Bug 21403: Add Indian Amazon Affiliate option to AmazonLocale setting
This patch adds an "IN" option to the AmazonLocale setting, allowing
Indian libraries to use their Amazon Affiliate ID in Koha's links to
Amazon.

To test, apply the patch and run updatedatabase.

- Go to Administration -> System preferences -> Enhanced content.
- Enable the OPACAmazonCoverImages preference.
- Enter a dummy ID in the AmazonAssocTag preference.
- Confirm that you can select "Indian" for the AmazonLocale preference.
- Select "Indian" and save.
- Open a record in the OPAC and confirm that the cover image links to
  Amazon.in and includes the ID you entered in AmazonAssocTag.
- Do the same with a record in the staff client.

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-10-02 00:03:03 +00:00

82 lines
1.6 KiB
Perl

package C4::External::Amazon;
# Copyright (C) 2006 LibLime
# <jmf at liblime dot com>
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
use warnings;
use vars qw(@ISA @EXPORT);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
get_amazon_tld
);
}
sub get_amazon_tld {
my %tld = (
CA => '.ca',
DE => '.de',
FR => '.fr',
IN => '.in',
JP => '.jp',
UK => '.co.uk',
US => '.com',
);
my $locale = C4::Context->preference('AmazonLocale');
my $tld = $tld{ $locale } || '.com'; # default top level domain is .com
return $tld;
}
=head1 NAME
C4::External::Amazon - Functions for retrieving Amazon.com content in Koha
=head2 FUNCTIONS
This module provides facilities for retrieving Amazon.com content in Koha
=over
=item get_amazon_tld()
Get Amazon Top Level Domain depending on Amazon local preference: AmazonLocal.
For example, if AmazonLocal is 'UK', returns '.co.uk'.
=back
=cut
1;
__END__
=head1 NOTES
=cut
=head1 AUTHOR
Joshua Ferraro <jmf@liblime.com>
=cut