Bugzilla – Attachment 162876 Details for
Bug 36244
Template toolkit syntax not escaped in letter templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36244: Unit test for tt syntax in parameters
Bug-36244-Unit-test-for-tt-syntax-in-parameters.patch (text/plain), 2.70 KB, created by
Marcel de Rooy
on 2024-03-07 10:01:31 UTC
(
hide
)
Description:
Bug 36244: Unit test for tt syntax in parameters
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-03-07 10:01:31 UTC
Size:
2.70 KB
patch
obsolete
>From 338c801271c23eb3773cf66c89c2364efce2f084 Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Thu, 7 Mar 2024 09:07:49 +0000 >Subject: [PATCH] Bug 36244: Unit test for tt syntax in parameters >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Letters.t | 47 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 46 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index ade28f89ad..8295c63baa 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 99; >+use Test::More tests => 100; > use Test::MockModule; > use Test::Warn; > use Test::Exception; >@@ -1410,3 +1410,48 @@ subtest 'Test message_id parameter for SendQueuedMessages' => sub { > is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); > is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); > }; >+ >+subtest 'Template toolkit syntax in parameters' => sub { >+ >+ my $borrowernumber = Koha::Patron->new( >+ { >+ firstname => 'Robert', >+ surname => '[% USE Categories %][% Categories.all().search_related("borrowers").count() %]', >+ categorycode => $patron_category, >+ branchcode => $library->{branchcode}, >+ dateofbirth => $date, >+ smsalertnumber => undef, >+ } >+ )->store->borrowernumber; >+ >+ my $title = q|<<branches.branchname>> - <<status>>|; >+ my $content = q{Dear <<borrowers.firstname>> <<borrowers.surname>>}; >+ >+ $dbh->do( >+ q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,'my module','tt test','my name',1,?,?,'email')|, >+ undef, $library->{branchcode}, $title, $content >+ ); >+ >+ my $tables = { >+ borrowers => $borrowernumber, >+ branches => $library->{branchcode}, >+ biblio => $biblionumber, >+ }; >+ my $substitute = { >+ status => 'overdue', >+ }; >+ my $prepared_letter = GetPreparedLetter( >+ module => 'my module', >+ branchcode => $library->{branchcode}, >+ letter_code => 'tt test', >+ tables => $tables, >+ substitute => $substitute, >+ repeat => [], >+ ); >+ >+ is( >+ $prepared_letter->{content}, >+ 'Dear Robert [% USE Categories %][% Categories.all().search_related("borrowers").count() %]', >+ 'Template toolkit syntax in parameter was not evaluated.' >+ ); >+}; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36244
:
162866
|
162867
|
162868
|
162871
|
162872
|
162876
|
162877
|
162908
|
162909
|
162910
|
163255
|
163256
|
163257
|
163383
|
163384
|
163385