[freeside-commits] branch master updated. c42bf39feed32a9d0ca83944284463a148dbfed6

Mark Wells mark at 420.am
Thu Oct 6 16:48:37 PDT 2016


The branch, master has been updated
       via  c42bf39feed32a9d0ca83944284463a148dbfed6 (commit)
      from  dbff6cc9f027e23599ecc35e7092583da4be0b77 (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 c42bf39feed32a9d0ca83944284463a148dbfed6
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Oct 6 15:55:10 2016 -0700

    fix prospect creation from EUS API, #39776

diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm
index df276f0..e11a47a 100644
--- a/FS/FS/ClientAPI/Signup.pm
+++ b/FS/FS/ClientAPI/Signup.pm
@@ -1295,7 +1295,15 @@ sub new_prospect {
         'title'     => $title,
     });
     if (!$part_referral) {
-      return { error => "Unknown referral type: '$title'" };
+      $part_referral = FS::part_referral->new({
+        'agentnum' => $agentnum,
+        'title'    => $title,
+        'referral' => $title,
+      });
+      $error = $part_referral->insert;
+      if ( $error ) {
+        warn "ERROR: could not create referral type '$title': $error\n";
+      }
     }
     $refnum = $part_referral->refnum;
   } elsif ( $packet->{refnum} ) {
@@ -1344,9 +1352,8 @@ sub new_prospect {
   }
   $location->set('country', $country);
   $location->set('state', $state);
-  $prospect->set('cust_location', $location);
 
-  $error ||= $prospect->insert; # also does location
+  $error ||= $prospect->insert( cust_location => $location );
   return { error => $error } if $error;
 
   my $contact = FS::contact->new({
diff --git a/ng_selfservice/coverage_post.php b/ng_selfservice/coverage_post.php
index 657a2ff..c457002 100644
--- a/ng_selfservice/coverage_post.php
+++ b/ng_selfservice/coverage_post.php
@@ -10,7 +10,7 @@ $xml = file_get_contents('php://input');
 $doc = new SimpleXMLElement($xml);
 $cd = $doc->CustomerDetails;
 if ($DEBUG) {
-    error_log(var_dump($cd));
+    error_log(print_r($cd),1);
 }
 
 // State and Country are names rather than codes, but we fix that on the other
@@ -35,9 +35,9 @@ $prospect = Array();
 foreach ($map_fields as $k => $v) {
     $prospect[$k] = (string)($cd->$v);
 }
-error_log(var_dump($prospect));
+error_log(print_r($prospect),1);
 $freeside = new FreesideSelfService();
 $result = $freeside->new_prospect($prospect);
-error_log(var_dump($result));
+error_log(print_r($result),1);
 
 ?>

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

Summary of changes:
 FS/FS/ClientAPI/Signup.pm        |   13 ++++++++++---
 ng_selfservice/coverage_post.php |    6 +++---
 2 files changed, 13 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list