summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-11 17:11:08 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-11 17:11:08 +0000
commitf74c8fa213cd5409084ede2de7ea4ed626895955 (patch)
tree53eda6e24d6232a4eea62372316380ea04534aa3
parent9dca25618c909737218f038abedcec5e123b2784 (diff)
Removing some testing steps from CSV escaping
Fixing the mimetype It's comma time git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1566 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/Template/CSV.pm10
-rw-r--r--UI/gl-report.csv6
2 files changed, 6 insertions, 10 deletions
diff --git a/LedgerSMB/Template/CSV.pm b/LedgerSMB/Template/CSV.pm
index cb861e93..c0ff7276 100755
--- a/LedgerSMB/Template/CSV.pm
+++ b/LedgerSMB/Template/CSV.pm
@@ -60,13 +60,9 @@ sub preprocess {
}
} elsif ( !$type ) { # Scalar
$vars = $rawvars;
- $vars =~ s/\&nbsp;/ /;
- $vars =~ s/(\t\n\r )+/ /g;
$vars =~ s/(^ +| +$)//g;
- $vars =~ s/~/\\~/g;
- $vars =~ s/<.*?>//g;
- $vars = qq|"$vars"| if $vars !~ /^\w+$/;
- $vars = '' if $vars =~ /^""$/;
+ $vars =~ s/"/""/g;
+ $vars = qq|"$vars"| if $vars !~ /^\w*$/;
} else { # hashes and objects
for ( keys %{$rawvars} ) {
$vars->{preprocess($_)} = preprocess( $rawvars->{$_} );
@@ -94,7 +90,7 @@ sub process {
"$parent->{outputfile}.csv", binmode => ':utf8')) {
throw Error::Simple $template->error();
}
- $parent->{mimetype} = 'text/plain';
+ $parent->{mimetype} = 'text/csv';
}
sub postprocess {
diff --git a/UI/gl-report.csv b/UI/gl-report.csv
index fc2e4b16..b8b42e71 100644
--- a/UI/gl-report.csv
+++ b/UI/gl-report.csv
@@ -1,3 +1,3 @@
-<?lsmb FOREACH column IN columns ?><?lsmb IF heading.$column.text; heading.$column.text; ELSE; heading.$column; END ?><?lsmb IF NOT loop.last ?>~<?lsmb END ?><?lsmb END ?>
-<?lsmb FOREACH row IN rows ?><?lsmb FOREACH column IN columns ?><?lsmb IF row.$column.text; row.$column.text; ELSE; row.$column; END ?><?lsmb IF NOT loop.last ?>~<?lsmb END ?><?lsmb END ?>
-<?lsmb END ?><?lsmb FOREACH column IN columns ?><?lsmb totals.$column ?><?lsmb IF NOT loop.last ?>~<?lsmb END ?><?lsmb END ?>
+<?lsmb FOREACH column IN columns ?><?lsmb IF heading.$column.text; heading.$column.text; ELSE; heading.$column; END ?><?lsmb IF NOT loop.last ?>,<?lsmb END ?><?lsmb END ?>
+<?lsmb FOREACH row IN rows ?><?lsmb FOREACH column IN columns ?><?lsmb IF row.$column.text; row.$column.text; ELSE; row.$column; END ?><?lsmb IF NOT loop.last ?>,<?lsmb END ?><?lsmb END ?>
+<?lsmb END ?><?lsmb FOREACH column IN columns ?><?lsmb totals.$column ?><?lsmb IF NOT loop.last ?>,<?lsmb END ?><?lsmb END ?>