Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / FS / FS / ClientAPI / Signup.pm
index 5010ec9..e11a47a 100644 (file)
@@ -164,8 +164,6 @@ sub signup_info {
 
       'security_phrase' => $conf->exists('security_phrase'),
 
-      'nomadix' => $conf->exists('signup_server-nomadix'),
-
       'payby' => [ $conf->config('signup_server-payby') ],
 
       'payby_longname' => [ map { FS::payby->longname($_) } 
@@ -192,7 +190,6 @@ sub signup_info {
 
       'agentnum2part_pkg'  => $agentnum2part_pkg,
       'svc_acct_pop'       => [ map $_->hashref, qsearch('svc_acct_pop',{} ) ],
-      'nomadix'            => $conf->exists('signup_server-nomadix'),
       'payby'              => [ $conf->config('signup_server-payby') ],
       'card_types'         => card_types(),
       'paytypes'           => [ FS::cust_payby->paytypes ],
@@ -1298,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} ) {
@@ -1347,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({