Bug 41479: Remove Baker & Taylor integration

This patch removes Baker & Taylor integration following the shutdown of
the company.

To test, apply the patch, run the database update, and restart all.

- In the staff interface go to Administration -> System preferences and
  search for 'Baker.' There should be no results.
- If necessary enable at least one cover image service, e.g.
  AmazonCoverImages, OpacCoce, GoogleJackets, etc.
- Log in to the OPAC and confirm that cover images display correctly on
  these pages:
   - Search results
   - Bibliographic detail page
   - Shelf browser
   - Your summary -> Checked out
     - Checkout history
   - Recent comments
   - Lists

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Owen Leonard 2025-12-18 08:49:32 -05:00 committed by Martin Renvoize
parent 101f292a5a
commit 41ea86bc27
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
23 changed files with 31 additions and 427 deletions

View File

@ -1,169 +0,0 @@
package C4::External::BakerTaylor;
# Copyright (C) 2008 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 <https://www.gnu.org/licenses>.
use Modern::Perl;
use base 'Exporter';
BEGIN {
our @EXPORT_OK = qw(availability content_cafe_url image_url link_url http_jacket_link);
}
use XML::Simple;
use LWP::Simple qw( get );
use C4::Context;
use vars qw(%EXPORT_TAGS $VERSION);
BEGIN {
$VERSION = 3.07.00.049;
}
# These variables are plack safe: they are initialized each time
my ( $user, $pass, $agent, $image_url, $link_url );
sub _initialize {
$user = ( @_ ? shift : C4::Context->preference('BakerTaylorUsername') ) || ''; # LL17984
$pass = ( @_ ? shift : C4::Context->preference('BakerTaylorPassword') ) || ''; # CC82349
$link_url = ( @_ ? shift : C4::Context->preference('BakerTaylorBookstoreURL') );
$image_url =
"https://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$user&Password=$pass&Options=Y&Return=T&Type=S&Value=";
$agent = "Koha/$VERSION [en] (Linux)";
#"Mozilla/4.76 [en] (Win98; U)", # if for some reason you want to go stealth, you might prefer this
}
sub image_url {
_initialize();
( $user and $pass ) or return;
my $isbn = ( @_ ? shift : '' );
$isbn =~ s/(p|-)//g; # sanitize
return $image_url . $isbn;
}
sub link_url {
_initialize();
my $isbn = ( @_ ? shift : '' );
$isbn =~ s/(p|-)//g; # sanitize
$link_url or return;
return $link_url . $isbn;
}
sub content_cafe_url {
_initialize();
( $user and $pass ) or return;
my $isbn = ( @_ ? shift : '' );
$isbn =~ s/(p|-)//g; # sanitize
return
"https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$user&Password=$pass&Options=Y&ItemKey=$isbn";
}
sub http_jacket_link {
_initialize();
my $isbn = shift or return;
$isbn =~ s/(p|-)//g; # sanitize
my $image = availability($isbn);
my $alt = "Buy this book";
$image and $image = qq(<img class="btjacket" alt="$alt" src="$image" />);
my $link = &link_url($isbn);
unless ($link) { return $image || ''; }
return sprintf qq(<a class="btlink" href="%s">%s</a>), $link, ( $image || $alt );
}
sub availability {
_initialize();
my $isbn = shift or return;
( $user and $pass ) or return;
$isbn =~ s/(p|-)//g; # sanitize
my $url =
"https://contentcafe2.btol.com/ContentCafe/InventoryAvailability.asmx/CheckInventory?UserID=$user&Password=$pass&Value=$isbn";
my $content = get($url);
warn "could not retrieve $url" unless $content;
my $xmlsimple = XML::Simple->new();
my $result = $xmlsimple->XMLin($content);
if ( $result->{Error} ) {
warn "Error returned to " . __PACKAGE__ . " : " . $result->{Error};
}
my $avail = $result->{Availability};
return ( $avail and $avail !~ /^false$/i ) ? &image_url($isbn) : 0;
}
1;
__END__
=head1 NAME
C4::External::BakerTaylor
=head1 DESCRIPTION
Functions for retrieving content from Baker and Taylor, inventory availability and "Content Cafe".
The settings for this module are controlled by System Preferences:
These can be overridden for testing purposes using the initialize function.
=head1 FUNCTIONS
=head2 image_url
Missing POD for image_url.
=head2 link_url
Missing POD for link_url.
=head2 content_cafe_url
Missing POD for content_cafe_url.
=head2 http_jacket_link
Missing POD for http_jacket_link.
=head2 availability($isbn);
$isbn is a isbn string
=head1 NOTES
A request with failed authentication might see this back from Baker + Taylor:
<?xml version="1.0" encoding="utf-8"?>
<InventoryAvailability xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" DateTime="2008-03-07T22:01:25.6520429-05:00" xmlns="http://ContentCafe2.btol.com">
<Key Type="Undefined">string</Key>
<Availability>false</Availability>
<Error>Invalid UserID</Error>
</InventoryAvailability>
Such response will trigger a warning for each request (potentially many). Point being, do not leave this module configured with incorrect username and password in production.
=head1 SEE ALSO
LWP::UserAgent
=head1 AUTHOR
Joe Atzberger
atz AT liblime DOT com
=cut

