vitelity API improvements for toll-free and fax, RT11009
[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               'route',
41               'forwarddst',
42               'email',
43
44               { value   => 'E911 Information',
45                 type    => 'tablebreak-tr-title',
46                 colspan => 7,
47               },
48               { field => 'locationnum',
49                 type  => 'select-cust_location',
50                 label => 'E911 location',
51                 include_opt_callback => sub {
52                   my $svc_phone = shift;
53                   my $pkgnum =  $svc_phone->get('pkgnum')
54                              || $cgi->param('pkgnum')
55                              || $svc_phone->cust_svc->pkgnum; #hua?
56                                #cross agent location exposure?  sheesh
57                   my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
58                   my $cust_main = $cust_pkg ? $cust_pkg->cust_main : '';
59                   ( 'no_bold'   => 1,
60                     'cust_pkg'  => $cust_pkg,
61                     'cust_main' => $cust_main,
62                   );
63                 },
64               },
65               { field => 'custnum', type=> 'hidden' }, #for new cust_locations
66 ;
67
68 if ( $conf->exists('svc_phone-lnp') ) {
69     push @fields,
70             { value   => 'Number Portability',
71               type    => 'tablebreak-tr-title',
72                                 colspan => 7,
73             },
74             {   field => 'lnp_status',
75                 type => 'select-lnp_status',
76             },
77             'lnp_reject_reason',
78             {   field => 'portable',
79                 type => 'checkbox',
80             },
81             'lrn',
82             {   field => 'lnp_desired_due_date',
83                 type => 'input-date-field',
84             },
85             {   field => 'lnp_due_date',
86                 type => 'input-date-field',
87                 noinit => 1,
88             },
89             'lnp_other_provider',
90             'lnp_other_provider_account',
91 ;
92 }
93
94 </%init>