summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main_note.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/cust_main_note.pm')
-rw-r--r--FS/FS/cust_main_note.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/FS/FS/cust_main_note.pm b/FS/FS/cust_main_note.pm
index 0a203a8..06da096 100644
--- a/FS/FS/cust_main_note.pm
+++ b/FS/FS/cust_main_note.pm
@@ -4,6 +4,7 @@ use strict;
use base qw( FS::otaker_Mixin FS::Record );
use Carp;
use FS::Record qw( qsearch qsearchs );
+use FS::cust_note_class;
=head1 NAME
@@ -38,6 +39,8 @@ primary key
=item custnum
+=item classnum
+
=item _date
=item usernum
@@ -106,6 +109,7 @@ sub check {
my $error =
$self->ut_numbern('notenum')
|| $self->ut_number('custnum')
+ || $self->ut_foreign_keyn('classnum', 'cust_note_class', 'classnum')
|| $self->ut_numbern('_date')
|| $self->ut_textn('otaker')
|| $self->ut_anything('comments')
@@ -115,6 +119,36 @@ sub check {
$self->SUPER::check;
}
+=item cust_note_class
+
+Returns the customer note class, as an FS::cust_note_class object, or the empty
+string if there is no note class.
+
+=cut
+
+sub cust_note_class {
+ my $self = shift;
+ if ( $self->classnum ) {
+ qsearchs('cust_note_class', { 'classnum' => $self->classnum } );
+ } else {
+ return '';
+ }
+}
+
+=item classname
+
+Returns the customer note class name, or the empty string if there is no
+customer note class.
+
+=cut
+
+sub classname {
+ my $self = shift;
+ my $cust_note_class = $self->cust_note_class;
+ $cust_note_class ? $cust_note_class->classname : '';
+}
+
+
#false laziness w/otaker_Mixin & cust_attachment
sub otaker {
my $self = shift;