Bugzilla – Attachment 153144 Details for
Bug 33041
Use process_tt in C4::Serial::NewIssue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33041: Use process_tt in C4::Serial::NewIssue
Bug-33041-Use-processtt-in-C4SerialNewIssue.patch (text/plain), 4.29 KB, created by
Marcel de Rooy
on 2023-07-07 09:53:56 UTC
(
hide
)
Description:
Bug 33041: Use process_tt in C4::Serial::NewIssue
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-07-07 09:53:56 UTC
Size:
4.29 KB
patch
obsolete
>From f5a4722a0cb66d1aed7a88dff300780f46140d01 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Wed, 22 Feb 2023 11:47:12 -0500 >Subject: [PATCH] Bug 33041: Use process_tt in C4::Serial::NewIssue >Content-Type: text/plain; charset=utf-8 > >Bug 33030 implements a new helper subroutine to standardize processing of Template Toolkit syntax outside slips and notices. We should use this subroutine in C4::Serial::NewIssue > >Test Plan: >1) Apply this patch >2) prove t/db_dependent/Koha/Items.t > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Serials.pm | 69 ++++++++++++++------------------------------------- > 1 file changed, 18 insertions(+), 51 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 40a4d1acd7..b01172dc10 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -47,6 +47,7 @@ use Koha::SharedContent; > use Koha::Subscription::Histories; > use Koha::Subscriptions; > use Koha::Suggestions; >+use Koha::TemplateUtils qw( process_tt ); > > # Define statuses > use constant { >@@ -1595,58 +1596,24 @@ sub NewIssue { > my $subscription = Koha::Subscriptions->find( $subscriptionid ); > > if ( my $template = $subscription->published_on_template ) { >- # If we detect a TT opening tag, run string through Template Toolkit Processor >- if ( index( $template, '[%' ) != -1 ) { # Much faster than regex >- my $use_template_cache = C4::Context->config('template_cache_dir') >- && defined $ENV{GATEWAY_INTERFACE}; >- >- my $tt = Template->new( >- { >- EVAL_PERL => 1, >- ABSOLUTE => 1, >- PLUGIN_BASE => 'Koha::Template::Plugin', >- COMPILE_EXT => $use_template_cache ? '.ttc' : '', >- COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', >- FILTERS => {}, >- ENCODING => 'UTF-8', >- } >- ) or die Template->error(); >- >- my $schema = Koha::Database->new->schema; >- >- $schema->txn_begin; >- try { >- my $text; >- $tt->process( >- \$template, >- { >- subscription => $subscription, >- serialseq => $serialseq, >- serialseq_x => $subscription->lastvalue1(), >- serialseq_y => $subscription->lastvalue2(), >- serialseq_z => $subscription->lastvalue3(), >- subscriptionid => $subscriptionid, >- biblionumber => $biblionumber, >- status => $status, >- planneddate => $planneddate, >- publisheddate => $publisheddate, >- publisheddatetext => $publisheddatetext, >- notes => $notes, >- routingnotes => $routingnotes, >- }, >- \$text >- ); >- $publisheddatetext = $text; >- } >- catch { >- croak "ERROR PROCESSING TEMPLATE: $_ :: " . $template->error(); >+ $publisheddatetext = process_tt( >+ $template, >+ { >+ subscription => $subscription, >+ serialseq => $serialseq, >+ serialseq_x => $subscription->lastvalue1(), >+ serialseq_y => $subscription->lastvalue2(), >+ serialseq_z => $subscription->lastvalue3(), >+ subscriptionid => $subscriptionid, >+ biblionumber => $biblionumber, >+ status => $status, >+ planneddate => $planneddate, >+ publisheddate => $publisheddate, >+ publisheddatetext => $publisheddatetext, >+ notes => $notes, >+ routingnotes => $routingnotes, > } >- finally { >- $schema->txn_rollback; >- }; >- } else { >- $publisheddatetext = $template; >- } >+ ); > } > > my $serial = Koha::Serial->new( >-- >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 33041
:
147175
|
150515
| 153144