From: Ivan Kohler Date: Thu, 16 Apr 2015 20:09:48 +0000 (-0700) Subject: add E911 address to self-service provision_phone, document it, RT#34069 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=c9666df6c2717f98a5088b39f1babc55c4d8e771 add E911 address to self-service provision_phone, document it, RT#34069 --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 278190526..751af3f25 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -2631,11 +2631,12 @@ sub cancel_pkg { } sub provision_phone { - my $p = shift; - my @bulkdid; - @bulkdid = @{$p->{'bulkdid'}} if $p->{'bulkdid'}; + my $p = shift; + my @bulkdid; + @bulkdid = @{$p->{'bulkdid'}} if $p->{'bulkdid'}; - if($p->{'svcnum'} && $p->{'svcnum'} =~ /^\d+$/){ + #editing an existing phone number + if ( $p->{'svcnum'} && $p->{'svcnum'} =~ /^\d+$/ ) { my($context, $session, $custnum) = _custoragent_session_custnum($p); return { 'error' => $session } if $context eq 'error'; @@ -2652,8 +2653,8 @@ sub provision_phone { return { 'error' => $svc_phone->replace }; } -# single DID LNP - unless($p->{'lnp'}) { + # single DID LNP + unless ( $p->{'lnp'} ) { $p->{'lnp_desired_due_date'} = parse_datetime($p->{'lnp_desired_due_date'}); $p->{'lnp_status'} = "portingin"; return _provision( 'FS::svc_phone', @@ -2663,19 +2664,19 @@ sub provision_phone { $p, @_ ); - } + } -# single DID order - unless (scalar(@bulkdid)) { + # single DID order (the usual case) + unless (scalar(@bulkdid)) { return _provision( 'FS::svc_phone', [qw(phonenum countrycode)], [qw(phonenum countrycode)], $p, @_ ); - } + } -# bulk DID order case + # bulk DID order case my $error; foreach my $did ( @bulkdid ) { $did =~ s/[^0-9]//g; @@ -2767,9 +2768,21 @@ sub _provision { 'svcpart' => $p->{'svcpart'}, map { $_ => $p->{$_} } @$fields } ); + + my %insert_args = (); + #i shouldn't be a special case here (pass an option or something) + if ( $class eq 'FS::svc_phone' + && grep length($p->{$_}), @location_editable_fields + ) + { + $insert_args{'cust_location'} = new FS::cust_location { + map { $_ => $p->{$_} } @location_editable_fields + }; + } + warn "inserting $class record\n" if $DEBUG; - my $error = $svc_x->insert; + my $error = $svc_x->insert(%insert_args); unless ( $error ) { warn "finding inserted record for svcnum ". $svc_x->svcnum. "\n" diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index c77f33280..80d9dbc8a 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -1153,6 +1153,102 @@ pkgpart of package to cancel Returns a hash reference with a single key, B, empty on success, or an error message on errors. +=item provision_acct + +Provisions an account (svc_acct). + +Takes a hash references as parameter with the following keys: + +=over 4 + +=item session_id + +Session identifier + +=item pkgnum + +pkgnum of package into which this service is provisioned + +=item svcpart + +svcpart or service definition to provision + +=item username + +=item domsvc + +=item _password + +=back + +=item provision_phone + +Provisions a phone number (svc_phone). + +Takes a hash references as parameter with the following keys: + +=over 4 + +=item session_id + +Session identifier + +=item pkgnum + +pkgnum of package into which this service is provisioned + +=item svcpart + +svcpart or service definition to provision + +=item countrycode + +=item phonenum + +=item address1 + +=item address2 + +=item city + +=item county + +=item state + +=item zip + +=item country + +E911 Address (optional) + +=back + +=item provision_external + +Provisions an external service (svc_external). + +Takes a hash references as parameter with the following keys: + +=over 4 + +=item session_id + +Session identifier + +=item pkgnum + +pkgnum of package into which this service is provisioned + +=item svcpart + +svcpart or service definition to provision + +=item id + +=item title + +=back + =back =head1 SIGNUP FUNCTIONS