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

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



Revision: 4626
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4626&view=rev
Author:   einhverfr
Date:     2012-03-28 13:36:42 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/Template/CSV.pm
    trunk/LedgerSMB/Template/TXT.pm
    trunk/LedgerSMB/Template.pm
    trunk/UI/Contact/pricelist.html

Added Paths:
-----------
    trunk/UI/lib/dynatable.csv

Property Changed:
----------------
    trunk/
    trunk/LedgerSMB/Scripts/account.pm
    trunk/LedgerSMB/Scripts/admin.pm
    trunk/LedgerSMB/Scripts/customer.pm
    trunk/LedgerSMB/Scripts/employee.pm
    trunk/LedgerSMB/Scripts/file.pm
    trunk/LedgerSMB/Scripts/journal.pm
    trunk/LedgerSMB/Scripts/login.pm
    trunk/LedgerSMB/Scripts/menu.pm
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/LedgerSMB/Scripts/recon.pm
    trunk/LedgerSMB/Scripts/setup.pm
    trunk/LedgerSMB/Scripts/taxform.pm
    trunk/LedgerSMB/Scripts/vendor.pm
    trunk/sql/upgrade/1.2-1.3-manual.sql


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-4621
   + /branches/1.3:3711-4625

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-03-28 13:30:13 UTC (rev 4625)
+++ trunk/Changelog	2012-03-28 13:36:42 UTC (rev 4626)
@@ -44,7 +44,7 @@
 * Corrected build issues w/Makefile due to inclusion of LedgerSMB.pm (Chris T)
 * ledgersmb.conf.default : Update default PATH (H Sorli, item 3430019)
 * Fixed imballanced payments when early payment discount processed (Chris T)
-* Pricelists exportable as PDF (Chris T)
+* Pricelists exportable as PDF and CSV (Chris T)
 
 Chris B is Chris Bennet
 Chris T is Chris Travers


Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4621
/branches/1.3/scripts/account.pl:3711-4368
   + /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4625
/branches/1.3/scripts/account.pl:3711-4368


Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4621
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4625
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/customer.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4621
/branches/1.3/scripts/customer.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4625
/branches/1.3/scripts/customer.pl:4273-4287


Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4621
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
   + /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4625
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310


Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4621
/branches/1.3/scripts/file.pl:3711-4138
   + /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4625
/branches/1.3/scripts/file.pl:3711-4138


Property changes on: trunk/LedgerSMB/Scripts/journal.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4621
/branches/1.3/scripts/journal.pl:3711-4328
   + /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4625
/branches/1.3/scripts/journal.pl:3711-4328


Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4621
/branches/1.3/scripts/login.pl:3711-4192
   + /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4625
/branches/1.3/scripts/login.pl:3711-4192


Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4621
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4625
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4621
/branches/1.3/scripts/payment.pl:3711-4617
   + /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4625
/branches/1.3/scripts/payment.pl:3711-4617


Property changes on: trunk/LedgerSMB/Scripts/recon.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4621
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
   + /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4625
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438


Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4621
/branches/1.3/scripts/setup.pl:3711-4550
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4625
/branches/1.3/scripts/setup.pl:3711-4550


Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4621
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4625
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/vendor.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4621
/branches/1.3/scripts/vendor.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4625
/branches/1.3/scripts/vendor.pl:4273-4287

Modified: trunk/LedgerSMB/Template/CSV.pm
===================================================================
--- trunk/LedgerSMB/Template/CSV.pm	2012-03-28 13:30:13 UTC (rev 4625)
+++ trunk/LedgerSMB/Template/CSV.pm	2012-03-28 13:36:42 UTC (rev 4626)
@@ -126,6 +126,9 @@
 sub postprocess {
 	my $parent = shift;
 	$parent->{rendered} = "$parent->{outputfile}.csv" if $parent->{outputfile};
+        if (!$parent->{rendered}){
+            return "$parent->{template}.csv";
+        }
 	return $parent->{rendered};
 }
 

