From: ivan Date: Tue, 28 Aug 2001 16:58:08 +0000 (+0000) Subject: customer-to-customer referrals in singup server X-Git-Tag: freeside_1_4_0pre11~405 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=5e99168da38e7616fc726242ce7d85e140f22c6f customer-to-customer referrals in singup server --- diff --git a/fs_signup/FS-SignupClient/SignupClient.pm b/fs_signup/FS-SignupClient/SignupClient.pm index 5769c18fc..d656d7528 100644 --- a/fs_signup/FS-SignupClient/SignupClient.pm +++ b/fs_signup/FS-SignupClient/SignupClient.pm @@ -7,7 +7,7 @@ use Socket; use FileHandle; use IO::Handle; -$VERSION = '0.01'; +$VERSION = '0.02'; @ISA = qw( Exporter ); @EXPORT_OK = qw( signup_info new_customer ); @@ -35,29 +35,30 @@ FS::SignupClient - Freeside signup client API ( $locales, $packages, $pops ) = signup_info; $error = new_customer ( { - 'first' => $first, - 'last' => $last, - 'ss' => $ss, - 'comapny' => $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, - 'invoicing_list' => $invoicing_list, - 'pkgpart' => $pkgpart, - 'username' => $username, - '_password' => $password, - 'popnum' => $popnum, + 'first' => $first, + 'last' => $last, + 'ss' => $ss, + 'comapny' => $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, + 'invoicing_list' => $invoicing_list, + 'referral_custnum' => $referral_custnum, + 'pkgpart' => $pkgpart, + 'username' => $username, + '_password' => $password, + 'popnum' => $popnum, } ); =head1 DESCRIPTION @@ -173,6 +174,7 @@ a paramater with the following keys: paydate payname invoicing_list + referral_custnum pkgpart username _password @@ -185,6 +187,10 @@ Returns a scalar error message, or the empty string for success. sub new_customer { my $hashref = shift; + #things that aren't necessary in base class, but are for signup server + return "Empty password" unless $hashref->{'_password'}; + return "No POP selected" unless $hashref->{'popnum'}; + socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; connect(SOCK, sockaddr_un($fs_signupd_socket)) or die "connect: $!"; print SOCK "new_customer\n"; @@ -192,7 +198,7 @@ sub new_customer { print SOCK join("\n", map { $hashref->{$_} } qw( first last ss company address1 address2 city county state zip country daytime night fax payby payinfo paydate payname invoicing_list - pkgpart username _password popnum + referral_custnum pkgpart username _password popnum ) ), "\n"; SOCK->flush; @@ -202,10 +208,6 @@ sub new_customer { =back -=head1 VERSION - -$Id: SignupClient.pm,v 1.3 2000-02-02 07:44:00 ivan Exp $ - =head1 BUGS =head1 SEE ALSO diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index a3fa9e788..5d024a812 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,12 +1,13 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.9 2000-12-03 14:29:15 ivan Exp $ +# $Id: signup.cgi,v 1.10 2001-08-28 16:58:08 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error $last $first $ss $company $address1 $address2 $city $state $county $country $zip $daytime $night $fax $invoicing_list $payby $payinfo - $paydate $payname $pkgpart $username $password $popnum + $paydate $payname $referral_custnum + $pkgpart $username $password $popnum $ieak_file $ieak_template $cck_file $cck_template $ac $exch $loc ); @@ -15,7 +16,7 @@ use subs qw( print_form print_okay expselect ); use CGI; use CGI::Carp qw(fatalsToBrowser); use HTTP::Headers::UserAgent 2.00; -use FS::SignupClient qw( signup_info new_customer ); +use FS::SignupClient 0.02 qw( signup_info new_customer ); use Text::Template; #acceptable payment methods @@ -75,29 +76,30 @@ if ( defined $cgi->param('magic') ) { } ( $error = new_customer ( { - 'last' => $last = $cgi->param('last'), - 'first' => $first = $cgi->param('first'), - 'ss' => $ss = $cgi->param('ss'), - 'company' => $company = $cgi->param('company'), - 'address1' => $address1 = $cgi->param('address1'), - 'address2' => $address2 = $cgi->param('address2'), - 'city' => $city = $cgi->param('city'), - 'county' => $county, - 'state' => $state, - 'zip' => $zip = $cgi->param('zip'), - 'country' => $country, - 'daytime' => $daytime = $cgi->param('daytime'), - 'night' => $night = $cgi->param('night'), - 'fax' => $fax = $cgi->param('fax'), - 'payby' => $payby, - 'payinfo' => $payinfo, - 'paydate' => $paydate, - 'payname' => $payname, - 'invoicing_list' => $invoicing_list, - 'pkgpart' => $pkgpart = $cgi->param('pkgpart'), - 'username' => $username = $cgi->param('username'), - '_password' => $password = $cgi->param('_password'), - 'popnum' => $popnum = $cgi->param('popnum'), + 'last' => $last = $cgi->param('last'), + 'first' => $first = $cgi->param('first'), + 'ss' => $ss = $cgi->param('ss'), + 'company' => $company = $cgi->param('company'), + 'address1' => $address1 = $cgi->param('address1'), + 'address2' => $address2 = $cgi->param('address2'), + 'city' => $city = $cgi->param('city'), + 'county' => $county, + 'state' => $state, + 'zip' => $zip = $cgi->param('zip'), + 'country' => $country, + 'daytime' => $daytime = $cgi->param('daytime'), + 'night' => $night = $cgi->param('night'), + 'fax' => $fax = $cgi->param('fax'), + 'payby' => $payby, + 'payinfo' => $payinfo, + 'paydate' => $paydate, + 'payname' => $payname, + 'invoicing_list' => $invoicing_list, + 'referral_custnum' => $referral_custnum = $cgi->param('ref'), + 'pkgpart' => $pkgpart = $cgi->param('pkgpart'), + 'username' => $username = $cgi->param('username'), + '_password' => $password = $cgi->param('_password'), + 'popnum' => $popnum = $cgi->param('popnum'), } ) ) ? print_form() : print_okay(); @@ -129,13 +131,14 @@ if ( defined $cgi->param('magic') ) { $username = ''; $password = ''; $popnum = ''; - + $referral_custnum = $cgi->param('ref') || ''; print_form; } sub print_form { my $r = qq!*!; + $cgi->delete('ref'); my $self_url = $cgi->self_url; print $cgi->header( '-expires' => 'now' ), < + Contact Information diff --git a/fs_signup/FS-SignupClient/fs_signupd b/fs_signup/FS-SignupClient/fs_signupd index f22ab15d4..8b3cdde53 100755 --- a/fs_signup/FS-SignupClient/fs_signupd +++ b/fs_signup/FS-SignupClient/fs_signupd @@ -116,16 +116,16 @@ for ( ; $paddr = accept(Client,Server); close Client) { 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() } ( 1 .. 23 ); + $paydate, $payname, $invoicing_list, $referral_custnum, + $pkgpart, $username, $password, $popnum, + ) = map { scalar() } ( 1 .. 24 ); warn "[fs_signupd] sending customer data to remote server...\n" if $Debug; print $first, $last, $ss, $company, $address1, $address2, $city, $county, $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo, - $paydate, $payname, $invoicing_list, $pkgpart, $username, $password, - $popnum, + $paydate, $payname, $invoicing_list, $referral_custnum, + $pkgpart, $username, $password, $popnum, ; warn "[fs_signupd] reading error from remote server...\n" if $Debug; diff --git a/fs_signup/fs_signup_server b/fs_signup/fs_signup_server index c6ee665fa..43683b01d 100755 --- a/fs_signup/fs_signup_server +++ b/fs_signup/fs_signup_server @@ -88,9 +88,9 @@ while (1) { 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 ) ); + $paydate, $payname, $invoicing_list, $referral_custnum, + $pkgpart, $username, $password, $popnum, + ) = map { scalar(<$reader>) } ( 1 .. 24 ) ); warn "[fs_signup_server] Processing signup...\n" if $Debug; @@ -99,27 +99,28 @@ while (1) { #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, + '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, + 'referral_custnum' => $referral_custnum, } ); $error = "Illegal payment type" unless grep { $_ eq $payby } @payby; diff --git a/httemplate/docs/signup.html b/httemplate/docs/signup.html index a40b1f963..ae5f63f15 100644 --- a/httemplate/docs/signup.html +++ b/httemplate/docs/signup.html @@ -18,6 +18,7 @@ Then:
  • Add the user `freeside' to the the external machine.
  • Copy or symlink fs_signup/FS-SignupClient/cgi/signup.cgi into the web server's document space. +
  • When linking to signup.cgi, you can include a referring custnum in the URL as follows: http://public.web.server/path/signup.cgi?ref=1542
  • Enable CGI execution for files with the `.cgi' extension. (with Apache)
  • Create the /usr/local/freeside directory on the external machine (owned by the freeside user).
  • touch /usr/local/freeside/fs_signupd_socket; chown freeside /usr/local/freeside/fs_signupd_socket; chmod 600 /usr/local/freeside/fs_signupd_socket diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index e2bb333d6..dfbe6a253 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -138,6 +138,7 @@ CREATE INDEX cust_main2 ON cust_main ( ship_company );
     ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
     
    +
  • If you are using the signup server, reinstall it according to the instructions. The 1.3.x signup server is not compatible with 1.4.x.
  • Run bin/dbdef-create.
  • create a service based on svc_forward
  • Run bin/fs-migrate-svc_acct_sm diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index d038896f6..5defaf4af 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -81,7 +81,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { END print '