summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template/CSV.pm
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-15 22:22:41 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-15 22:22:41 +0000
commit46347e4974eb30c4bc212e802b6b45d3163468d1 (patch)
tree8bb104afa59e5113303d947716a5fcc30aec89ca /LedgerSMB/Template/CSV.pm
parent57dfea7df5e73799e43da21263887ac57aa6383e (diff)
Adjust templating to allow for no output file.
Due to their nature of the modules, PDF and PS will supply one if needed. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1612 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Template/CSV.pm')
-rwxr-xr-xLedgerSMB/Template/CSV.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/LedgerSMB/Template/CSV.pm b/LedgerSMB/Template/CSV.pm
index 9f494d69..bd06e478 100755
--- a/LedgerSMB/Template/CSV.pm
+++ b/LedgerSMB/Template/CSV.pm
@@ -75,7 +75,13 @@ sub process {
my $parent = shift;
my $cleanvars = shift;
my $template;
+ my $output;
+ if ($parent->{outputfile}) {
+ $output = "$parent->{outputfile}.csv";
+ } else {
+ $output = \$parent->{output};
+ }
$template = Template->new({
INCLUDE_PATH => $parent->{include_path},
START_TAG => quotemeta('<?lsmb'),
@@ -89,7 +95,7 @@ sub process {
get_template($parent->{template}),
{%$cleanvars, %$LedgerSMB::Template::TTI18N::ttfuncs,
'escape' => \&preprocess},
- "$parent->{outputfile}.csv", binmode => ':utf8')) {
+ $output, binmode => ':utf8')) {
throw Error::Simple $template->error();
}
$parent->{mimetype} = 'text/csv';
@@ -97,8 +103,8 @@ sub process {
sub postprocess {
my $parent = shift;
- $parent->{rendered} = "$parent->{outputfile}.csv";
- return "$parent->{outputfile}.csv";
+ $parent->{rendered} = "$parent->{outputfile}.csv" if $parent->{outputfile};
+ return $parent->{rendered};
}
1;