[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1566] trunk



Revision: 1566
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1566&view=rev
Author:   tetragon
Date:     2007-09-11 10:11:08 -0700 (Tue, 11 Sep 2007)

Log Message:
-----------
Removing some testing steps from CSV escaping
Fixing the mimetype
It's comma time

Modified Paths:
--------------
    trunk/LedgerSMB/Template/CSV.pm
    trunk/UI/gl-report.csv

Modified: trunk/LedgerSMB/Template/CSV.pm
===================================================================
--- trunk/LedgerSMB/Template/CSV.pm	2007-09-11 15:46:25 UTC (rev 1565)
+++ trunk/LedgerSMB/Template/CSV.pm	2007-09-11 17:11:08 UTC (rev 1566)
@@ -60,13 +60,9 @@
 		}
 	} elsif ( !$type ) { # Scalar
 		$vars = $rawvars;
-		$vars =~ s/\ / /;
-		$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 @@
 		"$parent->{outputfile}.csv", binmode => ':utf8')) {
 		throw Error::Simple $template->error();
 	}
-	$parent->{mimetype} = 'text/plain';
+	$parent->{mimetype} = 'text/csv';
 }
 
 sub postprocess {

Modified: trunk/UI/gl-report.csv
===================================================================
--- trunk/UI/gl-report.csv	2007-09-11 15:46:25 UTC (rev 1565)
+++ trunk/UI/gl-report.csv	2007-09-11 17:11:08 UTC (rev 1566)
@@ -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 ?>


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.