X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=fad4d9e6d1254b6cb2ee1b5cfc8777dc7df0d1ef;hp=9588dcb3aa53fe12da8a867b45ebfc6f5843b609;hb=1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39;hpb=cf16b23820da69e3c8d0156ae27e21c635bf1ec5 diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 9588dcb3a..fad4d9e6d 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 (now more properly lazy) - use FS::svc_acct_pop; + #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 ( { @@ -69,11 +52,11 @@ if ( $cgi->param('error') ) { $popnum = 0; } $cgi->delete_all(); -$action = $custnum ? 'Edit' : 'Add'; +my $action = $custnum ? 'Edit' : 'Add'; # top -$p1 = popurl(1); +my $p1 = popurl(1); print header("Customer $action", ''); print qq!Error: !, $error, "" if $error; @@ -86,12 +69,12 @@ print qq!
!, # 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 +my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first if ( scalar(@agents) == 1 ) { print qq!!; } else { @@ -109,7 +92,7 @@ if ( scalar(@agents) == 1 ) { #referral -$refnum = $cust_main->refnum || $conf->config('referraldefault') || 0; +my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0; if ( $custnum && ! $conf->exists('editreferrals') ) { print qq!!; } else { @@ -152,7 +135,7 @@ if ( $cust_main->referral_custnum ) { # contact info -($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( +my($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( $cust_main->last, $cust_main->first, $cust_main->ss, @@ -201,7 +184,7 @@ foreach ( sort { } print qq!${r}Zip!; -($daytime,$night,$fax)=( +my($daytime,$night,$fax)=( $cust_main->daytime, $cust_main->night, $cust_main->fax, @@ -345,31 +328,31 @@ print "
Billing information", &itable("#cccccc"), print qq! CHECKED! if $cust_main->tax eq "Y"; print qq!>Tax Exempt!; print qq!invoicing_list; +my @invoicing_list = $cust_main->invoicing_list; print qq! CHECKED! if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) || grep { $_ eq 'POST' } @invoicing_list; print qq!>Postal mail invoice!; -$invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); +my $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); print qq!Email invoice !; print "Billing type", "", &table("#cccccc"), ""; -($payinfo, $payname)=( +my($payinfo, $payname)=( $cust_main->payinfo, $cust_main->payname, ); -%payby = ( +my %payby = ( 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD"). qq!
${r}Name on card
!, - 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", "12-2037"). qq!
${r}Attention
!, + 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", "12-2037"). qq!
Attention
!, 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP"), ); -%paybychecked = ( +my %paybychecked = ( 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
${r}Name on card
!, - 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
${r}Attention
!, + 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
Attention
!, 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP", $cust_main->paydate), ); for (qw(CARD BILL COMP)) { @@ -434,8 +417,8 @@ unless ( $custnum ) { #false laziness: (mostly) copied from edit/svc_acct.cgi #$ulen = $svc_acct->dbdef_table->column('username')->length; - $ulen = dbdef->table('svc_acct')->column('username')->length; - $ulen2 = $ulen+2; + my $ulen = dbdef->table('svc_acct')->column('username')->length; + my $ulen2 = $ulen+2; my $passwordmax = $conf->config('passwordmax') || 8; my $pmax2 = $passwordmax + 2; print <otaker; +my $otaker = $cust_main->otaker; print qq!!, qq!
!,