RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / edit / process / svc_phone.html
1 <& elements/svc_Common.html,
2                'table'          => 'svc_phone',
3                'args_callback'  => $args_callback,
4                'value_callback' => $value_callback,
5                'edit_callback'  => $edit_callback,
6                %opt,
7 &>
8 <%init>
9
10 my %opt = ();
11 if ( $cgi->param('bulk') ) {
12   $opt{'bulk'}     = 'phonenum';
13
14   my $cust_pkg = qsearchs('cust_pkg', { pkgnum=>scalar($cgi->param('pkgnum')) })
15     or die "unknown pkgnum";
16   my $custnum = $cust_pkg->custnum;
17
18   my $show =
19     $FS::CurrentUser::CurrentUser->default_customer_view =~ /^(jumbo|packages)$/
20       ? ''
21       : ';show=packages';
22   #my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment
23   $opt{'redirect'}= popurl(3)."view/cust_main.cgi?custnum=$custnum$show;dummy=";
24 }
25
26 my $right = $opt{'bulk'} ? 'Bulk provision customer service'
27                          :      'Provision customer service';
28
29 die "access denied"
30   unless $FS::CurrentUser::CurrentUser->access_right($right);
31
32 $cgi->param('phonenum', $cgi->param('phonenum_manual') )
33   if $cgi->param('phonenum_which') eq 'phonenum_manual';
34
35 my $tollfreephonenum = $cgi->param('tollfreephonenum');
36 $cgi->param('phonenum',$tollfreephonenum) if $tollfreephonenum =~ /^\d+$/;
37
38 my $args_callback = sub {
39   my( $cgi, $object ) = @_;
40
41   my %opt = ();
42   if ( $cgi->param('locationnum') == -1 ) {
43     my $cust_location = FS::cust_location->new({
44       map { $_ => scalar($cgi->param($_)) }
45           qw( custnum address1 address2 city county state zip country )
46     });
47     $opt{'cust_location'} = $cust_location;
48   }
49
50   %opt;
51
52 };
53
54 my $value_callback = sub {
55   my ($field, $value) = @_;
56   ($field =~ /_date$/) ? parse_datetime($value) : $value;
57 };
58
59 my $edit_callback = sub {
60   my( $new, $old ) = @_;
61   $new->sip_password( $old->sip_password ) if $new->sip_password eq '*HIDDEN*';
62 };
63
64 </%init>