summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-04 02:35:26 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-04 02:35:26 +0000
commit5c3a962f492011bebe096a5a4b007062152df2d7 (patch)
tree4767953d3090870de43ccb992ed096545be9e4da /bin
parenta3a6064b492c70ecacaa5b413547deb695212487 (diff)
First round of template changes for new TT system
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1023 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r--bin/arapprn.pl27
-rw-r--r--bin/cp.pl14
-rw-r--r--bin/io.pl19
-rw-r--r--bin/jc.pl15
-rw-r--r--bin/pos.pl15
-rw-r--r--bin/rp.pl38
6 files changed, 126 insertions, 2 deletions
diff --git a/bin/arapprn.pl b/bin/arapprn.pl
index 5eb138d9..9cd91e02 100644
--- a/bin/arapprn.pl
+++ b/bin/arapprn.pl
@@ -39,6 +39,9 @@
# printing routines for ar, ap
#
+use Error qw(:try);
+use LedgerSMB::Template;
+
# any custom scripts for this one
if (-f "bin/custom/arapprn.pl") {
eval { require "bin/custom/arapprn.pl"; };
@@ -258,6 +261,18 @@ 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(\%myconfig, $form->{'formname'}, '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);
if ($form->{previousform}) {
@@ -476,6 +491,18 @@ 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(\%myconfig, $form->{'formname'}, '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);
if (%$old_form) {
diff --git a/bin/cp.pl b/bin/cp.pl
index 95a19254..8665fb29 100644
--- a/bin/cp.pl
+++ b/bin/cp.pl
@@ -45,7 +45,9 @@
#
#======================================================================
+use Error qw(:try);
+use LedgerSMB::Template;
use LedgerSMB::CP;
use LedgerSMB::OP;
use LedgerSMB::IS;
@@ -1277,6 +1279,18 @@ sub print_form {
$form->{printmode} = '|-';
}
+ if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+ my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, '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});
}
diff --git a/bin/io.pl b/bin/io.pl
index 46e30120..16e6f1c3 100644
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -38,7 +38,10 @@
#
#######################################################################
+use Error qw(:try);
+
use LedgerSMB::Tax;
+use LedgerSMB::Template;
use LedgerSMB::Sysconfig;
# any custom scripts for this one
@@ -1544,9 +1547,21 @@ sub print_form {
$form->{fileid} = $form->{"${inv}number"};
$form->{fileid} =~ s/(\s|\W)+//g;
-
- $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
+
+ if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+ my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, '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});
# if we got back here restore the previous form
if (defined %$old_form) {
diff --git a/bin/jc.pl b/bin/jc.pl
index 6af0f84a..18153885 100644
--- a/bin/jc.pl
+++ b/bin/jc.pl
@@ -39,6 +39,9 @@
#
#======================================================================
+use Error qw(:try);
+
+use LedgerSMB::Template;
use LedgerSMB::JC;
1;
@@ -1913,6 +1916,18 @@ sub print_timecard {
$status{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
}
+ if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+ my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, '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});
if (defined %$old_form) {
diff --git a/bin/pos.pl b/bin/pos.pl
index 692fdfc1..939ab0e0 100644
--- a/bin/pos.pl
+++ b/bin/pos.pl
@@ -40,6 +40,9 @@
#
#=====================================================================
+use Error qw(:try);
+
+use LedgerSMB::Template;
use LedgerSMB::Tax;
1;
@@ -872,6 +875,18 @@ 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(\%myconfig, $form->{'formname'}, '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});
if ($form->{printed} !~ /$form->{formname}/) {
diff --git a/bin/rp.pl b/bin/rp.pl
index bea42005..26f55dcf 100644
--- a/bin/rp.pl
+++ b/bin/rp.pl
@@ -41,9 +41,11 @@
#
#======================================================================
+use Error qw(:try);
require "bin/arap.pl";
+use LedgerSMB::Template;
use LedgerSMB::PE;
use LedgerSMB::RP;
@@ -993,6 +995,18 @@ sub generate_income_statement {
$form->{IN} = "income_statement.html";
+ if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+ my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, '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;
}
@@ -1027,6 +1041,18 @@ sub generate_balance_sheet {
$form->{templates} = $myconfig{templates};
+ if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+ my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, '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;
}
@@ -2022,6 +2048,18 @@ sub print_form {
for ("c0", "c30", "c60", "c90", "") { $form->{"${_}total"} = $form->format_amount(\%myconfig, $form->{"${_}total"}, 2) }
+ if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+ my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, '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});
}