X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fprospect_main.pm;h=6adc852f854e7a2ea3ce9ff2f816309defe971fd;hb=22a1feb55c4bb705064a04646ff5c321b8112ce1;hp=78e865a7ebe5bbb81afe54bb12b609f7d6474712;hpb=d20a6ac966a4236ed9115dd611739305e5879204;p=freeside.git diff --git a/FS/FS/prospect_main.pm b/FS/FS/prospect_main.pm index 78e865a7e..6adc852f8 100644 --- a/FS/FS/prospect_main.pm +++ b/FS/FS/prospect_main.pm @@ -8,6 +8,7 @@ use FS::Record qw( dbh qsearch ); #qsearchs ); use FS::agent; use FS::cust_location; use FS::contact; +use FS::qual; $DEBUG = 0; @@ -203,7 +204,7 @@ sub check { my $error = $self->ut_numbern('prospectnum') || $self->ut_foreign_key('agentnum', 'agent', 'agentnum' ) - || $self->ut_text('company') + || $self->ut_textn('company') ; return $error if $error; @@ -216,7 +217,12 @@ sub check { sub name { my $self = shift; - $self->company; #at least until this is nullable + return $self->company if $self->company; + + my $contact = ($self->contact)[0]; #first contact? good enough for now + return $contact->line if $contact; + + 'Prospect #'. $self->prospectnum; } =item contact @@ -238,9 +244,22 @@ Returns the locations (see L) associated with this prospect. sub cust_location { my $self = shift; - qsearch( 'cust_location', { 'prospectnum' => $self->prospectnum } ); + qsearch( 'cust_location', { 'prospectnum' => $self->prospectnum, + 'custnum' => '' } ); +} + +=item qual + +Returns the qualifications (see L) associated with this prospect. + +=cut + +sub qual { + my $self = shift; + qsearch( 'qual', { 'prospectnum' => $self->prospectnum } ); } + =item search HASHREF (Class method)