agent virtualize address blocks and routers
[freeside.git] / httemplate / edit / router.cgi
1 <% include('elements/edit.html',
2      'post_url'    => popurl(1).'process/router.cgi',
3      'name'        => 'router',
4      'table'       => 'router',
5      'viewall_url' => "${p}browse/router.cgi",
6      'labels'      => { 'routernum'  => 'Router',
7                         'routername' => 'Name',
8                         'svc_part'   => 'Service',
9                       },
10      'fields'      => [
11                         { 'field'=>'routername', 'type'=>'text', 'size'=>32 },
12                         { 'field'=>'agentnum',   'type'=>'select-agent' },
13                       ],
14      'error_callback' => $callback,
15      'edit_callback'  => $callback,
16      'new_callback'   => $callback,
17    )
18 %>
19 <%init>
20
21 my $curuser = $FS::CurrentUser::CurrentUser;
22
23 die "access denied"
24   unless $curuser->access_right('Engineering configuration')
25     || $curuser->access_right('Engineering global configuration');
26
27 my $callback = sub {
28   my ($cgi, $object, $fields) = (shift, shift, shift);
29   unless ($object->svcnum) {
30     push @{$fields},
31       { 'type'          => 'tablebreak-tr-title',
32         'value'         => 'Select the service types available on this router',
33       },
34       { 'field'         => 'svc_part',
35         'type'          => 'checkboxes-table',
36         'target_table'  => 'part_svc',
37         'link_table'    => 'part_svc_router',
38         'name_col'      => 'svc',
39         'hashref'       => { 'svcdb' => 'svc_broadband', 'disabled' => '' },
40       };
41   }
42 };
43
44 </%init>