cdr rating by day and time, part 2, RT#4763
[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 <% include('/edit/elements/rate_detail.html',
30             'ratenum' => $rate->ratenum
31 ) %>
32 % }
33
34 <% include('/elements/footer.html') %>
35
36 <%init>
37
38 die "access denied"
39   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
40
41 my $rate;
42 if ( $cgi->keywords ) {
43   my($query) = $cgi->keywords;
44   $query =~ /^(\d+)$/;
45   $rate = qsearchs( 'rate', { 'ratenum' => $1 } );
46 } else { #adding
47   $rate = new FS::rate {};
48 }
49 my $action = $rate->ratenum ? 'Edit' : 'Add';
50
51 </%init>