X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=73a0eef4907496540ffae078e6eba9c2f918c117;hp=38d8d2b7e3c29185304cbac7564104f87636d65c;hb=b59a412755582d30b4f7be2147b6ad32037e6f59;hpb=f5571d9d6c79d04e65f8da92be923c3f3ae5c54a diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 38d8d2b7e..73a0eef49 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -17,6 +17,7 @@ my $conf = new FS::Conf; my $error = ''; my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart); +my(@invoicing_list); if ( $cgi->param('error') ) { $error = $cgi->param('error'); $cust_main = new FS::cust_main ( { @@ -32,6 +33,7 @@ if ( $cgi->param('error') ) { $username = $cgi->param('username'); $password = $cgi->param('_password'); $popnum = $cgi->param('popnum'); + @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') ); } elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -41,6 +43,7 @@ if ( $cgi->param('error') ) { $username = ''; $password = ''; $popnum = 0; + @invoicing_list = $cust_main->invoicing_list; } else { $custnum=''; $cust_main = new FS::cust_main ( {} ); @@ -50,6 +53,7 @@ if ( $cgi->param('error') ) { $username = ''; $password = ''; $popnum = 0; + @invoicing_list = (); } $cgi->delete_all(); my $action = $custnum ? 'Edit' : 'Add'; @@ -71,9 +75,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!!; @@ -120,9 +126,11 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { #referring customer #print qq!

Referring Customer: !; -if ( $cust_main->referral_custnum ) { - my $referring_cust_main = - qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ); +my $referring_cust_main = ''; +if ( $cust_main->referral_custnum + and $referring_cust_main = + qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) +) { print '

Referring Customer: '. $cust_main->referral_custnum. ': '. @@ -195,10 +203,13 @@ my($daytime,$night,$fax)=( $cust_main->fax, ); +my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; +my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; + print <${r}Country$country_html -Day Phone -Night Phone +$daytime_label +$night_label Fax END @@ -294,8 +305,8 @@ END print <${r}Country$ship_country_html - Day Phone - Night Phone + $daytime_label + $night_label Fax END @@ -350,7 +361,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!'; - foreach my $payby (qw( CARD BILL COMP )) { + foreach my $payby (qw( CARD DCRD CHEK DCHK LECB BILL COMP )) { foreach my $field (qw( payinfo payname )) { print qq!'; @@ -367,8 +378,8 @@ if ( $payby_default eq 'HIDE' ) { die "unrecognized expiration date format: $date"; } - print qq!!. + qq!!; } @@ -380,7 +391,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!>Tax Exempt!. qq!invoicing_list; + #my @invoicing_list = $cust_main->invoicing_list; print qq! CHECKED! if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) || grep { $_ eq 'POST' } @invoicing_list; @@ -398,19 +409,29 @@ if ( $payby_default eq 'HIDE' ) { ); 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!
Attention
!, + 'CARD' => qq!Credit card (automatic)
${r}
${r}Exp !. expselect("CARD"). qq!
${r}Name on card
!, + 'DCRD' => qq!Credit card (on-demand)
${r}
${r}Exp !. expselect("DCRD"). qq!
${r}Name on card
!, + 'CHEK' => qq!Electronic check (automatic)
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'DCHK' => qq!Electronic check (on-demand)
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'LECB' => qq!Phone bill billing
${r}Phone number !, + 'BILL' => qq!Billing
P.O.
Attention
!, 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP"), ); + my( $account, $aba ) = split('@', $payinfo); + 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!
Attention
!, + 'CARD' => qq!Credit card (automatic)
${r}
${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
${r}Name on card
!, + 'DCRD' => qq!Credit card (on-demand)
${r}
${r}Exp !. expselect("DCRD", $cust_main->paydate). qq!
${r}Name on card
!, + 'CHEK' => qq!Electronic check (automatic)
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'DCHK' => qq!Electronic check (on-demand)
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'LECB' => qq!Phone bill billing
${r}Phone number !, + 'BILL' => qq!Billing
P.O.
Attention
!, 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP", $cust_main->paydate), ); $cust_main->payby($payby_default) unless $cust_main->payby; - for (qw(CARD BILL COMP)) { + for (qw(CARD DCRD CHEK DCHK LECB BILL COMP)) { print qq!payby eq "$_") { print qq! CHECKED> $paybychecked{$_}!; @@ -466,7 +487,7 @@ unless ( $custnum ) { foreach my $part_pkg ( @part_pkg ) { print qq!