X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=bfe4a2d4f50bc04a1081b5dc7ee8053041cf33a9;hb=85be0d954dbe4a2c86841a37dc6a4df690dd5142;hp=2b7d8d0dcb3a16c3cf067b2876722872b91d726c;hpb=0ebeec96313dd7edfca340f01f8fbbbac1f4aa1d;p=freeside.git diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 2b7d8d0dc..bfe4a2d4f 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -39,6 +39,12 @@ if ( $cgi->param('error') ) { $query =~ /^(\d+)$/; $custnum=$1; $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); + if ( $cust_main->dbdef_table->column('paycvv') + && length($cust_main->paycvv) ) { + my $paycvv = $cust_main->paycvv; + $paycvv =~ s/./*/g; + $cust_main->paycvv($paycvv); + } $saved_pkgpart = 0; $username = ''; $password = ''; @@ -61,7 +67,7 @@ my $action = $custnum ? 'Edit' : 'Add'; # top my $p1 = popurl(1); -print header("Customer $action", ''); +print header("Customer $action", '', ' onUnload="myclose()"'); print qq!Error: !, $error, "" if $error; @@ -75,9 +81,11 @@ print qq!
!, my $r = qq!* !; -my @agents = qsearch( 'agent', {} ); +my %agent_search = dbdef->table('agent')->column('disabled') + ? ( 'disabled' => '' ) : (); +my @agents = qsearch( 'agent', \%agent_search ); #die "No agents created!" unless @agents; -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; +eidiot "You have not created any agents (or all agents are disabled). 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!!; @@ -183,8 +191,10 @@ END my $countrydefault = $conf->config('countrydefault') || 'US'; $cust_main->country( $countrydefault ) unless $cust_main->country; -$cust_main->state( $conf->config('statedefault') || 'CA' ) - unless $cust_main->state || $cust_main->country ne 'US'; +my $statedefault = $conf->config('statedefault') + || ($countrydefault eq 'US' ? 'CA' : ''); +$cust_main->state( $statedefault ) + unless $cust_main->state || $cust_main->country ne $countrydefault; my($county_html, $state_html, $country_html) = FS::cust_main_county::regionselector( $cust_main->county, @@ -335,7 +345,9 @@ sub expselect { $return .= ">$_"; } $return .= qq!/!; print "Billing type", - "", + "", '', &table("#cccccc"), ""; my($payinfo, $payname)=( @@ -416,6 +440,12 @@ if ( $payby_default eq 'HIDE' ) { 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP"), ); + if ( $cust_main->dbdef_table->column('paycvv') ) { + foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 bs + $payby{$payby} .= qq!
CVV2 (help!; + } + } + my( $account, $aba ) = split('@', $payinfo); my %paybychecked = ( @@ -428,6 +458,15 @@ if ( $payby_default eq 'HIDE' ) { 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP", $cust_main->paydate), ); + if ( $cust_main->dbdef_table->column('paycvv') ) { + my $paycvv = $cust_main->paycvv; + + foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 bs + $paybychecked{$payby} .= qq!
CVV2 (help!; + } + } + + $cust_main->payby($payby_default) unless $cust_main->payby; for (qw(CARD DCRD CHEK DCHK LECB BILL COMP)) { print qq!pkgpart }, '"'; - $part_pkg->pkgpart. "_". $part_pkg->svcpart, '"'; + $part_pkg->pkgpart. "_". $part_pkg->svcpart('svc_acct'), '"'; print " SELECTED" if $saved_pkgpart && ( $part_pkg->pkgpart == $saved_pkgpart ); print ">", $part_pkg->pkg, " - ", $part_pkg->comment; }