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;
+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;
my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first
if ( scalar(@agents) == 1 ) {
print qq!<INPUT TYPE="hidden" NAME="agentnum" VALUE="$agentnum">!;
print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
} 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!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
} else {
- print qq!<BR><BR>${r}Referral <SELECT NAME="refnum" SIZE="1">!;
+ print qq!<BR><BR>${r}Advertising source <SELECT NAME="refnum" SIZE="1">!;
print "<OPTION> " unless $refnum;
my($referral);
foreach $referral (sort {
print '<BR>Service address ',
'(<INPUT TYPE="checkbox" NAME="same" VALUE="Y" onClick="samechanged(this)"';
- unless ( $cust_main->ship_last ) {
+ unless ( $cust_main->ship_last && $cgi->param('same') ne 'Y' ) {
print ' CHECKED';
foreach (
qw( last first company address1 address2 city county state zip country