From 025fd80e331af9a44552efd5be8ae35b4825e7f6 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Fri, 4 Jul 2008 23:04:16 +0000 Subject: Committing David Mora's single payment updates git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2185 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Template.pm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'LedgerSMB/Template.pm') diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm index c7386928..e87251fd 100755 --- a/LedgerSMB/Template.pm +++ b/LedgerSMB/Template.pm @@ -263,8 +263,8 @@ sub render { #return $format->can('postprocess')->($self); my $post = $format->can('postprocess')->($self); if (!$self->{'noauto'}) { - $self->output; # Clean up + $self->output; if ($self->{rendered}) { unlink($self->{rendered}) or throw Error::Simple 'Unable to delete output file'; @@ -276,15 +276,17 @@ sub render { sub output { my $self = shift; my %args = @_; + $self->{output_args} = \%args; my $method = $self->{method} || $args{method} || $args{media}; - if ('email' eq lc $method) { $self->_email_output; } elsif ('print' eq lc $method) { $self->_lpr_output; - } elsif (defined $self->{output}) { + } elsif (defined $self->{output} or $method = 'Screen') { $self->_http_output; exit; + } elsif (defined $method) { + $self->_lpr_output; } else { $self->_http_output_file; } @@ -376,15 +378,22 @@ sub _email_output { } sub _lpr_output { - my ($self) = shift; + my ($self, $in_args) = shift; my $args = $self->{output_args}; - if ($self->{format} != /(pdf|ps)/){ + if ($self->{format} ne 'LaTeX') { throw Error::Simple "Invalid Format"; } - my $lpr = $LedgerSMB::Sysconfig::printer{$args->{printer}}; + my $lpr = $LedgerSMB::Sysconfig::printer{$args->{media}}; open(LPR, '|-', $lpr); - print LPR $self->{output}; + + # Output is not defined here. In the future we should consider + # changing this to use the system command and hit the file as an arg. + # -- CT + open (FILE, '<', "$self->{rendered}"); + while (my $line = ){ + print LPR $line; + } close(LPR); } -- cgit v1.2.3