1 % unless ( $opt{'js_only'} ) {
3 <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">
5 <TABLE STYLE="display:inline">
12 <TABLE STYLE="display:inline">
15 <TD><% $money_char %><INPUT
17 NAME = "<%$name%>_price"
19 VALUE = "<% scalar($cgi->param($name.'_price'))
20 || $part_pkg_usageprice->price
26 % #XXX lots more work for multi-currency... maybe larger UI changes :/
27 % foreach my $currency ( () ) {
28 % #foreach my $currency ( sort $conf->config('currencies') ) {
30 <TD><% $currency %></TD>
31 <TD><% currency_symbol($currency, SYM_HTML) %><INPUT
33 NAME = "<%$name%>_price_<%$currency%>"
34 ID = "<%$id%>_price_<%$currency%>"
35 VALUE = "<% scalar($cgi->param($name.'_price_'.$currency))
36 || $part_pkg_usageprice->price #XXX
50 <SELECT NAME = "<%$name%>_action"
54 <OPTION VALUE="increment">Increment
55 %#no set yet <OPTION VALUE="set" <% ($cgi->param($name.'_action') || $part_pkg_usageprice->action) eq 'set' ? 'SELECTED' : '' %>>Set
63 <SELECT NAME = "<%$name%>_target"
67 % foreach my $target (keys %targets) {
68 <OPTION VALUE="<% $target %>"
69 <% ($cgi->param($name.'_target') || $part_pkg_usageprice->target) eq $target ? 'SELECTED' : '' %>
70 ><% $targets{$target}->{label} %>
79 NAME = "<%$name%>_amount"
82 VALUE = "<% scalar($cgi->param($name.'_amount'))
83 || $part_pkg_usageprice->amount
95 tie my %targets, 'Tie::IxHash', # once?
96 #'svc_acct.totalbytes' => { label => 'Megabytes',
99 'svc_acct.totalbytes' => { label => 'Gigabytes',
102 'svc_acct.seconds' => { label => 'Hours',
105 'svc_conferencing.participants' => { label => 'Conference Participants',
108 #this will take more work: set action, not increment..
109 # and then value comes from a select, not a text field
110 # 'svc_conferencing.confqualitynum' => { label => 'Conference Quality',
116 my $conf = new FS::Conf;
117 my $money_char = $conf->config('money_char') || '$';
119 my $name = $opt{'element_name'} || $opt{'field'} || 'usagepricepart';
120 my $id = $opt{'id'} || 'usagepricepart';
122 my $curr_value = $opt{'curr_value'} || $opt{'value'};
125 if ( $opt{'onchange'} ) {
126 $onchange = $opt{'onchange'};
127 $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
128 $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack. all onchange
129 #callbacks should act the same
130 $onchange = 'onChange="'. $onchange. '"';
133 my $part_pkg_usageprice = $curr_value
134 ? qsearchs('part_pkg_usageprice', { 'usagepricepart' => $curr_value } )
135 : new FS::part_pkg_usageprice {};