Modified: trunk/LedgerSMB/Template/TXT.pm
===================================================================
--- trunk/LedgerSMB/Template/TXT.pm	2012-03-28 13:30:13 UTC (rev 4625)
+++ trunk/LedgerSMB/Template/TXT.pm	2012-03-28 13:36:42 UTC (rev 4626)
@@ -111,7 +111,10 @@
 }
 
 sub postprocess {
-    my $parent = shift;
+    my ($parent) = shift;
+    if (!$parent->{rendered}){
+        return $parent->{template} . '.' get_extension($parent); 
+    }
     $parent->{rendered} = "$parent->{outputfile}.". get_extension($parent) if $parent->{outputfile};
     return $parent->{rendered};
 }

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2012-03-28 13:30:13 UTC (rev 4625)
+++ trunk/LedgerSMB/Template.pm	2012-03-28 13:36:42 UTC (rev 4626)
@@ -302,7 +302,11 @@
 sub escape {
     my ($self, $vars) = @_;
     my $format = "LedgerSMB::Template::$self->{format}";
-    return $format->can('escape')->($vars) || $vars;
+    if ($format->can('escape')){
+         return $format->can('escape')->($vars);
+    } else {
+         return $vars;
+    }
 } 
 
 sub output {
@@ -348,8 +352,7 @@
 
 	my $format = "LedgerSMB::Template::$self->{format}";
 	my $disposition = "";
-	my $name = $format->can('postprocess')->($self);
-
+	my $name = $format->can('postprocess')->($self) || $self->{rendered};
 	if ($name) {
 		$name =~ s#^.*/##;
 		$disposition .= qq|\nContent-Disposition: attachment; filename="$name"|;

Modified: trunk/UI/Contact/pricelist.html
===================================================================
--- trunk/UI/Contact/pricelist.html	2012-03-28 13:30:13 UTC (rev 4625)
+++ trunk/UI/Contact/pricelist.html	2012-03-28 13:36:42 UTC (rev 4626)
@@ -67,7 +67,8 @@
      END ?>
 <form name="pricematrix" action="<?lsmb script ?>" method="post">
  <input type="hidden" name="entity_class"  value="<?lsmb account_class ?>" />
- <input type="hidden" name="credit_id" value="<?lsmb credit_id ?>" /><?lsmb
+ <input type="hidden" name="credit_id" value="<?lsmb credit_id ?>" />
+ <input type="hidden" name="entity_id" value="<?lsmb entity_id ?>" /><?lsmb
       PROCESS dynatable
     attributes = { id = 'pricematrix' }
          tbody = { rows = pricematrix }
@@ -83,6 +84,9 @@
 } ?> <a href="customer.pl?action=pricelist&format=PDF&credit_id=<?lsmb 
              credit_id ?>&entity_id=<?lsmb entity_id 
      ?>">[<?lsmb text('PDF') ?>]</a>
+ <a href="customer.pl?action=pricelist&format=CSV&credit_id=<?lsmb 
+             credit_id ?>&entity_id=<?lsmb entity_id 
+     ?>">[<?lsmb text('CSV') ?>]</a>
 <?lsmb IF pricematrix_pricegroup;
      PROCESS dynatable
          tbody = { rows = pricematrix_pricegroup };

Copied: trunk/UI/lib/dynatable.csv (from rev 4623, branches/1.3/UI/lib/dynatable.csv)
===================================================================
--- trunk/UI/lib/dynatable.csv	                        (rev 0)
+++ trunk/UI/lib/dynatable.csv	2012-03-28 13:36:42 UTC (rev 4626)
@@ -0,0 +1,39 @@
+<?lsmb- BLOCK escape;
+
+IF VALUE.match('\D'); # any non-digit means run escaping
+   '"' _ VALUE.replace('"', '""') _ '"';
+ELSE;
+   VALUE;
+END;
+
+END -?>
+<?lsmb- BLOCK dynatable;
+SKIP_TYPES = ['hidden', 'radio', 'checkbox'];
+
+FOREACH COL IN columns;
+    IF 0 == SKIP_TYPES.grep(COL.type).size();
+        IF ADD_COMMA;
+           ',';
+        END;
+        INCLUDE escape VALUE = COL.name;
+        ADD_COMMA = 1;
+    END;
+END;
+?>
+<?lsmb FOREACH ROW IN tbody.rows;
+
+ADD_COMMA=0;
+
+    FOREACH COL IN columns;
+        COL_ID = COL.col_id;
+        IF 0 == SKIP_TYPES.grep(COL.type).size();
+            IF ADD_COMMA;
+               ',';
+            END;
+            ADD_COMMA = 1;
+            ROW.$COL_ID;
+        END;
+    END; 
+
+END ?>
+<?lsmb END ?>


Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4621
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
   + /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4625
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710

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