summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
authorjeff <jeff>2008-04-06 16:12:46 +0000
committerjeff <jeff>2008-04-06 16:12:46 +0000
commit6626dc2a13c809092aa539c5a72bc72a0c56afdc (patch)
treee92d2d1ea157b941f090a6f27cfbeb2db8dd12a3 /httemplate/edit/process
parentebfc3f058e29e09631112ee355a2c57dce56914f (diff)
new tax rating engine
Diffstat (limited to 'httemplate/edit/process')
-rw-r--r--httemplate/edit/process/elements/process.html6
-rw-r--r--httemplate/edit/process/tax_rate.html9
2 files changed, 14 insertions, 1 deletions
diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html
index a671ca118..d29ffcfe5 100644
--- a/httemplate/edit/process/elements/process.html
+++ b/httemplate/edit/process/elements/process.html
@@ -145,7 +145,11 @@ if ( $pkeyvalue ) {
});
}
-my %hash = map { $_ => scalar($cgi->param($_)) } @$fields;
+my %hash =
+ map { my @entry = ( $_ => $cgi->param($_) );
+ $opt{'value_callback'} ? ( $_ => &{ $opt{'value_callback'} }( @entry ))
+ : ( @entry )
+ } @$fields;
my $new = $class->new( \%hash );
diff --git a/httemplate/edit/process/tax_rate.html b/httemplate/edit/process/tax_rate.html
index 933bf07d6..431e54264 100644
--- a/httemplate/edit/process/tax_rate.html
+++ b/httemplate/edit/process/tax_rate.html
@@ -1,9 +1,18 @@
<% include( 'elements/process.html',
'table' => 'tax_rate',
+ 'value_callback' => $value_callback,
'popup_reload' => 'Tax changed', #a popup "parent reload" for now
#someday change the individual element and go away instead
)
%>
+<%once>
+
+my $value_callback = sub { my ($field, $value) = @_;
+ ($field =~ /^(tax|excessrate|usetax|useexcessrate)$/)
+ ? $value/100
+ : $value
+ };
+</%once>
<%init>
my $conf = new FS::Conf;