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

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



Revision: 4629
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4629&view=rev
Author:   einhverfr
Date:     2012-03-29 01:57:55 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
CSV reports

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/Template/CSV.pm
    trunk/LedgerSMB/Template/LaTeX.pm
    trunk/LedgerSMB/Template/ODS.pm
    trunk/LedgerSMB/Template/TXT.pm
    trunk/LedgerSMB/Template/XLS.pm
    trunk/UI/lib/dynatable.csv

Added Paths:
-----------
    trunk/UI/Reports/display_report.csv

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-03-29 01:44:52 UTC (rev 4628)
+++ trunk/Changelog	2012-03-29 01:57:55 UTC (rev 4629)
@@ -18,6 +18,7 @@
 
 New Reporting Framework
 * Easy bridge between SQL and display (Chris T)
+* All reports exportable to CSV (Chris T)
 
 Customer/Vendor Handling 
 * Added sales tax id and license number fields for companies (Chris T)

Modified: trunk/LedgerSMB/Template/CSV.pm
===================================================================
--- trunk/LedgerSMB/Template/CSV.pm	2012-03-29 01:44:52 UTC (rev 4628)
+++ trunk/LedgerSMB/Template/CSV.pm	2012-03-29 01:57:55 UTC (rev 4629)
@@ -57,6 +57,9 @@
 sub preprocess {
 	my $rawvars = shift;
 	my $vars;
+        if (eval {$rawvars->can('to_output')}){
+           $rawvars = $rawvars->to_output;
+        }
 	my $type = ref $rawvars;
 
 	#XXX fix escaping function
@@ -73,9 +76,7 @@
 		} else {
 			$vars = $rawvars;
 		}
-		$vars =~ s/(^ +| +$)//g;
-		$vars =~ s/"/""/g;
-		$vars = qq|"$vars"| if $vars !~ /^\w*$/;
+              
 	} else { # hashes and objects
 		for ( keys %{$rawvars} ) {
 			$vars->{preprocess($_)} = preprocess( $rawvars->{$_} );
@@ -132,4 +133,7 @@
 	return $parent->{rendered};
 }
 
+sub escape {
+}
+
 1;

Modified: trunk/LedgerSMB/Template/LaTeX.pm
===================================================================
--- trunk/LedgerSMB/Template/LaTeX.pm	2012-03-29 01:44:52 UTC (rev 4628)
+++ trunk/LedgerSMB/Template/LaTeX.pm	2012-03-29 01:57:55 UTC (rev 4629)
@@ -73,6 +73,9 @@
 sub preprocess {
 	my $rawvars = shift;
 	my $vars;
+        if (eval {$rawvars->can('to_output')}){
+           $rawvars = $rawvars->to_output;
+        }
 	my $type = ref $rawvars;
 
 	return $rawvars if $type =~ /^LedgerSMB::Locale/;

Modified: trunk/LedgerSMB/Template/ODS.pm
===================================================================
--- trunk/LedgerSMB/Template/ODS.pm	2012-03-29 01:44:52 UTC (rev 4628)
+++ trunk/LedgerSMB/Template/ODS.pm	2012-03-29 01:57:55 UTC (rev 4629)
@@ -800,6 +800,9 @@
 sub preprocess {
     my $rawvars = shift;
     my $vars;
+    if (eval {$rawvars->can('to_output')}){
+       $rawvars = $rawvars->to_output;
+    }
     my $type = ref $rawvars;
 
     #XXX fix escaping function

Modified: trunk/LedgerSMB/Template/TXT.pm
===================================================================
--- trunk/LedgerSMB/Template/TXT.pm	2012-03-29 01:44:52 UTC (rev 4628)
+++ trunk/LedgerSMB/Template/TXT.pm	2012-03-29 01:57:55 UTC (rev 4629)
@@ -67,7 +67,7 @@
     return "${name}.". get_extension($parent);
 }
 
-sub preprocess {
+sub preprocess { # TODO handling of objects with to_output methods
     my $rawvars = shift;
     return $rawvars;
 }

Modified: trunk/LedgerSMB/Template/XLS.pm
===================================================================
--- trunk/LedgerSMB/Template/XLS.pm	2012-03-29 01:44:52 UTC (rev 4628)
+++ trunk/LedgerSMB/Template/XLS.pm	2012-03-29 01:57:55 UTC (rev 4629)
@@ -68,6 +68,9 @@
 sub preprocess {
     my $rawvars = shift;
     my $vars;
+    if (eval {$rawvars->can('to_output')}){
+       $rawvars = $rawvars->to_output;
+    }
     my $type = ref $rawvars;
 
     #XXX fix escaping function

Added: trunk/UI/Reports/display_report.csv
===================================================================
--- trunk/UI/Reports/display_report.csv	                        (rev 0)
+++ trunk/UI/Reports/display_report.csv	2012-03-29 01:57:55 UTC (rev 4629)
@@ -0,0 +1,4 @@
+<?lsmb PROCESS 'dynatable.csv';
+
+PROCESS dynatable tbody = {rows = rows };
+?>

Modified: trunk/UI/lib/dynatable.csv
===================================================================
--- trunk/UI/lib/dynatable.csv	2012-03-29 01:44:52 UTC (rev 4628)
+++ trunk/UI/lib/dynatable.csv	2012-03-29 01:57:55 UTC (rev 4629)
@@ -34,6 +34,5 @@
             ROW.$COL_ID;
         END;
     END; 
-
-END ?>
-<?lsmb END ?>
+?>
+<?lsmb END; END ?>

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