[freeside-commits] branch master updated. b37cafd2acd4ab2c38b44bc4d8ebde76936ef6bb

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


The branch, master has been updated
       via  b37cafd2acd4ab2c38b44bc4d8ebde76936ef6bb (commit)
      from  fe1596e131a981a57391eb60bb175bb6f95374e4 (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 b37cafd2acd4ab2c38b44bc4d8ebde76936ef6bb
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Apr 16 13:09:46 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 471a093..93f817d 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -2665,11 +2665,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';
     
@@ -2686,8 +2687,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',
@@ -2697,19 +2698,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;
@@ -2801,9 +2802,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 c481372..9d7e7ed 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -1155,6 +1155,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