This commit was generated by cvs2svn to compensate for changes in r10640,
[freeside.git] / httemplate / browse / rate.cgi
1 <% include( 'elements/browse.html',
2               'title'       => 'Rate plans',
3               'menubar'     => [ 'Regions and Prefixes' =>
4                                    $p.'browse/rate_region.html',
5                                  'Time Periods' =>
6                                    $p.'browse/rate_time.html',
7                                  'CDR Types' =>
8                                    $p.'edit/cdr_type.cgi',
9                                ],
10               'html_init'   => $html_init,
11               'name'        => 'rate plans',
12               'query'       => { 'table'     => 'rate',
13                                  'hashref'   => {},
14                                  'order_by' => 'ORDER BY ratenum',
15                                },
16               'count_query' => $count_query,
17               'header'      => [ '#',       'Rate plan', 'Rates'    ],
18               'fields'      => [ 'ratenum', 'ratename',  $rates_sub ],
19               'links'       => [ $link,     $link,       ''         ],
20               'really_disable_download' => 1
21           )
22 %>
23 <%once>
24
25 my $all_countrycodes = join("\n", map qq(<OPTION VALUE="$_">$_),
26                                       FS::rate_prefix->all_countrycodes
27                            );
28
29 my $rates_sub = sub {
30   my $rate = shift;
31   my $ratenum = $rate->ratenum;
32
33   qq( <FORM METHOD="GET" ACTION="${p}edit/rate.cgi">
34         <INPUT TYPE="hidden" NAME="ratenum" VALUE="$ratenum">
35         <SELECT NAME="countrycode" onChange="this.form.submit();">
36           <OPTION SELECTED>Select Country Code
37           <OPTION VALUE="">(all)
38           $all_countrycodes
39         </SELECT>
40       </FORM>
41     );
42
43
44 };
45
46 my $html_init = 
47   'Rate plans for VoIP and call billing.<BR><BR>'.
48   qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!.
49   qq! | <A HREF="${p}misc/copy-rate_detail.html"><I>Copy rates between plans</I></A>!.
50   '<BR><BR>
51    <SCRIPT>
52    function rate_areyousure(href) {
53     if (confirm("Are you sure you want to delete this rate plan?") == true)
54       window.location.href = href;
55    }
56    </SCRIPT>
57   ';
58
59 my $count_query = 'SELECT COUNT(*) FROM rate';
60
61 my $link = [ $p.'edit/rate.cgi?ratenum=', 'ratenum' ];
62
63 </%once>
64 <%init>
65
66 die "access denied"
67   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
68
69 </%init>