This commit was generated by cvs2svn to compensate for changes in r12472,
[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 &>
10 <%init>
11
12 my $begin_callback = sub {
13   my( $cgi, $fields, $opt ) = @_;
14
15   my $bulk = $cgi->param('bulk') ? 1 : 0;
16
17   my $right = $bulk ? 'Bulk provision customer service'
18                     :      'Provision customer service';
19
20   die "access denied"
21     unless $FS::CurrentUser::CurrentUser->access_right($right);
22
23   my $conf = new FS::Conf;
24
25   push @$fields,
26               'countrycode',
27               { field    => 'phonenum',
28                 type     => 'select-did',
29                 label    => 'Phone number',
30                 multiple => $bulk,
31               };
32
33   push @$fields, { field => 'domsvc',
34                    type  => 'select-svc-domain',
35                    label => 'Domain',
36                  }
37     if $conf->exists('svc_phone-domain');
38
39   push @$fields, { field => 'pbxsvc',
40                    type  => 'select-svc_pbx',
41                    label => 'PBX',
42                  };
43
44   if ( $bulk ) {
45
46     push @$fields, { field => 'bulk',
47                      type  => 'hidden',
48                      value => '1',
49                    };
50
51   } else {
52
53     push @$fields,
54               'sip_password',
55               'pin',
56               { field => 'phone_name',
57                 type  => 'text',
58                 maxlength => $conf->config('svc_phone-phone_name-max_length'),
59               },
60               'forwarddst',
61               'email',
62
63               { value   => 'E911 Information',
64                 type    => 'tablebreak-tr-title',
65                 colspan => 8,
66               },
67               { field => 'locationnum',
68                 type  => 'select-cust_location',
69                 label => 'E911 location',
70                 include_opt_callback => sub {
71                   my $svc_phone = shift;
72                   my $pkgnum =  $svc_phone->get('pkgnum')
73                              || $cgi->param('pkgnum')
74                              || $svc_phone->cust_svc->pkgnum; #hua?
75                                #cross agent location exposure?  sheesh
76                   my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
77                   my $cust_main = $cust_pkg ? $cust_pkg->cust_main : '';
78                   ( 'no_bold'   => 1,
79                     'cust_pkg'  => $cust_pkg,
80                     'cust_main' => $cust_main,
81                   );
82                 },
83               },
84               { field => 'custnum', type=> 'hidden' }, #for new cust_locations
85     ;
86   }
87
88   if ( $conf->exists('svc_phone-lnp') && !$bulk ) {
89     push @$fields,
90             { value   => 'Number Portability',
91               type    => 'tablebreak-tr-title',
92                                 colspan => 8,
93             },
94             {   field => 'lnp_status',
95                 type => 'select-lnp_status',
96             },
97             'lnp_reject_reason',
98             {   field => 'portable',
99                 type => 'checkbox',
100             },
101             'lrn',
102             {   field => 'lnp_desired_due_date',
103                 type => 'input-date-field',
104             },
105             {   field => 'lnp_due_date',
106                 type => 'input-date-field',
107                 noinit => 1,
108             },
109             'lnp_other_provider',
110             'lnp_other_provider_account',
111     ;
112   }
113
114 };
115
116 </%init>