X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fprospect_main.pm;h=5a4048f51c16073fb13c2ff379333d0bbe4445b9;hb=573139dbd6c37808697bfa72a3a468bb0980d4dd;hp=bace1f040d7140e35225c5190673288b42329b1f;hpb=fced2ed0147049fded427862a3517c172f86513e;p=freeside.git diff --git a/FS/FS/prospect_main.pm b/FS/FS/prospect_main.pm index bace1f040..5a4048f51 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,13 +204,27 @@ 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; $self->SUPER::check; } +=item name + +=cut + +sub name { + my $self = shift; + 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 Returns the contacts (see L) associated with this prospect. @@ -232,6 +247,18 @@ sub cust_location { qsearch( 'cust_location', { 'prospectnum' => $self->prospectnum } ); } +=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)