X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=2911fc1e7095ba1086d120695af2598eaaaf4b65;hb=2b49cbe76b94c6c1561aa2bf37beba7d47591190;hp=33e72d864b879babb8bcf25ffc5bcec9b362f7c6;hpb=f38abb144955686f880a528ed6fe4c9c5453517b;p=freeside.git diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 33e72d864..2911fc1e7 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,4 +1,3 @@ - <% #for misplaced logic below @@ -17,6 +16,8 @@ my $conf = new FS::Conf; my $error = ''; my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart); +my(@invoicing_list); +my $same = ''; if ( $cgi->param('error') ) { $error = $cgi->param('error'); $cust_main = new FS::cust_main ( { @@ -32,15 +33,24 @@ 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') ); + $same = $cgi->param('same'); } elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $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 = ''; $popnum = 0; + @invoicing_list = $cust_main->invoicing_list; } else { $custnum=''; $cust_main = new FS::cust_main ( {} ); @@ -50,46 +60,53 @@ if ( $cgi->param('error') ) { $username = ''; $password = ''; $popnum = 0; + @invoicing_list = (); } $cgi->delete_all(); my $action = $custnum ? 'Edit' : 'Add'; -# top +%> + + -my $p1 = popurl(1); -print header("Customer $action", ''); -print qq!Error: !, $error, "" - if $error; +<%= header("Customer $action", '', ' onUnload="myclose()"') %> -print qq!
!, - qq!!, - qq!Customer # !, ( $custnum ? "$custnum" : " (NEW)" ), - -; +<% if ( $error ) { %> +Error: <%= $error %> +<% } %> -# agent + + +Customer # <%= $custnum ? "$custnum" : " (NEW)" %> + + + +<% 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; -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; +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!!; -} else { - print qq!

${r}Agent "; -} + +%> + +<% if ( scalar(@agents) == 1 ) { %> + +<% } else { %> +

<%=$r%>Agent +<% } %> + +<% + +# (referral and referring customer still need to be "template"ized) #referral @@ -98,11 +115,13 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { print qq!!; } else { my(@referrals) = qsearch('part_referral',{}); - if ( scalar(@referrals) == 1 ) { + if ( scalar(@referrals) == 0 ) { + eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources."; + } elsif ( scalar(@referrals) == 1 ) { $refnum ||= $referrals[0]->refnum; print qq!!; } else { - print qq!

${r}Referral !; print "