Bug 33045: Use process_tt in C4::Record::marcrecord2csv

Bug 33030 implements a new helper subroutine to standardize processing of Template Toolkit syntax outside slips and notices. We should use this subroutine in marcrecord2csv.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Record/marcrecord2csv.t

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle Hall 2023-02-22 13:16:35 -05:00 committed by Tomas Cohen Arazi
parent 93d4defeda
commit d00feafe75
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -38,6 +38,7 @@ use Koha::SimpleMARC qw( read_field );
use Koha::XSLT::Base;
use Koha::CsvProfiles;
use Koha::AuthorisedValues;
use Koha::TemplateUtils qw( process_tt );
use Carp qw( carp croak );
use vars qw(@ISA @EXPORT);
@ -564,13 +565,10 @@ sub marcrecord2csv {
# TT tags exist
if ( $content =~ m|\[\%.*\%\]| ) {
my $tt = Template->new();
my $template = $content;
# Replace 00X and 0XX with X or XX
$content =~ s|fields.00(\d)|fields.$1|g;
$content =~ s|fields.0(\d{2})|fields.$1|g;
my $tt_output;
$tt->process( \$content, $field_list, \$tt_output );
my $tt_output = process_tt( $content, $field_list );
push @csv_rows, $tt_output;
} else {
for my $tag ( @$tags ) {