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} %>
78 % scalar($cgi->param($name.'_amount'))
79 % || ( $part_pkg_usageprice->amount
80 % / ($targets->{$part_pkg_usageprice->target}{multiplier} || 1) );
81 % $amount = '' unless $amount > 0;
84 NAME = "<%$name%>_amount"
87 VALUE = "<% $amount %>"
98 my $targets = FS::part_pkg_usageprice->targets;
102 my $conf = new FS::Conf;
103 my $money_char = $conf->config('money_char') || '$';
105 my $name = $opt{'element_name'} || $opt{'field'} || 'usagepricepart';
106 my $id = $opt{'id'} || 'usagepricepart';
108 my $curr_value = $opt{'curr_value'} || $opt{'value'};
111 if ( $opt{'onchange'} ) {
112 $onchange = $opt{'onchange'};
113 $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
114 $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack. all onchange
115 #callbacks should act the same
116 $onchange = 'onChange="'. $onchange. '"';
119 my $part_pkg_usageprice = $curr_value
120 ? qsearchs('part_pkg_usageprice', { 'usagepricepart' => $curr_value } )
121 : new FS::part_pkg_usageprice {};