This commit was generated by cvs2svn to compensate for changes in r10640,
[freeside.git] / httemplate / edit / rate.cgi
1 <% include("/elements/header.html","$action Rate plan", menubar(
2       'View all rate plans' => "${p}browse/rate.cgi",
3     ))
4 %>
5
6 <% include('/elements/progress-init.html',
7               'OneTrueForm',
8               [ 'rate', 'preserve_rate_detail' ], # 'rate', 'min_', 'sec_' ],
9               'process/rate.cgi',
10               $p.'browse/rate.cgi',
11            )
12 %>
13 <FORM NAME="OneTrueForm">
14 <INPUT TYPE="hidden" NAME="ratenum" VALUE="<% $rate->ratenum %>">
15
16 Rate plan
17 <INPUT TYPE="text" NAME="ratename" SIZE=32 VALUE="<% $rate->ratename %>">
18 <BR><BR>
19
20 <INPUT TYPE="hidden" NAME="preserve_rate_detail" VALUE="1">
21
22 <INPUT NAME="submit" TYPE="button" VALUE="<% 
23   $rate->ratenum ? "Apply changes" : "Add rate plan"
24 %>" onClick="document.OneTrueForm.submit.disabled=true; process();">
25 </FORM>
26
27 % if($rate->ratenum) {
28 <BR><BR><FONT SIZE="+2">Rates in this plan</FONT>
29 % if ( my $select_cdr_type = include('/elements/select-cdr_type.html',
30 %  'curr_value'   => $cdrtypenum,
31 %  'onchange'     => 'form.submit();',
32 %  'name_col'     => 'cdrtypename',
33 %  'value_col'    => 'cdrtypenum',
34 %  'empty_label'  => '(default)',
35 % ) ) {
36 <FORM ACTION="<%$cgi->url%>" METHOD="GET">
37 <INPUT TYPE="hidden" NAME="ratenum" VALUE="<% $rate->ratenum %>">
38 <INPUT TYPE="hidden" NAME="countrycode" VALUE="<% $countrycode %>">
39 <FONT SIZE="+1">Usage type: <% $select_cdr_type %></FONT>
40 </FORM>
41 % }
42
43 <% include('/edit/elements/rate_detail.html',
44             'ratenum'     => $rate->ratenum,
45             'countrycode' => $countrycode,
46             'cdrtypenum'  => $cdrtypenum,
47 ) %>
48 % }
49
50 <% include('/elements/footer.html') %>
51
52 <%init>
53
54 die "access denied"
55   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
56
57 my $rate;
58 if ( $cgi->param('ratenum') ) {
59   $cgi->param('ratenum') =~ /^(\d+)$/;
60   $rate = qsearchs( 'rate', { 'ratenum' => $1 } );
61 } else { #adding
62   $rate = new FS::rate {};
63 }
64 my $action = $rate->ratenum ? 'Edit' : 'Add';
65
66 my $countrycode = '';
67 if ( $cgi->param('countrycode') =~ /^(\d+)$/ ) {
68   $countrycode = $1;
69 }
70
71 my $cdrtypenum = '';
72 if ( $cgi->param('cdrtypenum') =~ /^(\d+)$/ ) {
73   $cdrtypenum = $1;
74 }
75 </%init>