NENA2 E911 export and batch-oriented exports in general, #14049
[freeside.git] / httemplate / edit / svc_phone.cgi
1 <& elements/svc_Common.html,
2      'table'            => 'svc_phone',
3      'fields'           => [],
4      'begin_callback'   => $begin_callback,
5      'svc_new_callback' => sub {
6        my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_;
7        $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg;
8      },
9      'svc_edit_callback' => sub {
10        my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_;
11        my $conf = new FS::Conf;
12        $svc_x->sip_password('*HIDDEN*') unless $conf->exists('showpasswords');
13      },
14 &>
15 <%init>
16
17 my $begin_callback = sub {
18   my( $cgi, $fields, $opt ) = @_;
19
20   my $bulk = $cgi->param('bulk') ? 1 : 0;
21
22   my $right = $bulk ? 'Bulk provision customer service'
23                     :      'Provision customer service';
24
25   die "access denied"
26     unless $FS::CurrentUser::CurrentUser->access_right($right);
27
28   my $conf = new FS::Conf;
29
30   push @$fields,
31               'countrycode',
32               { field    => 'phonenum',
33                 type     => 'select-did',
34                 label    => 'Phone number',
35                 multiple => $bulk,
36               },
37               { field     => 'sim_imsi',
38                 type      => 'text',
39                 size      => 15,
40                 maxlength => 15,
41               };
42
43   push @$fields, { field => 'domsvc',
44                    type  => 'select-svc-domain',
45                    label => 'Domain',
46                  }
47     if $conf->exists('svc_phone-domain');
48
49   push @$fields, { field => 'pbxsvc',
50                    type  => 'select-svc_pbx',
51                    label => 'PBX',
52                  };
53
54   if ( $bulk ) {
55
56     push @$fields, { field => 'bulk',
57                      type  => 'hidden',
58                      value => '1',
59                    };
60
61   } else {
62
63     push @$fields,
64               'sip_password',
65               'pin',
66               { field => 'phone_name',
67                 type  => 'text',
68                 maxlength => $conf->config('svc_phone-phone_name-max_length'),
69               },
70               'forwarddst',
71               'email',
72
73               { value   => 'E911 Information',
74                 type    => 'tablebreak-tr-title',
75                 colspan => 8,
76               },
77               { field => 'locationnum',
78                 type  => 'select-cust_location',
79                 label => 'E911 location',
80                 include_opt_callback => sub {
81                   my $svc_phone = shift;
82                   my $pkgnum =  $svc_phone->get('pkgnum')
83                              || $cgi->param('pkgnum')
84                              || $svc_phone->cust_svc->pkgnum; #hua?
85                                #cross agent location exposure?  sheesh
86                   my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
87                   my $cust_main = $cust_pkg ? $cust_pkg->cust_main : '';
88                   ( 'no_bold'   => 1,
89                     'cust_pkg'  => $cust_pkg,
90                     'cust_main' => $cust_main,
91                   );
92                 },
93               },
94               { field   => 'e911_class',
95                 type    => 'select',
96                 options => [ keys(%{ FS::svc_phone->e911_classes }) ],
97                 labels  => FS::svc_phone->e911_classes,
98               },
99               { field   => 'e911_type',
100                 type    => 'select',
101                 options => [ keys(%{ FS::svc_phone->e911_types }) ],
102                 labels  => FS::svc_phone->e911_types,
103               },
104               { field => 'custnum', type=> 'hidden' }, #for new cust_locations
105     ;
106   }
107
108   if ( $conf->exists('svc_phone-lnp') && !$bulk ) {
109     push @$fields,
110             { value   => 'Number Portability',
111               type    => 'tablebreak-tr-title',
112                                 colspan => 8,
113             },
114             {   field => 'lnp_status',
115                 type => 'select-lnp_status',
116             },
117             'lnp_reject_reason',
118             {   field => 'portable',
119                 type => 'checkbox',
120             },
121             'lrn',
122             {   field => 'lnp_desired_due_date',
123                 type => 'input-date-field',
124             },
125             {   field => 'lnp_due_date',
126                 type => 'input-date-field',
127                 noinit => 1,
128             },
129             'lnp_other_provider',
130             'lnp_other_provider_account',
131     ;
132   }
133
134   if ( ! $bulk ) {
135
136     push @$fields,
137            {
138              type    => 'tablebreak-tr-title',
139              value   => 'Carrier Information',
140              colspan => 8,
141            },
142            { field => 'sms_carrierid',
143              label => 'SMS Carrier',
144              type  => 'select-cdr_carrier',
145            },
146            'sms_account',
147            'max_simultaneous',
148     ;
149
150   }
151
152 };
153
154
155 </%init>