show imported region and rate #s, RT#83146
[freeside.git] / httemplate / edit / rate.cgi
1 <& /elements/header.html,
2   "$action Rate plan",
3   menubar(
4       'View all rate plans' => "${p}browse/rate.cgi",
5       'View packages that use this plan' => "${p}browse/part_pkg.cgi?ratenum="
6                                             . $rate->ratenum,
7   )
8 &>
9
10 <% include('/elements/progress-init.html',
11               'OneTrueForm',
12               [ 'rate', 'agentnum' ],
13               'process/rate.cgi',
14               $p.'browse/rate.cgi',
15            )
16 %>
17 <FORM NAME="OneTrueForm">
18 <INPUT TYPE="hidden" NAME="ratenum" VALUE="<% $rate->ratenum %>">
19
20 <TABLE CLASS="fsinnerbox">
21
22 <& /elements/tr-select-agent.html,
23      disable_empty => ! $FS::CurrentUser::CurrentUser->access_right('Configuration'), #, 'Edit global CDR rates'
24      empty_label   => '(global)',
25 &>
26
27 % if ( $rate->agent_rateid ) {
28     <TR>
29       <TH ALIGN="right">Legacy #</TH>
30       <TD><% $rate->agent_rateid |h %></TD>
31     </TR>
32 % }
33
34 <TR>
35   <TH>Rate plan</TH>
36   <TD><INPUT TYPE="text" NAME="ratename" SIZE=32 VALUE="<% $rate->ratename %>"></TD>
37 </TR>
38 </TABLE>
39 <BR>
40
41 <INPUT NAME="submit" TYPE="button" VALUE="<% 
42   $rate->ratenum ? "Apply changes" : "Add rate plan"
43 %>" onClick="document.OneTrueForm.submit.disabled=true; process();">
44 </FORM>
45
46 % if($rate->ratenum) {
47 <BR><BR><FONT SIZE="+2">Rates in this plan</FONT>
48 % if ( my $select_cdr_type = include('/elements/select-cdr_type.html',
49 %  'curr_value'   => $cdrtypenum,
50 %  'onchange'     => 'form.submit();',
51 %  'name_col'     => 'cdrtypename',
52 %  'value_col'    => 'cdrtypenum',
53 %  'empty_label'  => '(default)',
54 % ) ) {
55 <FORM ACTION="<%$cgi->url%>" METHOD="GET">
56 <INPUT TYPE="hidden" NAME="ratenum" VALUE="<% $rate->ratenum %>">
57 <INPUT TYPE="hidden" NAME="countrycode" VALUE="<% $countrycode %>">
58 <FONT SIZE="+1">Usage type: <% $select_cdr_type %></FONT>
59 </FORM>
60 % }
61
62 <% include('/edit/elements/rate_detail.html',
63             'ratenum'     => $rate->ratenum,
64             'countrycode' => $countrycode,
65             'cdrtypenum'  => $cdrtypenum,
66 ) %>
67 % }
68
69 <% include('/elements/footer.html') %>
70
71 <%init>
72
73 die "access denied"
74   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
75
76 my $rate;
77 if ( $cgi->param('ratenum') ) {
78   $cgi->param('ratenum') =~ /^(\d+)$/;
79   $rate = qsearchs( 'rate', { 'ratenum' => $1 } );
80 } else { #adding
81   $rate = new FS::rate {};
82 }
83 my $action = $rate->ratenum ? 'Edit' : 'Add';
84
85 my $countrycode = '';
86 if ( $cgi->param('countrycode') =~ /^(\d+)$/ ) {
87   $countrycode = $1;
88 }
89
90 my $cdrtypenum = '';
91 if ( $cgi->param('cdrtypenum') =~ /^(\d+)$/ ) {
92   $cdrtypenum = $1;
93 }
94 </%init>