summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-24 18:18:50 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-24 18:18:50 +0000
commitebddc26487a0649cc0f8abd039188f887ace3e90 (patch)
tree3ed217ea001dd1129861d9f4ba04f31d8cc7b49e /bin
parent1cb905e6427843114511232b8a4d75bd88135edd (diff)
Convert functions that use business_header to templates
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1811 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r--bin/am.pl70
1 files changed, 31 insertions, 39 deletions
diff --git a/bin/am.pl b/bin/am.pl
index c02e96bd..d1f19b3b 100644
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -812,8 +812,20 @@ sub add_business {
"$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"
unless $form->{callback};
- &business_header;
- &form_footer;
+ my %hiddens;
+ my @buttons;
+ my $checked = &business_header(\%hiddens);
+ &form_footer_buttons(\%hiddens, \@buttons);
+
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-business-form');
+ $template->render({
+ form => $form,
+ buttons => \@buttons,
+ hiddens => \%hiddens,
+ });
}
@@ -823,11 +835,22 @@ sub edit_business {
AM->get_business( \%myconfig, \%$form );
- &business_header;
-
$form->{orphaned} = 1;
- &form_footer;
+ my %hiddens;
+ my @buttons;
+ my $checked = &business_header(\%hiddens);
+ &form_footer_buttons(\%hiddens, \@buttons);
+
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-business-form');
+ $template->render({
+ form => $form,
+ buttons => \@buttons,
+ hiddens => \%hiddens,
+ });
}
sub list_business {
@@ -904,6 +927,7 @@ sub list_business {
}
sub business_header {
+ my $hiddens = shift;
$form->{title} = $locale->text("$form->{title} Business");
@@ -914,40 +938,8 @@ sub business_header {
$form->{discount} =
$form->format_amount( \%myconfig, $form->{discount} * 100 );
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=business>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">| . $locale->text('Type of Business') . qq|</th>
- <td><input name=description size=30 value="$form->{description}"></td>
- <tr>
- <tr>
- <th align="right">| . $locale->text('Discount') . qq| %</th>
- <td><input name=discount size=5 value=$form->{discount}></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
+ $hiddens->{id} = $form->{id};
+ $hiddens->{type} = 'business';
}