From e1f92e91dfdd1d3aeed4b4642969b3246dc92832 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 21 Feb 2020 12:56:53 +0000 Subject: [PATCH] Bug 17896: load BakerTaylor module with use We are incinsistent here, Amazon and Syndetics module are always loaeded in some places BakerTaylor is conditional everywhere, and causes issues under plack For simplicity sake I think we should just load this (small) module where it might be needed To test: 1 - Disable Baker and Taylor images 2 - Restart plack 3 - Visit opac-readingrecord, opac-detail, opac-search, opac-shelves, opac-user Log in to opac Virew your reading history Make/view a list Search the catalog Look at an individual title 4 - Enable BakerTaylorEnabled If you don't have Baker and Taylor credentials, simply fudge them with bad data and enable 5 - Repeat steps above, in the word of Joubu "Kaboom" 6 - Apply patch 7 - Repeat 1-4 8 - You shoudl be able to load all the pages after enabling the pref Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- opac/opac-detail.pl | 9 ++------- opac/opac-readingrecord.pl | 9 ++------- opac/opac-search.pl | 9 ++------- opac/opac-shelves.pl | 2 ++ opac/opac-user.pl | 9 ++------- 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 07655b2a4e..461d5c3ec1 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -34,6 +34,8 @@ use C4::Circulation; use C4::Tags qw(get_tags); use C4::XISBN qw(get_xisbns); use C4::External::Amazon; +use C4::External::BakerTaylor; +use C4::External::BakerTaylor qw(&image_url &link_url); use C4::External::Syndetics qw(get_syndetics_index get_syndetics_summary get_syndetics_toc get_syndetics_excerpt get_syndetics_reviews get_syndetics_anotes ); use C4::Members; use C4::XSLT; @@ -61,13 +63,6 @@ use Koha::Patrons; use Koha::Ratings; use Koha::Reviews; -BEGIN { - if (C4::Context->preference('BakerTaylorEnabled')) { - require C4::External::BakerTaylor; - import C4::External::BakerTaylor qw(&image_url &link_url); - } -} - my $query = CGI->new(); my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0; diff --git a/opac/opac-readingrecord.pl b/opac/opac-readingrecord.pl index 8a561a5ede..745e77c276 100755 --- a/opac/opac-readingrecord.pl +++ b/opac/opac-readingrecord.pl @@ -25,6 +25,8 @@ use C4::Koha; use C4::Biblio; use C4::Circulation; use C4::Members; +use C4::External::BakerTaylor; +use C4::External::BakerTaylor qw(&image_url &link_url); use Koha::DateUtils; use MARC::Record; @@ -138,13 +140,6 @@ if (C4::Context->preference('BakerTaylorEnabled')) { ); } -BEGIN { - if (C4::Context->preference('BakerTaylorEnabled')) { - require C4::External::BakerTaylor; - import C4::External::BakerTaylor qw(&image_url &link_url); - } -} - for(qw(AmazonCoverImages GoogleJackets)) { # BakerTaylorEnabled handled above C4::Context->preference($_) or next; $template->param($_=>1); diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 91a4c42481..2470779444 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -51,6 +51,8 @@ use C4::Koha; use C4::Tags qw(get_tags); use C4::SocialData; use C4::External::OverDrive; +use C4::External::BakerTaylor; +use C4::External::BakerTaylor qw(&image_url &link_url); use Koha::Libraries; use Koha::ItemTypes; @@ -89,13 +91,6 @@ if ( $branch_group_limit ) { } } -BEGIN { - if (C4::Context->preference('BakerTaylorEnabled')) { - require C4::External::BakerTaylor; - import C4::External::BakerTaylor qw(&image_url &link_url); - } -} - my ($template,$borrowernumber,$cookie); # decide which template to use my $template_name; diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 802366d994..f3caed682a 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -22,6 +22,8 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth; use C4::Biblio; +use C4::External::BakerTaylor; +use C4::External::BakerTaylor qw(&image_url &link_url); use C4::Koha; use C4::Items; use C4::Members; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 6c55ad2965..c6ca9c7b87 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -24,6 +24,8 @@ use CGI qw ( -utf8 ); use C4::Auth; use C4::Koha; use C4::Circulation; +use C4::External::BakerTaylor; +use C4::External::BakerTaylor qw(&image_url &link_url); use C4::Reserves; use C4::Members; use C4::Members::AttributeTypes; @@ -56,13 +58,6 @@ use Date::Calc qw( my $query = new CGI; -BEGIN { - if (C4::Context->preference('BakerTaylorEnabled')) { - require C4::External::BakerTaylor; - import C4::External::BakerTaylor qw(&image_url &link_url); - } -} - # CAS single logout handling # Will print header and exit C4::Context->preference('casAuthentication') and C4::Auth_with_cas::logout_if_required($query); -- 2.39.5