diff options
Diffstat (limited to 'LedgerSMB/Template/CSV.pm')
-rwxr-xr-x | LedgerSMB/Template/CSV.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/LedgerSMB/Template/CSV.pm b/LedgerSMB/Template/CSV.pm index 9700a18a..50edef15 100755 --- a/LedgerSMB/Template/CSV.pm +++ b/LedgerSMB/Template/CSV.pm @@ -38,6 +38,9 @@ holders, see the CONTRIBUTORS file. package LedgerSMB::Template::CSV; +use warnings; +use strict; + use Error qw(:try); use Template; use LedgerSMB::Template::TTI18N; @@ -54,12 +57,17 @@ sub preprocess { #XXX fix escaping function return $rawvars if $type =~ /^LedgerSMB::Locale/; + return unless defined $rawvars; if ( $type eq 'ARRAY' ) { for (@{$rawvars}) { push @{$vars}, preprocess( $_ ); } - } elsif ( !$type ) { # Scalar - $vars = $rawvars; + } elsif ( !$type or $type eq 'SCALAR' ) { # Scalar + if ($type eq 'SCALAR' ) { + $vars = $$rawvars; + } else { + $vars = $rawvars; + } $vars =~ s/(^ +| +$)//g; $vars =~ s/"/""/g; $vars = qq|"$vars"| if $vars !~ /^\w*$/; |