summaryrefslogtreecommitdiff
path: root/httemplate/elements/part_pkg_usageprice.html
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-01-07 22:55:58 -0800
committerIvan Kohler <ivan@freeside.biz>2014-01-07 22:55:58 -0800
commit4427ad71b12bf27eac2a05d88141a82f9372d03f (patch)
tree77c01abea411f601df63bc2bae722504e03ff5e1 /httemplate/elements/part_pkg_usageprice.html
parent76275769ed7ea66b154aef4d2dd00120a53196df (diff)
time/data/etc. unit pricing add-ons, RT#24392
Diffstat (limited to 'httemplate/elements/part_pkg_usageprice.html')
-rw-r--r--httemplate/elements/part_pkg_usageprice.html32
1 files changed, 9 insertions, 23 deletions
diff --git a/httemplate/elements/part_pkg_usageprice.html b/httemplate/elements/part_pkg_usageprice.html
index 5663469c2..548213747 100644
--- a/httemplate/elements/part_pkg_usageprice.html
+++ b/httemplate/elements/part_pkg_usageprice.html
@@ -64,24 +64,27 @@
ID = "<%$id%>_target"
<% $onchange %>
>
-% foreach my $target (keys %targets) {
+% foreach my $target (keys %$targets) {
<OPTION VALUE="<% $target %>"
<% ($cgi->param($name.'_target') || $part_pkg_usageprice->target) eq $target ? 'SELECTED' : '' %>
- ><% $targets{$target}->{label} %>
+ ><% $targets->{$target}->{label} %>
% }
</TD>
% ###
% # amount
% ###
+% my $amount =
+% scalar($cgi->param($name.'_amount'))
+% || ( $part_pkg_usageprice->amount
+% / ($targets->{$part_pkg_usageprice->target}{multiplier} || 1) );
+% $amount = '' unless $amount > 0;
<TD>
<INPUT TYPE = "text"
NAME = "<%$name%>_amount"
ID = "<%$id%>_amount"
SIZE = 5
- VALUE = "<% scalar($cgi->param($name.'_amount'))
- || $part_pkg_usageprice->amount
- %>"
+ VALUE = "<% $amount %>"
<% $onchange %>
>
</TD>
@@ -92,24 +95,7 @@
% }
<%init>
-tie my %targets, 'Tie::IxHash', # once?
- #'svc_acct.totalbytes' => { label => 'Megabytes',
- # mult => 1048576,
- # },
- 'svc_acct.totalbytes' => { label => 'Gigabytes',
- mult => 1073741824,
- },
- 'svc_acct.seconds' => { label => 'Hours',
- mult => 3600,
- },
- 'svc_conferencing.participants' => { label => 'Conference Participants',
- mult => 1,
- },
-#this will take more work: set action, not increment..
-# and then value comes from a select, not a text field
-# 'svc_conferencing.confqualitynum' => { label => 'Conference Quality',
-# },
-;
+my $targets = FS::part_pkg_usageprice->targets;
my( %opt ) = @_;