+ warn "[fs_signup_server] $data\n" if $Debug > 2;
+
+ warn "[fs_signup_server] Sending package definitions...\n" if $Debug;
+ my @part_pkg = grep { $_->svcpart('svc_acct') && $pkgpart->{ $_->pkgpart } }
+ qsearch( 'part_pkg', {} );
+ print $writer $data = join("\n",
+ ( scalar(@part_pkg) || die "no usable package definitions, agent $agentnum" ),
+ map {
+ $_->pkgpart,
+ $_->pkg,
+ } @part_pkg
+ ), "\n";
+ warn "[fs_signup_server] $data\n" if $Debug > 2;
+
+ warn "[fs_signup_server] Sending POPs...\n" if $Debug;
+ my @svc_acct_pop = qsearch ('svc_acct_pop',{} );
+ print $writer $data = join("\n",
+ ( scalar(@svc_acct_pop) || die "No points of presence (svc_acct_pop records)" ),
+ map {
+ $_->popnum,
+ $_->city,
+ $_->state,
+ $_->ac,
+ $_->exch,
+ $_->loc,
+ } @svc_acct_pop
+ ), "\n";
+ warn "[fs_signup_server] $data\n" if $Debug > 2;
+
+ warn "[fs_signup_server] Entering main loop...\n" if $Debug;
+ while (1) {
+ warn "[fs_signup_server] Reading (waiting for) signup data...\n" if $Debug;
+ chop( my(
+ $first, $last, $ss, $company, $address1, $address2, $city, $county,
+ $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo,
+ $paydate, $payname, $invoicing_list, $pkgpart, $username, $password,
+ $popnum,
+ ) = map { scalar(<$reader>) } ( 1 .. 23 ) );
+
+ warn "[fs_signup_server] Processing signup...\n" if $Debug;
+
+ my $error = '';
+
+ #shares some stuff with htdocs/edit/process/cust_main.cgi... take any
+ # common that are still here and library them.
+ my $cust_main = new FS::cust_main ( {
+ 'custnum' => '',
+ 'agentnum' => $agentnum,
+ 'refnum' => $refnum,
+ 'last' => $last,
+ 'first' => $first,
+ 'ss' => $ss,
+ 'company' => $company,
+ 'address1' => $address1,
+ 'address2' => $address2,
+ 'city' => $city,
+ 'county' => $county,
+ 'state' => $state,
+ 'zip' => $zip,
+ 'country' => $country,
+ 'daytime' => $daytime,
+ 'night' => $night,
+ 'fax' => $fax,
+ 'payby' => $payby,
+ 'payinfo' => $payinfo,
+ 'paydate' => $paydate,
+ 'payname' => $payname,
+ } );