[freeside-commits] branch FREESIDE_3_BRANCH updated. c9666df6c2717f98a5088b39f1babc55c4d8e771

Ivan ivan at 420.am
Thu Apr 16 13:09:49 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  c9666df6c2717f98a5088b39f1babc55c4d8e771 (commit)
      from  0fca17de96fcac6db1ecdf7e28f224091dc52b2e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c9666df6c2717f98a5088b39f1babc55c4d8e771
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Apr 16 13:09:48 2015 -0700

    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 2781905..751af3f 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 c77f332..80d9dbc 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<error>, 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

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm                 |   37 ++++++----
 fs_selfservice/FS-SelfService/SelfService.pm |   96 ++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 12 deletions(-)




More information about the freeside-commits mailing list