residential prospects, RT#7111
[freeside.git] / FS / FS / prospect_main.pm
index bace1f0..079ad25 100644 (file)
@@ -203,13 +203,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;
+
+  $self->prospectnum;
+}
+
 =item contact
 
 Returns the contacts (see L<FS::contact>) associated with this prospect.