summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/arapprn.pl58
-rw-r--r--bin/cp.pl27
-rw-r--r--bin/io.pl28
-rw-r--r--bin/jc.pl11
-rw-r--r--bin/pos.pl25
-rw-r--r--bin/rp.pl80
6 files changed, 89 insertions, 140 deletions
diff --git a/bin/arapprn.pl b/bin/arapprn.pl
index 0d256c28..845d829a 100644
--- a/bin/arapprn.pl
+++ b/bin/arapprn.pl
@@ -285,24 +285,17 @@ sub print_check {
$form->{fileid} = $invnumber;
$form->{fileid} =~ s/(\s|\W)+//g;
- 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 );
- };
- }
- $form->parse_template( \%myconfig );
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig, template => $form->{'formname'},
+ format => uc $form->{'format'} );
+ try {
+ $template->render($form);
+ $template->output($form->{'media'});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
if ( $form->{previousform} ) {
@@ -560,24 +553,17 @@ sub print_transaction {
$form->{fileid} = $form->{invnumber};
$form->{fileid} =~ s/(\s|\W)+//g;
- 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 );
- };
- }
- $form->parse_template( \%myconfig );
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig, template => $form->{'formname'},
+ format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
if (%$old_form) {
$old_form->{invnumber} = $form->{invnumber};
diff --git a/bin/cp.pl b/bin/cp.pl
index d21fa18b..d9316fea 100644
--- a/bin/cp.pl
+++ b/bin/cp.pl
@@ -1473,23 +1473,16 @@ sub print_form {
$form->{printmode} = '|-';
}
- 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 );
- };
- }
- $form->parse_template( \%myconfig, ${LedgerSMB::Sysconfig::userspath} );
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
diff --git a/bin/io.pl b/bin/io.pl
index d1a00af9..6b21c95a 100644
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -1767,24 +1767,16 @@ sub print_form {
$form->{fileid} = $form->{"${inv}number"};
$form->{fileid} =~ s/(\s|\W)+//g;
- 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 );
- };
- }
-
- $form->parse_template( \%myconfig, ${LedgerSMB::Sysconfig::userspath} );
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
# if we got back here restore the previous form
if ( defined %$old_form ) {
diff --git a/bin/jc.pl b/bin/jc.pl
index 0675c2cd..9f6c0015 100644
--- a/bin/jc.pl
+++ b/bin/jc.pl
@@ -2205,7 +2205,16 @@ qq|$form->{"${item}hour"}:$form->{"${item}min"}:$form->{"${item}sec"}|;
$form->audittrail( "", \%myconfig, \%audittrail );
}
- $form->parse_template( \%myconfig, ${LedgerSMB::Sysconfig::userspath} );
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
if ( defined %$old_form ) {
diff --git a/bin/pos.pl b/bin/pos.pl
index 87787d08..3071bf33 100644
--- a/bin/pos.pl
+++ b/bin/pos.pl
@@ -1001,23 +1001,16 @@ sub print_form {
delete $form->{stylesheet};
$form->{cd_open} = $pos_config{rp_cash_drawer_open};
- 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 );
+ };
if ( $form->{printed} !~ /$form->{formname}/ ) {
$form->{printed} .= " $form->{formname}";
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 );
+ };
}
}
}