summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/Template.pm11
-rw-r--r--UI/ca-list-selector.html3
-rw-r--r--bin/ca.pl9
3 files changed, 14 insertions, 9 deletions
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index c982a94d..1f578583 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -74,6 +74,11 @@ The base name of the file for output.
=back
+=item new_UI(user => \%myconfig, locale => $locale, template => $file, ...)
+
+Wrapper around the constructor that sets the path to 'UI', format to 'HTML',
+and leaves auto-output enabled.
+
=item render($hashref)
This command renders the template. If no_auto_output was not specified during
@@ -144,10 +149,14 @@ sub new {
}
}
-
return $self;
}
+sub new_UI {
+ my $class = shift;
+ return $class->new(@_, no_auto_ouput => 0, format => 'HTML', path => 'UI');
+}
+
sub _valid_language {
my $self = shift;
if ($self->{language} =~ m#(/|\\|:|\.\.|^\.)#){
diff --git a/UI/ca-list-selector.html b/UI/ca-list-selector.html
index 0931dcdc..4f4798ad 100644
--- a/UI/ca-list-selector.html
+++ b/UI/ca-list-selector.html
@@ -19,8 +19,7 @@
<form method="post" action="ca.pl">
<?lsmb FOREACH hidden IN ['accno', 'description', 'sort', 'oldsort', 'accounttype', 'gifi_accno', 'gifi_description'];
- PROCESS input element_data={type => 'hidden', name => hidden, value => form.$hidden}; END ?>
-
+ PROCESS input element_data={type => 'hidden', name => hidden, value => form.item(hidden)}; END ?>
<table border="0" width="100%">
<tr><th class="listtop"><?lsmb form.title ?></th></tr>
<tr height="5"></tr>
diff --git a/bin/ca.pl b/bin/ca.pl
index 68ffdc5f..99a7ef66 100644
--- a/bin/ca.pl
+++ b/bin/ca.pl
@@ -238,13 +238,10 @@ sub list {
value => 'Y',
text => $locale->text('Subtotal'),
});
- $form->{sort} ||= ''; #SC: blah. Find out why this breaks when undef
- my $template = LedgerSMB::Template->new(
- user => \%myconfig,
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
locale => $locale,
- path => 'UI',
- template => 'ca-list-selector',
- format => 'HTML');
+ template => 'ca-list-selector');
$template->render({
form => $form,
includes => \@includes,