[Koha-bugs] [Bug 33039] Add ability to specify a template for serial subscription "Published on (text)" field

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Apr 28 18:09:39 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33039

Kyle M Hall <kyle at bywatersolutions.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Failed QA                   |Signed Off

--- Comment #15 from Kyle M Hall <kyle at bywatersolutions.com> ---
(In reply to Marcel de Rooy from comment #14)
> +        if ( index( $template, '[%' ) != -1 ) { # Much faster than regex
> No problem, but 'much' sounds like exaggerating :) Just in memory..

https://stackoverflow.com/questions/30744379/unanchored-substring-searching-index-vs-regex

> 
> This call worries me:
> +            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();
> Would prefer to see calling something central like in C4::Templates or in
> C4::Letters instead.

Bug 33041 already handles that

> 
> +            $schema->txn_begin;
> +            try {
> +                my $text;
> +                $tt->process(
> Please explain why a process call would need a transaction. Can we just
> remove it ?

Please have a look at C4::Letters. This is now standard procedure for template
processing.


> Could generating alternative text via a Koha plugin be easier somehow? And
> without needing a db revision ?
> Note that we already have:
> Koha/Plugins/Base.pm:    $args->{'template'} = Template->new( { ABSOLUTE =>
> 1, ENCODING => 'UTF-8' } );

That sounds more complicated. If you want to write a POC for that I'd be happy
to take a look.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list