View File

@ -242,7 +242,6 @@ sub _shared_preferences {
AmazonCoverImages
OPACAmazonCoverImages
Babeltheque
BakerTaylorEnabled
GoogleJackets
HTML5MediaEnabled
LibraryThingForLibrariesEnabled

View File

@ -0,0 +1,15 @@
use Modern::Perl;
return {
bug_number => "41479",
description =>
"Remove system preferences BakerTaylorBookstoreURL, BakerTaylorEnabled, BakerTaylorPassword, BakerTaylorUsername",
up => sub {
my ($args) = @_;
my $dbh = $args->{dbh};
$dbh->do(
q{ DELETE FROM systempreferences WHERE variable IN ('BakerTaylorBookstoreURL', 'BakerTaylorEnabled', 'BakerTaylorPassword', 'BakerTaylorUsername')}
);
},
}

View File

@ -118,10 +118,6 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES
('Babeltheque','0'),
('Babeltheque_url_js',''),
('Babeltheque_url_update',''),
('BakerTaylorBookstoreURL',''),
('BakerTaylorEnabled','0'),
('BakerTaylorPassword',''),
('BakerTaylorUsername',''),
('BarcodeSeparators','\\s\\r\\n'),
('BasketConfirmations','1'),
('BatchCheckouts','0'),

View File

@ -64,26 +64,6 @@ Enhanced content:
- pref: Babeltheque_url_update
class: url
- (e.g. http://www.babeltheque.com/.../file.csv.bz2).
Baker and Taylor:
-
- pref: BakerTaylorEnabled
choices:
1: Add
0: "Don't add"
- Baker and Taylor links and cover images to the OPAC and staff interface. This requires that you have entered in a username and password (which can be seen in image links).
-
- 'Baker and Taylor "My Library Bookstore" links should be accessed at <code>https://'
- pref: BakerTaylorBookstoreURL
class: url
- <em>isbn</em></code> (this should be filled in with something like <code>ocls.mylibrarybookstore.com/MLB/actions/searchHandler.do?nextPage=bookDetails&amp;parentNum=10923&amp;key=</code>). Leave it blank to disable these links.
-
- Access Baker and Taylor using username
- pref: BakerTaylorUsername
class: password
- and password
- pref: BakerTaylorPassword
class: password
- .
Novelist Select:
-
- pref: NovelistSelectEnabled

View File

@ -81,22 +81,6 @@
</div>
[% END %]
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
[% IF ( BakerTaylorEnabled && bt_id ) %]
<div class="cover-image bakertaylor-coverimg">
[% IF BakerTaylorBookstoreURL %]
<a href="https://[% BakerTaylorBookstoreURL | url %][% bt_id | url %]">
<img alt="See Baker &amp; Taylor" id="bakertaylor-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" />
</a>
[% ELSE %]
<a href="[% BakerTaylorImageURL | url %][% bt_id | uri %]">
<img alt="See Baker &amp; Taylor" id="bakertaylor-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" />
</a>
[% END %]
<div class="hint">Image from Baker &amp; Taylor</div>
</div>
[% END %]
[% IF OPACCustomCoverImages %]
[% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %]
[% IF custom_cover_image_url %]

View File

@ -157,15 +157,6 @@
[% Asset.js("js/localcovers.js") | $raw %]
[% END %]
[% IF ( BakerTaylorEnabled ) %]
[% Asset.js("js/bakertaylorimages.js") | $raw %]
<script nonce="[% Koha.CSPNonce | $raw %]">
$(window).load(function () {
bt_verify_images();
});
</script>
[% END %]
[% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
<script nonce="[% Koha.CSPNonce | $raw %]">
$("#news-branch-select").change(function () {

View File

@ -32,7 +32,7 @@
[% img_title = item.biblionumber %]
[% END %]
[% IF ( OPACLocalCoverImages || OPACAmazonCoverImages || ( SyndeticsEnabled && SyndeticsCoverImages ) || GoogleJackets || BakerTaylorEnabled || ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) || ( Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') ) ) %]
[% IF ( OPACLocalCoverImages || OPACAmazonCoverImages || ( SyndeticsEnabled && SyndeticsCoverImages ) || GoogleJackets || ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) || ( Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') ) ) %]
<a
class="shelfbrowser_cover"
href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% item.biblionumber | uri %]&amp;shelfbrowse_itemnumber=[% item.itemnumber | uri %]#shelfbrowser"
@ -73,14 +73,6 @@
[% coce_id = item.browser_normalized_ean || item.browser_normalized_isbn | html %]
<div title="[% img_title | html %]" class="[% coce_id | html %]" id="coce-thumbnail-preview-[% coce_id | html %]"></div>
[% END %]
[% IF ( BakerTaylorEnabled ) %]
[% bt_id = ( item.browser_normalized_upc || item.browser_normalized_isbn ) | html %]
[% IF ( bt_id ) %]
<img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = item.biblio_object.custom_cover_image_url %]
[% IF custom_cover_image_url %]

View File

@ -148,22 +148,6 @@
</div>
[% END %]
[% bt_id = ( normalized_upc || normalized_isbn ) %]
[% IF ( BakerTaylorEnabled && bt_id ) %]
<div class="cover-image" id="bakertaylor-coverimg">
[% IF BakerTaylorBookstoreURL %]
<a href="https://[% BakerTaylorBookstoreURL | url %][% bt_id | url %]">
<img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" />
</a>
[% ELSE %]
<a href="[% BakerTaylorImageURL | url %][% bt_id | uri %]">
<img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" />
</a>
[% END %]
<div class="hint">Image from Baker &amp; Taylor</div>
</div>
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = biblio.custom_cover_image_url %]
[% IF custom_cover_image_url %]
@ -405,13 +389,6 @@
</form>
[% END # / IF OpacStarRatings != 'disable' %]
[% IF ( BakerTaylorContentURL ) %]
<span class="results_summary">
<span class="label">Enhanced content: </span>
[% IF ( OPACURLOpenInNewWindow ) %]<a href="[% BakerTaylorContentURL | url %]" target="_blank" rel="noreferrer">Content Cafe</a>[% ELSE %]<a href="[% BakerTaylorContentURL | url %]">Content Cafe</a>[% END %]
</span>
[% END # / IF BakerTaylorContentURL %]
[% IF ( NovelistSelectProfile && (normalized_isbn || normalized_upc) ) %]
[% IF ( NovelistSelectView == 'above') %]
<span class="results_summary NovelistSelect" style="display:none;">
@ -1793,8 +1770,6 @@
}
div.find(".hint").html(coce_description);
lightbox_descriptions.push(coce_description);
} else if (div.attr("id") == "bakertaylor-coverimg") {
lightbox_descriptions.push(_("Image from Baker &amp; Taylor"));
} else if (div.attr("class") == "cover-image local-coverimg") {
lightbox_descriptions.push(_("Local cover image"));
} else {

View File

@ -80,12 +80,6 @@
[% END %]
[% END %]
[% END %]
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
[% IF ( BakerTaylorEnabled ) %]
[% IF bt_id %]
<![CDATA[ <a href="https://[% BakerTaylorBookstoreURL |url %][% bt_id | uri %]"><img alt="See Baker &#38; Taylor" src="[% BakerTaylorImageURL |url %][% bt_id | uri %]" /></a> ]]>
[% END %]
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %]
@ -192,12 +186,6 @@
[% END %]
[% END %]
[% END %]
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
[% IF ( BakerTaylorEnabled ) %]
[% IF bt_id %]
<a href="https://[% BakerTaylorBookstoreURL |url %][% bt_id | uri %]"><img alt="See Baker &#38; Taylor" src="[% BakerTaylorImageURL |url %][% bt_id | uri %]" /></a>
[% END %]
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %]

View File

@ -164,19 +164,8 @@
[% END %]
[% END %]
[% IF Koha.Preference( "BakerTaylorEnabled" ) || Koha.Preference( "SyndeticsEnabled" ) && Koha.Preference( "SyndeticsCoverImages" ) %]
[% IF Koha.Preference( "SyndeticsEnabled" ) && Koha.Preference( "SyndeticsCoverImages" ) %]
[% SET normalized_upc = biblio.normalized_upc %]
[% END %]
[% IF Koha.Preference( "BakerTaylorEnabled" ) %]
[% bt_id = ( normalized_upc || normalized_isbn ) %]
[% IF ( bt_id ) %]
<a href="https://[% Koha.Preference( "BakerTaylorBookstoreURL" ) | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF SyndeticsEnabled && SyndeticsCoverImages %]
<img
src="https://secure.syndetics.com/index.aspx?isbn=[% normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% normalized_upc | html %]&amp;oclc=[% biblio.normalized_oclc | html %]"
alt=""

View File

@ -22,10 +22,9 @@
[% SET SyndeticsCoverImages = ( Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') ) %]
[% SET GoogleJackets = Koha.Preference('GoogleJackets') %]
[% SET OpenLibraryCovers = Koha.Preference('OpenLibraryCovers') %]
[% SET BakerTaylorEnabled = Koha.Preference('BakerTaylorEnabled') %]
[% SET OPACCoce = ( Koha.Preference('OPACCoce') && Koha.Preference('CoceProviders') ) %]
[% SET OPACCustomCoverImages = ( Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') ) %]
[% IF ( CoverImagePlugins || OPACLocalCoverImages || OPACAmazonCoverImages || SyndeticsCoverImages || GoogleJackets || OpenLibraryCovers || BakerTaylorEnabled || OPACCoce || OPACCustomCoverImages ) %]
[% IF ( CoverImagePlugins || OPACLocalCoverImages || OPACAmazonCoverImages || SyndeticsCoverImages || GoogleJackets || OpenLibraryCovers || OPACCoce || OPACCustomCoverImages ) %]
[% SET CoverImages = 1 %]
[% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %]
[% END %]

View File

@ -25,9 +25,8 @@
[% SET SyndeticsCoverImages = ( Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') ) %]
[% SET GoogleJackets = Koha.Preference('GoogleJackets') %]
[% SET OpenLibraryCovers = Koha.Preference('OpenLibraryCovers') %]
[% SET BakerTaylorEnabled = Koha.Preference('BakerTaylorEnabled') %]
[% SET OPACCoce = ( Koha.Preference('OPACCoce') && Koha.Preference('CoceProviders') ) %]
[% IF ( CoverImagePlugins || OPACLocalCoverImages || OPACAmazonCoverImages || SyndeticsCoverImages || GoogleJackets || OpenLibraryCovers || BakerTaylorEnabled || OPACCoce || OPACCustomCoverImages ) %]
[% IF ( CoverImagePlugins || OPACLocalCoverImages || OPACAmazonCoverImages || SyndeticsCoverImages || GoogleJackets || OpenLibraryCovers || OPACCoce || OPACCustomCoverImages ) %]
[% SET CoverImages = 1 %]
[% SET OPACCustomCoverImages = ( Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') ) %]
[% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %]

View File

@ -33,11 +33,6 @@
/>
[% END %][% END %][% END %]
[% bt_id = ( review.normalized_upc || review.normalized_isbn ) %]
[% IF ( BakerTaylorEnabled && bt_id ) %]
<a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = review.biblio_object.custom_cover_image_url %]
[% IF custom_cover_image_url %]

View File

@ -146,14 +146,6 @@
[% END %]
[% END %]
</a>
[% bt_id = ( review.normalized_upc || review.normalized_isbn ) %]
[% IF ( BakerTaylorEnabled ) %]
[% IF ( bt_id ) %]
<a href="https://[% review.BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% review.BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = review.biblio_object.custom_cover_image_url %]

View File

@ -366,16 +366,6 @@
[% END %]
[% END %]
[% IF ( BakerTaylorEnabled ) %]
[% bt_id = ( ISSUE.normalized_upc || ISSUE.normalized_isbn ) %]
[% IF ( bt_id ) %]
<a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span
><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
[% END %]
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = ISSUE.biblio_object.custom_cover_image_url %]
[% IF custom_cover_image_url %]
@ -737,16 +727,6 @@
[% END %]
[% END %]
[% IF ( BakerTaylorEnabled ) %]
[% bt_id = ( OVERDUE.normalized_upc || OVERDUE.normalized_isbn ) %]
[% IF ( bt_id ) %]
<a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span
><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
[% END %]
[% END %]
[% IF ( SyndeticsCoverImages ) %]
<img
src="https://secure.syndetics.com/index.aspx?isbn=[% OVERDUE.normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | html %]&amp;upc=[% OVERDUE.normalized_upc | html %]&amp;oclc=[% OVERDUE.normalized_oclc | html %]&amp;type=xw10"

View File

@ -73,10 +73,6 @@ function verify_cover_images() {
}
div.find(".hint").html(coce_description);
lightbox_descriptions.push(coce_description);
} else if (div.hasClass("bakertaylor-coverimg")) {
lightbox_descriptions.push(
__("Image from Baker &amp; Taylor")
);
} else if (div.hasClass("cover-image local-coverimg")) {
lightbox_descriptions.push(__("Local cover image"));
} else {

View File

@ -43,12 +43,11 @@ use C4::Biblio qw(
GetMarcSubjects
GetMarcUrls
);
use C4::Record qw( marc2cites );
use C4::Tags qw( get_tags );
use C4::XISBN qw( get_xisbns );
use C4::External::Amazon qw( get_amazon_tld );
use C4::External::BakerTaylor qw( image_url link_url );
use C4::External::Syndetics qw(
use C4::Record qw( marc2cites );
use C4::Tags qw( get_tags );
use C4::XISBN qw( get_xisbns );
use C4::External::Amazon qw( get_amazon_tld );
use C4::External::Syndetics qw(
get_syndetics_anotes
get_syndetics_excerpt
get_syndetics_index
@ -1143,27 +1142,6 @@ 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,
BakerTaylorImageURL => &image_url(),
BakerTaylorLinkURL => &link_url(),
BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
);
my ( $bt_user, $bt_pass );
if ( $isbn
and $bt_user = C4::Context->preference('BakerTaylorUsername')
and $bt_pass = C4::Context->preference('BakerTaylorPassword') )
{
$template->param(
BakerTaylorContentURL => sprintf(
"https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y",
$bt_user, $bt_pass, $isbn
)
);
}
}
my $tag_quantity;
if ( C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail') ) {
$template->param(

View File

@ -21,7 +21,6 @@ use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Biblio;
use C4::External::BakerTaylor qw( image_url link_url );
use MARC::Record;
use C4::Output qw( output_html_with_http_headers );
@ -87,14 +86,6 @@ my $old_checkouts = [
)->as_list
];
if ( C4::Context->preference('BakerTaylorEnabled') ) {
$template->param(
JacketImages => 1,
BakerTaylorImageURL => &image_url(),
BakerTaylorLinkURL => &link_url(),
);
}
my $saving_display = C4::Context->preference('OPACShowSavings');
if ( $saving_display =~ /checkouthistory/ ) {
$template->param( savings => $patron->get_savings );

View File

@ -54,7 +54,6 @@ use C4::Koha qw( GetItemTypesCategorized getitemtypeimagelocation GetAuthorise
use C4::Tags qw( get_tags );
use C4::SocialData;
use C4::External::OverDrive;
use C4::External::BakerTaylor qw( image_url link_url );
use Koha::CirculationRules;
use Koha::Libraries;
@ -173,15 +172,6 @@ $template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResults
$template->param( OpacStarRatings => C4::Context->preference("OpacStarRatings") );
if ( C4::Context->preference('BakerTaylorEnabled') ) {
$template->param(
BakerTaylorEnabled => 1,
BakerTaylorImageURL => &image_url(),
BakerTaylorLinkURL => &link_url(),
BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
);
}
## URI Re-Writing
# Deprecated, but preserved because it's interesting :-)
# The same thing can be accomplished with mod_rewrite in

View File

@ -19,11 +19,10 @@
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Biblio qw( GetBiblioData GetFrameworkCode );
use C4::External::BakerTaylor qw( image_url link_url );
use C4::Koha qw(
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Biblio qw( GetBiblioData GetFrameworkCode );
use C4::Koha qw(
GetNormalizedEAN
GetNormalizedISBN
GetNormalizedOCLCNumber
@ -83,13 +82,6 @@ if ( $op eq 'view' || $op eq 'list' ) {
);
}
if ( C4::Context->preference("BakerTaylorEnabled") ) {
$template->param(
BakerTaylorImageURL => &image_url(),
BakerTaylorLinkURL => &link_url(),
);
}
my $referer = $query->param('referer') || $op;
my $page = int( $query->param('page') || 1 );
my $public = 0;

View File

@ -28,9 +28,8 @@ use C4::Koha qw(
GetNormalizedUPC
GetNormalizedOCLCNumber
);
use C4::Circulation qw( CanBookBeRenewed GetRenewCount GetIssuingCharges );
use C4::External::BakerTaylor qw( image_url link_url );
use C4::Reserves qw( GetReserveStatus );
use C4::Circulation qw( CanBookBeRenewed GetRenewCount GetIssuingCharges );
use C4::Reserves qw( GetReserveStatus );
use C4::Members;
use C4::Output qw( output_html_with_http_headers );
use Koha::Account::Lines;
@ -298,8 +297,7 @@ if ( $pending_checkouts->count ) { # Useless test
my $isbn = GetNormalizedISBN( $issue->{'isbn'} );
$issue->{normalized_isbn} = $isbn;
if ( C4::Context->preference('BakerTaylorEnabled')
|| C4::Context->preference('SyndeticsEnabled')
if ( C4::Context->preference('SyndeticsEnabled')
|| C4::Context->preference('SyndeticsCoverImages') )
{
my $marcrecord = $biblio_object->metadata_record(
@ -357,18 +355,8 @@ if ( C4::Context->preference('UseRecalls') ) {
$template->param( RECALLS => $recalls );
}
if ( C4::Context->preference('BakerTaylorEnabled') ) {
$template->param(
BakerTaylorEnabled => 1,
BakerTaylorImageURL => &image_url(),
BakerTaylorLinkURL => &link_url(),
BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
);
}
if ( C4::Context->preference("OPACAmazonCoverImages")
or C4::Context->preference("GoogleJackets")
or C4::Context->preference("BakerTaylorEnabled")
or C4::Context->preference("SyndeticsCoverImages")
or ( C4::Context->preference('OPACCustomCoverImages') and C4::Context->preference('CustomCoverImagesURL') ) )
{

View File

@ -1,36 +0,0 @@
#!/usr/bin/perl
# some simple tests of the elements of C4::External::BakerTaylor that do not require a valid username and password
use Modern::Perl;
use Test::NoWarnings;
use Test::More tests => 10;
use t::lib::Mocks;
BEGIN {
use_ok( 'C4::External::BakerTaylor', qw( link_url image_url content_cafe_url http_jacket_link availability ) );
}
# test with mocked prefs
my $username = "testing_username";
my $password = "testing_password";
my $link_url = "http://wrongexample.com?ContentCafe.aspx?UserID=$username";
t::lib::Mocks::mock_preference( 'BakerTaylorUsername', $username );
t::lib::Mocks::mock_preference( 'BakerTaylorPassword', $password );
t::lib::Mocks::mock_preference( 'BakerTaylorBookstoreURL', $link_url );
my $image_url =
"https://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$username&Password=$password&Options=Y&Return=T&Type=S&Value=";
my $content_cafe =
"https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$username&Password=$password&Options=Y&ItemKey=";
is( C4::External::BakerTaylor::image_url(), $image_url, "testing default image url" );
is( C4::External::BakerTaylor::image_url("aa"), $image_url . "aa", "testing image url construction" );
is( C4::External::BakerTaylor::link_url(), $link_url, "testing default link url" );
is( C4::External::BakerTaylor::link_url("bb"), "${link_url}bb", "testing link url construction" );
is( C4::External::BakerTaylor::content_cafe_url(""), $content_cafe, "testing default content cafe url" );
is( C4::External::BakerTaylor::content_cafe_url("cc"), "${content_cafe}cc", "testing content cafe url construction" );
is( C4::External::BakerTaylor::http_jacket_link(""), undef, "testing empty http jacket link" );
is( C4::External::BakerTaylor::availability(""), undef, "testing empty availability" );