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

SF.net SVN: ledger-smb:[6618] trunk/LedgerSMB



Revision: 6618
          http://sourceforge.net/p/ledger-smb/code/6618
Author:   einhverfr
Date:     2014-01-24 07:11:10 +0000 (Fri, 24 Jan 2014)
Log Message:
-----------
Timecard printing now works aside from template mismatch issues (filing 978 on that)

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/timecard.pm
    trunk/LedgerSMB/Template/LaTeX.pm
    trunk/LedgerSMB/Template.pm

Modified: trunk/LedgerSMB/Scripts/timecard.pm
===================================================================
--- trunk/LedgerSMB/Scripts/timecard.pm	2014-01-24 06:24:15 UTC (rev 6617)
+++ trunk/LedgerSMB/Scripts/timecard.pm	2014-01-24 07:11:10 UTC (rev 6618)
@@ -188,14 +188,22 @@
 
 sub print {
     my ($request) = @_;
+    $request->{parts_id} =  LedgerSMB::Timecard->get_part_id(
+           $request->{partnumber}
+    );
     my $timecard = LedgerSMB::Timecard->new(%$request);
     my $template = LedgerSMB::Template->new(
         user     => $request->{_user},
         locale   => $request->{_locale},
         path     => $LedgerSMB::Company_Config::settings->{templates},
         template => 'timecard',
+  no_auto_output => 1,
         format   => $request->{format} || 'HTML'
     );
+    $template->render;
+    $template->output(%$request);
+    $request->finalize_request if $request->{media} eq 'screen';
+    display($request);
 }
 
 =item timecard_report

Modified: trunk/LedgerSMB/Template/LaTeX.pm
===================================================================
--- trunk/LedgerSMB/Template/LaTeX.pm	2014-01-24 06:24:15 UTC (rev 6617)
+++ trunk/LedgerSMB/Template/LaTeX.pm	2014-01-24 07:11:10 UTC (rev 6618)
@@ -169,7 +169,7 @@
 		{%$cleanvars, %$LedgerSMB::Template::TTI18N::ttfuncs,
 			'escape' => \&preprocess},
 		"$parent->{outputfile}.$format", {binmode => 1})) {
-		throw Error::Simple $template->error();
+		die $template->error();
 	}
 	if (lc $format eq 'dvi') {
 		$parent->{mimetype} = 'application/x-dvi';

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2014-01-24 06:24:15 UTC (rev 6617)
+++ trunk/LedgerSMB/Template.pm	2014-01-24 07:11:10 UTC (rev 6618)
@@ -348,9 +348,7 @@
                return $str;
         };
 
-        use Data::Dumper;
-        $Data::Dumper::Sortkeys = 1;
-
+           
 	$format->can('process')->($self, $cleanvars);
 	#return $format->can('postprocess')->($self);
 	my $post = $format->can('postprocess')->($self);
@@ -405,13 +403,14 @@
 }
 
 sub _http_output {
+        use Carp::Always;
 	my ($self, $data) = @_;
         LedgerSMB::App_State::cleanup();
 	$data ||= $self->{output};
+        
 	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
 		throw Error::Simple "Invalid format";
 	}
-
 	if (!defined $data and defined $self->{rendered}){
 		$data = "";
                 $logger->trace("begin DATA < self->{rendered}=$self->{rendered} \$self->{format}=$self->{format}");
@@ -426,7 +425,9 @@
 
 	my $format = "LedgerSMB::Template::$self->{format}";
 	my $disposition = "";
-	my $name = $format->can('postprocess')->($self) || $self->{rendered};
+	my $name;
+        $name = $format->can('postprocess')->($self) if $format->can('postprocess');
+        $name ||= $self->{rendered};
 	if ($name) {
 		$name =~ s#^.*/##;
 		$disposition .= qq|\nContent-Disposition: attachment; filename="$name"|;

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits