diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-12-07 19:00:23 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-12-07 19:00:23 +0000 |
commit | 20e0d5dc6e0d1bc8c224593fd08141349acec727 (patch) | |
tree | 967eb98a44abed053f347fbc29de287fac865c57 /LedgerSMB | |
parent | 28d7f77a764f54c962251ea690613ab1771b1ef7 (diff) |
A step towards fixing printing with 3-arg open statements. Printing is not verified yet.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@740 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-x | LedgerSMB/Form.pm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index 7871c183..da95f509 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -598,13 +598,17 @@ sub parse_template { $tmpfile =~ s/\./_$self->{fileid}./ if $self->{fileid}; $self->{tmpfile} = "${LedgerSMB::Sysconfig::userspath}/${fileid}_${tmpfile}"; + my %temphash; + if ($self->{format} =~ /(postscript|pdf)/ || $self->{media} eq 'email') { - my $out = $self->{OUT}; + $temphash{out} = $self->{OUT}; $self->{OUT} = "$self->{tmpfile}"; + $temphash{printmode} = $self->{printmode}; + $self->{printmode} = '>'; } if ($self->{OUT}) { - open(OUT, '>', "$self->{OUT}") or $self->error("$self->{OUT} : $!"); + open(OUT, $self->{printmode}, "$self->{OUT}") or $self->error("$self->{OUT} : $!"); } else { open(OUT, ">-") or $self->error("STDOUT : $!"); @@ -918,7 +922,8 @@ sub parse_template { } else { - $self->{OUT} = $out; + $self->{OUT} = $temphash{out}; + $self->{printmode} = $temphash{printmode}; unless (open(IN, '<', $self->{tmpfile})) { $err = $!; @@ -935,7 +940,7 @@ sub parse_template { for my $i (1 .. $self->{copies}) { if ($self->{OUT}) { - unless (open(OUT, '>', $self->{OUT})) { + unless (open(OUT, $self->{printmode}, $self->{OUT})) { $err = $!; $self->cleanup; $self->error("$self->{OUT} : $err"); |