enable CardFortress in test database, #71513
[freeside.git] / httemplate / browse / addr_range.html
1 <& elements/browse.html,
2   'title'         => 'Address Ranges',
3   'name_singular' => 'address range',
4   'html_init'     => $html_init,
5   'html_foot'     => $html_foot,
6   'query'         => { 'table'     => 'addr_range',
7                        'order_by'  => $order_by,
8                      },
9   'count_query'   => "SELECT count(*) from addr_range",
10   'header'        => [ 'From',
11                        '', # the dash
12                        'To',
13                        'Status',
14                        # would be nice to show whether any addresses in the 
15                        # range are assigned, but that's ugly
16                      ],
17   'fields'        => [ 'start',
18                        sub { '&ndash;' },
19                        'end',
20                        'desc',
21                      ],
22   'links'         => [
23                        [ '#' ],
24                        '',
25                        [ '#' ],
26                      ],
27   'link_onclicks' => [ $edit_link,
28                        '',
29                        $edit_link,
30                        '',
31                      ],
32 &>
33 <%init>
34
35 die "access denied"
36   unless $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration');
37 # addr_ranges are ALWAYS global, else there will be chaos
38
39 my $order_by = "ORDER BY inet(start)"; # Pg-ism
40 # though we could also make the field itself inet-type...
41 # this would simplify a lot of things.
42
43 my $html_init = include('/elements/error.html');
44
45 my $edit_link = sub {
46   my $addr_range = shift;
47   include('/elements/popup_link_onclick.html',
48     action      => $p.'edit/addr_range.html?rangenum='.
49                    $addr_range->rangenum,
50     actionlabel => 'Edit address range',
51     width       => 650,
52     height      => 420,
53   );
54 };
55
56 my $add_link = include('/elements/popup_link_onclick.html',
57     action      => $p.'edit/addr_range.html',
58     actionlabel => 'Edit address range',
59     width       => 650,
60     height      => 420,
61 );
62
63 my $html_foot = qq!<A HREF="#" onclick="$add_link">
64 <I>Add a new address range</I></A>!;
65
66 </%init>