enable CardFortress in test database, #71513
[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 <TR>
28   <TD>Rate plan</TD>
29   <TD><INPUT TYPE="text" NAME="ratename" SIZE=32 VALUE="<% $rate->ratename %>"></TD>
30 </TR>
31 </TABLE>
32 <BR>
33
34 <INPUT NAME="submit" TYPE="button" VALUE="<% 
35   $rate->ratenum ? "Apply changes" : "Add rate plan"
36 %>" onClick="document.OneTrueForm.submit.disabled=true; process();">
37 </FORM>
38
39 % if($rate->ratenum) {
40 <BR><BR><FONT SIZE="+2">Rates in this plan</FONT>
41 % if ( my $select_cdr_type = include('/elements/select-cdr_type.html',
42 %  'curr_value'   => $cdrtypenum,
43 %  'onchange'     => 'form.submit();',
44 %  'name_col'     => 'cdrtypename',
45 %  'value_col'    => 'cdrtypenum',
46 %  'empty_label'  => '(default)',
47 % ) ) {
48 <FORM ACTION="<%$cgi->url%>" METHOD="GET">
49 <INPUT TYPE="hidden" NAME="ratenum" VALUE="<% $rate->ratenum %>">
50 <INPUT TYPE="hidden" NAME="countrycode" VALUE="<% $countrycode %>">
51 <FONT SIZE="+1">Usage type: <% $select_cdr_type %></FONT>
52 </FORM>
53 % }
54
55 <% include('/edit/elements/rate_detail.html',
56             'ratenum'     => $rate->ratenum,
57             'countrycode' => $countrycode,
58             'cdrtypenum'  => $cdrtypenum,
59 ) %>
60 % }
61
62 <% include('/elements/footer.html') %>
63
64 <%init>
65
66 die "access denied"
67   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
68
69 my $rate;
70 if ( $cgi->param('ratenum') ) {
71   $cgi->param('ratenum') =~ /^(\d+)$/;
72   $rate = qsearchs( 'rate', { 'ratenum' => $1 } );
73 } else { #adding
74   $rate = new FS::rate {};
75 }
76 my $action = $rate->ratenum ? 'Edit' : 'Add';
77
78 my $countrycode = '';
79 if ( $cgi->param('countrycode') =~ /^(\d+)$/ ) {
80   $countrycode = $1;
81 }
82
83 my $cdrtypenum = '';
84 if ( $cgi->param('cdrtypenum') =~ /^(\d+)$/ ) {
85   $cdrtypenum = $1;
86 }
87 </%init>