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