X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=6fc086a1223585d3081a77dd7960fbbed5865205;hp=f331e5321eb7a624e92a439e030f38eb40c4d156;hb=7a168617da5f6702422c098d714a11586d7655e9;hpb=77def6c1c51fc6f7273b7c23221f13850d6be1dd diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index f331e5321..6fc086a12 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,39 +1,22 @@ + <% -# - -use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum - $last $first $ss $company $address1 $address2 $city $zip - $daytime $night $fax @invoicing_list $invoicing_list $payinfo - $payname %payby %paybychecked $refnum $otaker $r ); -use vars qw ( $conf $saved_pkgpart $username $password $popnum $ulen $ulen2 ); -use vars qw ( $error ); -#use CGI::Switch; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -#use FS::Record qw(qsearch qsearchs fields); -use FS::Record qw(qsearch qsearchs fields dbdef); -use FS::CGI qw(header popurl itable table); -use FS::cust_main; -use FS::agent; -use FS::part_referral; -use FS::cust_main_county; #for misplaced logic below - use FS::part_pkg; + #use FS::part_pkg; - #for false laziness below - use FS::svc_acct_pop; + #for false laziness below (now more properly lazy) + #use FS::svc_acct_pop; #for (other) false laziness below - use FS::agent; - use FS::type_pkgs; + #use FS::agent; + #use FS::type_pkgs; -$conf = new FS::Conf; +my $conf = new FS::Conf; #get record -$error = ''; +my $error = ''; +my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart); if ( $cgi->param('error') ) { $error = $cgi->param('error'); $cust_main = new FS::cust_main ( { @@ -61,36 +44,37 @@ if ( $cgi->param('error') ) { } else { $custnum=''; $cust_main = new FS::cust_main ( {} ); - $cust_main->setfield('otaker',&getotaker); + $cust_main->otaker( &getotaker ); + $cust_main->referral_custnum( $cgi->param('referral_custnum') ); $saved_pkgpart = 0; $username = ''; $password = ''; $popnum = 0; } $cgi->delete_all(); -$action = $custnum ? 'Edit' : 'Add'; +my $action = $custnum ? 'Edit' : 'Add'; # top -$p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''); +my $p1 = popurl(1); +print header("Customer $action", ''); print qq!Error: !, $error, "" if $error; print qq!
!, qq!!, - qq!Customer # !, ( $custnum ? $custnum : " (NEW)" ), + qq!Customer # !, ( $custnum ? "$custnum" : " (NEW)" ), ; # agent -$r = qq!*!; +my $r = qq!* !; -@agents = qsearch( 'agent', {} ); +my @agents = qsearch( 'agent', {} ); #die "No agents created!" unless @agents; -die "You have not created any agents. You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; -$agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first +eidiot "You have not created any agents. You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; +my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first if ( scalar(@agents) == 1 ) { print qq!!; } else { @@ -101,23 +85,26 @@ if ( scalar(@agents) == 1 ) { } @agents) { print '