X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fcust_main.cgi;h=41643a37f78c5b4c4d262d89ea341815d93fff3d;hb=a4c96748eb6eab29a70f3a944c6520283a635c78;hp=f5662fd8768ba1d5c8ed9051263401e5bf52a08e;hpb=91387f8f489e561deaf1de052d80ef800a4970a3;p=freeside.git diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index f5662fd87..41643a37f 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,12 +52,12 @@ if ( $cgi->param('error') ) { $popnum = 0; } $cgi->delete_all(); -$action = $custnum ? 'Edit' : 'Add'; +my $action = $custnum ? 'Edit' : 'Add'; # top -$p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Customer $action", ''); +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 { @@ -133,24 +116,26 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { #referring customer -print qq!

Referring Customer: !; +#print qq!

Referring Customer: !; if ( $cust_main->referral_custnum ) { my $referring_cust_main = qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ); - print 'referral_custnum. '">'. $cust_main->referral_custnum. ': '. ( $referring_cust_main->company || $referring_cust_main->last. ', '. $referring_cust_main->first ). ''; +} elsif ( ! $conf->exists('disable_customer_referrals') ) { + print '

Referring customer number: '; } else { - print '(none)'; + print ''; } # 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, @@ -168,21 +153,33 @@ END print < , + END +if ( $conf->exists('show_ss') ) { + print qq!SS#!; +} else { + print qq!!; +} + print <SS# + Company ${r}Address   ${r}City${r}State/Country${r}Zip!; -($daytime,$night,$fax)=( +my($daytime,$night,$fax)=( $cust_main->daytime, $cust_main->night, $cust_main->fax, @@ -338,30 +335,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 || grep { $_ eq 'POST' } @invoicing_list; + 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)) { @@ -404,7 +402,7 @@ unless ( $custnum ) { #eslaf my @part_pkg = grep { $_->svcpart('svc_acct') && $pkgpart->{ $_->pkgpart } } - qsearch( 'part_pkg', {} ); + qsearch( 'part_pkg', { 'disabled' => '' } ); if ( @part_pkg ) { @@ -426,13 +424,15 @@ 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 <Username Password - + (blank to generate) END @@ -444,7 +444,7 @@ END } } -$otaker = $cust_main->otaker; +my $otaker = $cust_main->otaker; print qq!!, qq!
!,