summaryrefslogtreecommitdiff
path: root/bin/rp.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/rp.pl')
-rw-r--r--bin/rp.pl80
1 files changed, 28 insertions, 52 deletions
diff --git a/bin/rp.pl b/bin/rp.pl
index a5c906d3..5886c2da 100644
--- a/bin/rp.pl
+++ b/bin/rp.pl
@@ -1080,23 +1080,16 @@ sub generate_income_statement {
$form->{IN} = "income_statement.html";
- if ( ( $form->{'media'} eq 'screen' ) and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'}, format => 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
}
- $form->parse_template;
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
@@ -1137,23 +1130,16 @@ sub generate_balance_sheet {
$form->{templates} = $myconfig{templates};
- if ( ( $form->{'media'} eq 'screen' ) and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'}, format => 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
}
- $form->parse_template;
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
@@ -2291,27 +2277,17 @@ sub print_form {
2 );
}
- if ( ( $form->{'media'} eq 'screen' )
- and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'},
- format => 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'},
+ format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
}
- $form->parse_template( \%myconfig,
- ${LedgerSMB::Sysconfig::userspath} );
-
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
}
}