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

SF.net SVN: ledger-smb:[4632] branches/1.3



Revision: 4632
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4632&view=rev
Author:   einhverfr
Date:     2012-03-30 00:44:23 +0000 (Fri, 30 Mar 2012)
Log Message:
-----------
Template engine now detects available formats
Corrected some issues with dynatable.tex and weighted widths

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/Template/ODS.pm
    branches/1.3/LedgerSMB/Template.pm
    branches/1.3/UI/Contact/pricelist.html
    branches/1.3/UI/lib/dynatable.tex

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-03-30 00:02:00 UTC (rev 4631)
+++ branches/1.3/Changelog	2012-03-30 00:44:23 UTC (rev 4632)
@@ -8,6 +8,7 @@
 * ledgersmb.conf.default : Update default PATH (H Sorli, item 3430019)
 * Fixed imballanced payments when early payment discount processed (Chris T)
 * Pricelists exportable as PDF and CSV (Chris T)
+* Fixed payment/receipts shows with 0 due/payment list (Chris T, bug 3512555)
 
 Chris B is Chris Bennet
 Chris T is Chris Travers

Modified: branches/1.3/LedgerSMB/Template/ODS.pm
===================================================================
--- branches/1.3/LedgerSMB/Template/ODS.pm	2012-03-30 00:02:00 UTC (rev 4631)
+++ branches/1.3/LedgerSMB/Template/ODS.pm	2012-03-30 00:44:23 UTC (rev 4632)
@@ -56,8 +56,8 @@
 use LedgerSMB::Template::TTI18N;
 
 my $binmode = undef;
-binmode STDOUT, $binmode;
-binmode STDERR, $binmode;
+binmode STDOUT, ':bytes';
+binmode STDERR, ':bytes';
 
 # SC: The ODS handlers need these vars in common
 my $ods;

Modified: branches/1.3/LedgerSMB/Template.pm
===================================================================
--- branches/1.3/LedgerSMB/Template.pm	2012-03-30 00:02:00 UTC (rev 4631)
+++ branches/1.3/LedgerSMB/Template.pm	2012-03-30 00:44:23 UTC (rev 4632)
@@ -85,6 +85,26 @@
 
 =back
 
+=item available_formats()
+
+Returns a list of format names, any of the following (in order) as applicable:
+
+=over
+
+=item HTML (always available)
+
+=item TXT (includes CSV, always available))
+
+=item PDF
+
+=item PS
+
+=item XLS
+
+=item ODS
+
+=back
+
 =item new_UI(user => \%myconfig, locale => $locale, template => $file, ...)
 
 Wrapper around the constructor that sets the path to 'UI', format to 'HTML',
@@ -142,6 +162,20 @@
 
 my $logger = Log::Log4perl->get_logger('LedgerSMB::Template');
 
+sub available_formats {
+    my @retval = ('HTML', 'TXT');
+    if (eval {require LedgerSMB::Template::LaTeX}){
+        push @retval, 'PDF', 'PS';
+    }
+    if (eval {require LedgerSMB::Template::XLS}){
+        push @retval, 'XLS';
+    }
+    if (eval {require LedgerSMB::Template::ODS}){
+        push @retval, 'ODS';
+    }
+    return ..hidden..;
+}
+
 sub new {
 	my $class = shift;
 	my $self = {};
@@ -242,6 +276,7 @@
 sub render {
 	my $self = shift;
 	my $vars = shift;
+        $vars->{FORMATS} = $self->available_formats;
 	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
 		throw Error::Simple "Invalid format";
 	}

Modified: branches/1.3/UI/Contact/pricelist.html
===================================================================
--- branches/1.3/UI/Contact/pricelist.html	2012-03-30 00:02:00 UTC (rev 4631)
+++ branches/1.3/UI/Contact/pricelist.html	2012-03-30 00:44:23 UTC (rev 4632)
@@ -81,9 +81,17 @@
     name = "action"
     text = text('Save')
    value = "save_pricelist"
-} ?> <a href="customer.pl?action=pricelist&format=PDF&credit_id=<?lsmb 
+} ;
+
+IF FORMATS.grep('PDF').size() ?> <a href="customer.pl?action=pricelist&format=PDF&credit_id=<?lsmb 
              credit_id ?>&entity_id=<?lsmb entity_id 
      ?>">[<?lsmb text('PDF') ?>]</a>
+<?lsmb END;
+IF FORMATS.grep('XLS').size() 
+?> <a href="customer.pl?action=pricelist&format=XLS&credit_id=<?lsmb 
+             credit_id ?>&entity_id=<?lsmb entity_id 
+     ?>">[<?lsmb text('XLS') ?>]</a>
+<?lsmb END ?>
  <a href="customer.pl?action=pricelist&format=CSV&credit_id=<?lsmb 
              credit_id ?>&entity_id=<?lsmb entity_id 
      ?>">[<?lsmb text('CSV') ?>]</a>

Modified: branches/1.3/UI/lib/dynatable.tex
===================================================================
--- branches/1.3/UI/lib/dynatable.tex	2012-03-30 00:02:00 UTC (rev 4631)
+++ branches/1.3/UI/lib/dynatable.tex	2012-03-30 00:44:23 UTC (rev 4632)
@@ -1,6 +1,6 @@
 <?lsmb- BLOCK dynatable;
 
-TOTAL_WIDTH=82; # cm. using A4 as a basis because it is slightly narrower than
+TOTAL_WIDTH=14; # cm. using A4 as a basis because it is slightly narrower than
                 # US Letter. This way the dynatable works for both paper sizes.
                 # This assumes a 1cm margin on either side. --CT
 DECLARED_WIDTH=0; 
@@ -22,7 +22,7 @@
       '|';
    END;
    IF COL.pwidth;
-       "p{" _ (COL_pwidth * WIDTH_PER_P) _ "cm}";
+       "p{" _ (COL.pwidth * WIDTH_PER_P) _ "cm}";
    ELSIF COL.palign;
         COL.palign;
    ELSE;
@@ -40,9 +40,14 @@
 <?lsmb 
 SKIP_TYPES = ['hidden', 'radio', 'checkbox'];
 
+ADD_SEP = 0;
 FOREACH COL IN columns;
+    IF ADD_SEP;
+      ' & ';
+    END;
+    ADD_SEP = 1;
     IF 0 == SKIP_TYPES.grep(COL.type).size();
-        COL.name _ ' & ';
+        COL.name;
     END;
 END;
 -?>\\
@@ -51,9 +56,14 @@
 <?lsmb 
 SKIP_TYPES = ['hidden', 'radio', 'checkbox'];
 
+ADD_SEP = 0;
 FOREACH COL IN columns;
+    IF ADD_SEP;
+      ' & ';
+    END;
+    ADD_SEP = 1;
     IF 0 == SKIP_TYPES.grep(COL.type).size();
-        COL.name _ ' & ';
+        COL.name;
     END;
 END;
 -?>\\
@@ -62,10 +72,15 @@
 <?lsmb
 
 FOREACH ROW IN tbody.rows;
+    ADD_SEP = 0;
     FOREACH COL IN columns;
+        IF ADD_SEP;
+           ' & ';
+        END;
+        ADD_SEP = 1;
         COL_ID = COL.col_id;
         IF 0 == SKIP_TYPES.grep(COL.type).size();
-            ROW.$COL_ID _ ' & '; # $ 
+            ROW.$COL_ID; #$
         END;
     END; 
     ?>\\

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