the master control program has chosen YOU to serve your system on the game grid
[freeside.git] / FS / FS / cust_pkg_reason.pm
index 2f92740..92cd4a1 100644 (file)
@@ -98,6 +98,7 @@ sub check {
     $self->ut_numbern('num')
     || $self->ut_number('pkgnum')
     || $self->ut_number('reasonnum')
+    || $self->ut_enum('action', [ 'A', 'C', 'E', 'S' ])
     || $self->ut_text('otaker')
     || $self->ut_numbern('date')
   ;
@@ -106,6 +107,29 @@ sub check {
   $self->SUPER::check;
 }
 
+=item reason
+
+Returns the reason (see L<FS::reason>) associated with this cust_pkg_reason.
+
+=cut
+
+sub reason {
+  my $self = shift;
+  qsearchs( 'reason', { 'reasonnum' => $self->reasonnum } );
+}
+
+=item reasontext
+
+Returns the text of the reason (see L<FS::reason>) associated with this
+cust_pkg_reason.
+
+=cut
+
+sub reasontext {
+  my $reason = shift->reason;
+  $reason ? $reason->reason : '';
+}
+
 =back
 
 =head1 BUGS