X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Faddr_block.cgi;h=9e7ef2af27d031bf70394688d0fa13c023b297bf;hb=35ac5f08fc816cd7d79dc9a861652537061aed03;hp=917f94c965ff98796a07924116336d3d61880af9;hpb=a1871d3d13c1dafa93b956762c0d23728d261da7;p=freeside.git
diff --git a/httemplate/browse/addr_block.cgi b/httemplate/browse/addr_block.cgi
index 917f94c96..9e7ef2af2 100644
--- a/httemplate/browse/addr_block.cgi
+++ b/httemplate/browse/addr_block.cgi
@@ -1,57 +1,77 @@
-<% include('elements/browse.html',
- 'title' => 'Address Blocks',
- 'name' => 'address block',
- 'html_init' => $html_init,
- 'html_foot' => $html_foot,
- 'query' => { 'table' => 'addr_block',
- 'hashref' => {},
- 'extra_sql' => $extra_sql,
- 'order_by' => $order_by,
- },
- 'count_query' => "SELECT count(*) from addr_block $count_sql",
- 'header' => [ 'Address Block',
- 'Router',
- 'Action(s)',
- '',
- ],
- 'fields' => [ 'NetAddr',
- sub { my $block = shift;
- my $router = $block->router;
- my $result = '';
- if ($router) {
- $result .= $router->routername. ' (';
- $result .= scalar($block->svc_broadband). ' services)';
- }
- $result;
- },
- $allocate_text,
- sub { shift->router ? '' : '(split)' },
- ],
- 'links' => [ '',
- '',
- [ 'javascript:void(0)', '' ],
- $split_link,
- ],
- 'link_onclicks' => [ '',
- '',
- $allocate_link,
- '',
- ],
- 'cell_styles' => [ '',
- '',
- 'border-right:none;',
- 'border-left:none;',
- ],
- 'agent_virt' => 1,
- 'agent_null_right' => 'Engineering global configuration',
- 'agent_pos' => 1,
- )
-%>
+<& elements/browse.html,
+ 'title' => 'Address Blocks',
+ 'name' => 'address block',
+ 'html_init' => $html_init,
+ 'html_foot' => $html_foot,
+ 'query' => { 'table' => 'addr_block',
+ 'hashref' => {},
+ 'extra_sql' => $extra_sql,
+ 'order_by' => $order_by,
+ },
+ 'count_query' => "SELECT count(*) from addr_block $count_sql",
+ 'header' => [ 'Address Block',
+ 'Router',
+ 'Action(s)',
+ '',
+ '',
+ '',
+ ],
+ 'fields' => [ 'NetAddr',
+ sub { my $b = shift;
+ my $router = $b->router;
+ my $result = '';
+ if ($router) {
+ $result .= $router->routername. ' ('.
+ scalar($b->svc_broadband). ' broadband, '.
+ scalar($b->svc_acct). ' account services)';
+ }
+ $result;
+ },
+ $allocate_text,
+ sub { shift->router ? '' : '(split)' },
+ sub { '('. (shift->manual_flag ? 'allow' : 'prevent'). ' automatic ip assignment)' },
+ sub {
+ my $block = shift;
+ if(!$block->router && scalar($block->svc_broadband) == 0) {
+ return '(delete)';
+ }
+ '';
+ },
+ ],
+ 'sort_fields' => [],
+ 'links' => [ '',
+ '',
+ [ 'javascript:void(0)', '' ],
+ $split_link,
+ $autoassign_link,
+ sub {
+ my $block = shift;
+ if(!$block->router && scalar($block->svc_broadband) == 0) {
+ [ "${p}misc/delete-addr_block.html?", 'blocknum' ];
+ }
+ },
+ ],
+ 'link_onclicks' => [ '',
+ '',
+ $allocate_link,
+ '',
+ '',
+ ],
+ 'cell_styles' => [ '',
+ '',
+ 'border-right:none;',
+ 'border-left:none;',
+ '',
+ ],
+ 'agent_virt' => 1,
+ 'agent_null_right' => 'Broadband global configuration',
+ 'agent_pos' => 1,
+&>
<%init>
die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Engineering configuration')
- || $FS::CurrentUser::CurrentUser->access_right('Engineering global configuration');
+ unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration')
+ || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration');
my $p2 = popurl(2);
my $path = $p2 . "edit/process/addr_block";
@@ -59,7 +79,7 @@ my $path = $p2 . "edit/process/addr_block";
my $extra_sql = "";
my $count_sql = "WHERE ". $FS::CurrentUser::CurrentUser->agentnums_sql(
- 'null_right' => 'Engineering global configuration',
+ 'null_right' => 'Broadband global configuration',
);
my $order_by = "ORDER BY ";
@@ -89,8 +109,7 @@ my $html_foot = qq(
/
);
$html_foot .= include( '/elements/select-agent.html',
- 'agent_virt' => 1,
- 'agent_null_right' => 'Engineering global configuration',
+ 'agent_null_right' => 'Broadband global configuration',
);
$html_foot .= qq(
@@ -133,4 +152,11 @@ my $split_link = sub {
$ref;
};
+my $autoassign_link = sub {
+ my $block = shift;
+ my $url = "$path/manual_flag.cgi?manual_flag=";
+ $url .= $block->manual_flag ? '' : 'Y';
+ [ "$url;blocknum=", 'blocknum' ];
+};
+
%init>