From f2e37db0ff75c59933ff37ed8a4aa92930b95ce2 Mon Sep 17 00:00:00 2001
From: Marcel de Rooy
Date: Fri, 12 Aug 2016 08:29:42 +0200
Subject: [PATCH] Bug 17109: Use Koha.Preference in sendbasket template
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
No need to send OPACBaseURL to the template, if you load the Koha TT
plugin inside the template.
Test plan:
Send a few items in your cart from OPAC and intranet.
Signed-off-by: Marc Véron
Signed-off-by: Jonathan Druart
---
basket/sendbasket.pl | 3 +--
.../intranet-tmpl/prog/en/modules/basket/sendbasket.tt | 6 ++++--
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt | 6 ++++--
opac/opac-sendbasket.pl | 3 +--
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl
index bd0a402d54..d5cbb72355 100755
--- a/basket/sendbasket.pl
+++ b/basket/sendbasket.pl
@@ -61,11 +61,10 @@ if ( $email_add ) {
my $comment = $query->param('comment');
# Since we are already logged in, no need to check credentials again
- # We only need to add OPACBaseURL
+ # when loading a second template.
my $template2 = C4::Templates::gettemplate(
'basket/sendbasket.tt', 'intranet', $query,
);
- $template2->param( OPACBaseURL => C4::Context->preference('OPACBaseURL') );
my @bibs = split( /\//, $bib_list );
my @results;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt
index adb47cd0d5..68e735c549 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt
@@ -1,9 +1,10 @@
+[% USE HtmlToText %]
+[% USE Koha %]
+
Your cart
-[% USE HtmlToText %]
-
[% FILTER html2text %]
@@ -130,6 +131,7 @@ Your cart
[% END %]
+ [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
[% IF ( OPACBaseURL ) %]
In online catalog: [% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt
index 7c7978f496..47d03f1938 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt
@@ -1,9 +1,10 @@
+[% USE HtmlToText %]
+[% USE Koha %]
+
Your cart
-[% USE HtmlToText %]
-
[% FILTER html2text %]
@@ -130,6 +131,7 @@ Your cart
[% END %]
+ [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
[% IF ( OPACBaseURL ) %]
In online catalog: [% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber %]
diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl
index 433f38fda6..c1bbaaa9c9 100755
--- a/opac/opac-sendbasket.pl
+++ b/opac/opac-sendbasket.pl
@@ -74,11 +74,10 @@ if ( $email_add ) {
$mail{'X-Abuse-Report'} = C4::Context->preference('KohaAdminEmailAddress');
# Since we are already logged in, no need to check credentials again
- # We only need to add OPACBaseURL
+ # when loading a second template.
my $template2 = C4::Templates::gettemplate(
'opac-sendbasket.tt', 'opac', $query,
);
- $template2->param( OPACBaseURL => C4::Context->preference('OPACBaseURL') );
my @bibs = split( /\//, $bib_list );
my @results;