signup page w/advertising source dropdown
[freeside.git] / FS / FS / ClientAPI / Signup.pm
index 92fc636..375958b 100644 (file)
@@ -10,6 +10,8 @@ use FS::part_pkg;
 use FS::svc_acct_pop;
 use FS::cust_main;
 use FS::cust_pkg;
+use FS::svc_acct;
+use FS::acct_snarf;
 use FS::Msgcat qw(gettext);
 
 use FS::ClientAPI; #hmm
@@ -38,6 +40,16 @@ sub signup_info {
                  )
       ],
 
+    'part_referral' =>
+      [
+        map { $_->hashref }
+          qsearch('part_referral',
+                    dbdef->table('part_referral')->column('disabled')
+                      ? { 'disabled' => '' }
+                      : {}
+                 )
+      ],
+
     'agentnum2part_pkg' =>
       {
         map {
@@ -70,6 +82,8 @@ sub signup_info {
 
     'countrydefault' => $conf->config('countrydefault') || 'US',
 
+    'refnum' => $conf->config('signup_server-default_refnum'),
+
   };
 
   if (
@@ -155,6 +169,20 @@ sub new_customer {
       qw( username _password sec_phrase popnum ),
   } );
 
+  my @acct_snarf;
+  my $snarfnum = 1;
+  while ( length($packet->{"snarf_machine$snarfnum"}) ) {
+    my $acct_snarf = new FS::acct_snarf ( {
+      'machine'   => $packet->{"snarf_machine$snarfnum"},
+      'protocol'  => $packet->{"snarf_protocol$snarfnum"},
+      'username'  => $packet->{"snarf_username$snarfnum"},
+      '_password' => $packet->{"snarf_password$snarfnum"},
+    } );
+    $snarfnum++;
+    push @acct_snarf, $acct_snarf;
+  }
+  $svc_acct->child_objects( \@acct_snarf );
+
   my $y = $svc_acct->setdefault; # arguably should be in new method
   return { 'error' => $y } if $y && !ref($y);