This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / httemplate / edit / process / svc_phone.html
1 <% include( 'elements/svc_Common.html',
2                'table'    => 'svc_phone',
3                'args_callback' => $args_callback,
4                'value_callback' => $value_callback,
5            )
6 %>
7 <%init>
8
9 die "access denied"
10   unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
11
12 my $tollfreephonenum = $cgi->param('tollfreephonenum');
13 $cgi->param('phonenum',$tollfreephonenum) if $tollfreephonenum =~ /^\d+$/;
14
15 my $args_callback = sub {
16   my( $cgi, $object ) = @_;
17
18   my %opt = ();
19   if ( $cgi->param('locationnum') == -1 ) {
20     my $cust_location = new FS::cust_location {
21       map { $_ => scalar($cgi->param($_)) }
22           qw( custnum address1 address2 city county state zip country )
23     };
24     $opt{'cust_location'} = $cust_location;
25   }
26
27   %opt;
28
29 };
30
31 my $value_callback = sub {
32      my ($field, $value) = @_;
33      ($field =~ /_date$/) ? parse_datetime($value) : $value;
34 };
35
36 </%init>