diff options
author | ivan <ivan> | 2011-11-14 04:31:31 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-11-14 04:31:31 +0000 |
commit | 3db061f538c06804bd0a52b9ef8be3dc6b6db82e (patch) | |
tree | 7335808809768c4dcc6c8c85aebfa3ec365398ea /httemplate/elements/rate_tier_detail.html | |
parent | 3892b13ea137969a2b4f880883960e58003cc1b3 (diff) |
rate tiers for vnes, RT#14903
Diffstat (limited to 'httemplate/elements/rate_tier_detail.html')
-rw-r--r-- | httemplate/elements/rate_tier_detail.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/httemplate/elements/rate_tier_detail.html b/httemplate/elements/rate_tier_detail.html new file mode 100644 index 000000000..ef1f38b8a --- /dev/null +++ b/httemplate/elements/rate_tier_detail.html @@ -0,0 +1,66 @@ +% unless ( $opt{'js_only'} ) { + + <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>"> + + <TABLE> + <TR> +% foreach my $field ( @fields ) { +% +% my $value = $rate_tier_detail->get($field); + + <TD> + <% $field eq 'min_charge' ? $money_char : '' %> + <INPUT TYPE = "text" + NAME = "<%$name%>_<%$field%>" + ID = "<%$id%>_<%$field%>" + SIZE = "<% $size{$field} || 15 %>" + STYLE = "text-align:right" + VALUE = "<% scalar($cgi->param($name."_$field")) + || $value |h %>" + <% $onchange %> + ><BR> + <FONT SIZE="-1"><% $label{$field} %></FONT> + </TD> +% } + </TR> + </TABLE> + +% } +<%init> + +my( %opt ) = @_; + +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + +my $name = $opt{'element_name'} || $opt{'field'} || 'tierdetailnum'; +my $id = $opt{'id'} || 'tierdetailnum'; + +my $curr_value = $opt{'curr_value'} || $opt{'value'}; + +my $onchange = ''; +if ( $opt{'onchange'} ) { + $onchange = $opt{'onchange'}; + $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/; + $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack. all onchange + #callbacks should act the same + $onchange = 'onChange="'. $onchange. '"'; +} + +my $rate_tier_detail; +if ( $curr_value ) { + $rate_tier_detail = qsearchs('rate_tier_detail', { 'tierdetailnum' => $curr_value } ); +} else { + $rate_tier_detail = new FS::rate_tier_detail {}; +} + +my %size = ( 'title' => 12 ); + +tie my %label, 'Tie::IxHash', + 'min_quan' => 'Minimum quantity', + 'min_charge' => 'Charge per minute/call', +; + +my @fields = keys %label; + +</%init> |