diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-03-24 15:40:03 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-03-24 15:40:03 -0700 |
commit | ed4369640adc2e7c468ca384010729e8ec1f9074 (patch) | |
tree | a81c90876514a0b751a24c8c0d336cdfdc374595 /FS/FS/contact.pm | |
parent | 172673b3aef143dc426603689d37b65394c4fe1d (diff) |
enhance contacts: contact classes, RT#16819
Diffstat (limited to 'FS/FS/contact.pm')
-rw-r--r-- | FS/FS/contact.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index 0b50dcc..f84af42 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -5,6 +5,7 @@ use base qw( FS::Record ); use FS::Record qw( qsearch qsearchs dbh ); use FS::prospect_main; use FS::cust_main; +use FS::contact_class; use FS::cust_location; use FS::contact_phone; use FS::contact_email; @@ -322,8 +323,9 @@ sub check { my $error = $self->ut_numbern('contactnum') || $self->ut_foreign_keyn('prospectnum', 'prospect_main', 'prospectnum') - || $self->ut_foreign_keyn('custnum', 'cust_main', 'custnum') + || $self->ut_foreign_keyn('custnum', 'cust_main', 'custnum') || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum') + || $self->ut_foreign_keyn('classnum', 'contact_class', 'classnum') || $self->ut_textn('last') || $self->ut_textn('first') || $self->ut_textn('title') @@ -357,6 +359,18 @@ sub cust_location { qsearchs('cust_location', { 'locationnum' => $self->locationnum } ); } +sub contact_class { + my $self = shift; + return '' unless $self->classnum; + qsearchs('contact_class', { 'classnum' => $self->classnum } ); +} + +sub contact_classname { + my $self = shift; + my $contact_class = $self->contact_class or return ''; + $contact_class->classname; +} + sub contact_phone { my $self = shift; qsearch('contact_phone', { 'contactnum' => $self->contactnum } ); |