import torrus 1.0.9
[freeside.git] / httemplate / edit / svc_phone.cgi
1 <% include( 'elements/svc_Common.html',
2                'table'    => 'svc_phone',
3                'fields'   => \@fields,
4                'svc_new_callback' => sub {
5                  my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_;
6                  $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg;
7                },
8            )
9 %>
10 <%init>
11
12 die "access denied"
13   unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
14
15 my $conf = new FS::Conf;
16
17 my @fields = ( 'countrycode',
18                { field => 'phonenum',
19                  type  => 'select-did',
20                  label => 'Phone number',
21                },
22              );
23
24 push @fields, { field => 'domsvc',
25                 type  => 'select-svc-domain',
26                 label => 'Domain',
27               }
28   if $conf->exists('svc_phone-domain');
29
30 push @fields, { field => 'pbxsvc',
31                 type  => 'select-svc_pbx',
32                 label => 'PBX',
33               },
34               'sip_password',
35               'pin',
36               { field => 'phone_name',
37                 type  => 'text',
38                 maxlength => $conf->config('svc_phone-phone_name-max_length'),
39               },
40
41               { value   => 'E911 Information',
42                 type    => 'tablebreak-tr-title',
43                 colspan => 7,
44               },
45               { field => 'locationnum',
46                 type  => 'select-cust_location',
47                 label => 'E911 location',
48                 include_opt_callback => sub {
49                   my $svc_phone = shift;
50                   my $pkgnum =  $svc_phone->get('pkgnum')
51                              || $cgi->param('pkgnum')
52                              || $svc_phone->cust_svc->pkgnum; #hua?
53                                #cross agent location exposure?  sheesh
54                   my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
55                   my $cust_main = $cust_pkg ? $cust_pkg->cust_main : '';
56                   ( 'no_bold'   => 1,
57                     'cust_pkg'  => $cust_pkg,
58                     'cust_main' => $cust_main,
59                   );
60                 },
61               },
62               { field => 'custnum', type=> 'hidden' }, #for new cust_locations
63 ;
64
65 if ( $conf->exists('svc_phone-lnp') ) {
66     push @fields,
67             { value   => 'Number Portability',
68               type    => 'tablebreak-tr-title',
69                                 colspan => 7,
70             },
71             {   field => 'lnp_status',
72                 type => 'select-lnp_status',
73             },
74             {   field => 'portable',
75                 type => 'checkbox',
76             },
77             'lrn',
78             {   field => 'lnp_desired_due_date',
79                 type => 'input-date-field',
80             },
81             {   field => 'lnp_due_date',
82                 type => 'input-date-field',
83                 noinit => 1,
84             },
85             'lnp_other_provider',
86             'lnp_other_provider_account',
87 ;
88 }
89
90 </%init>