communigate (phase 2): rules. RT#7514
[freeside.git] / FS / FS / cgp_rule_condition.pm
index a8b7e56..f91b3e6 100644 (file)
@@ -3,6 +3,7 @@ package FS::cgp_rule_condition;
 use strict;
 use base qw( FS::Record );
 use FS::Record qw( qsearch qsearchs );
 use strict;
 use base qw( FS::Record );
 use FS::Record qw( qsearch qsearchs );
+use FS::cgp_rule;
 
 =head1 NAME
 
 
 =head1 NAME
 
@@ -25,8 +26,9 @@ FS::cgp_rule_condition - Object methods for cgp_rule_condition records
 
 =head1 DESCRIPTION
 
 
 =head1 DESCRIPTION
 
-An FS::cgp_rule_condition object represents an example.  FS::cgp_rule_condition inherits from
-FS::Record.  The following fields are currently supported:
+An FS::cgp_rule_condition object represents a mail filtering condition.
+FS::cgp_rule_condition inherits from FS::Record.  The following fields are
+currently supported:
 
 =over 4
 
 
 =over 4
 
@@ -59,7 +61,7 @@ rulenum
 
 =item new HASHREF
 
 
 =item new HASHREF
 
-Creates a new example.  To add the example to the database, see L<"insert">.
+Creates a new condition.  To add the condition to the database, see L<"insert">.
 
 Note that this stores the hash reference, not a distinct copy of the hash it
 points to.  You can ask the object for a copy with the I<hash> method.
 
 Note that this stores the hash reference, not a distinct copy of the hash it
 points to.  You can ask the object for a copy with the I<hash> method.
@@ -98,7 +100,7 @@ returns the error, otherwise returns false.
 
 =item check
 
 
 =item check
 
-Checks all fields to make sure this is a valid example.  If there is
+Checks all fields to make sure this is a valid condition.  If there is
 an error, returns the error, otherwise returns false.  Called by the insert
 and replace methods.
 
 an error, returns the error, otherwise returns false.  Called by the insert
 and replace methods.
 
@@ -115,7 +117,7 @@ sub check {
     || $self->ut_text('condition')
     || $self->ut_text('op')
     || $self->ut_text('params')
     || $self->ut_text('condition')
     || $self->ut_text('op')
     || $self->ut_text('params')
-    || $self->ut_number('rulenum')
+    || $self->ut_foreign_key('rulenum', 'cgp_rule', 'rulenum')
   ;
   return $error if $error;
 
   ;
   return $error if $error;
 
@@ -126,8 +128,6 @@ sub check {
 
 =head1 BUGS
 
 
 =head1 BUGS
 
-The author forgot to customize this manpage.
-
 =head1 SEE ALSO
 
 L<FS::Record>, schema.html from the base documentation.
 =head1 SEE ALSO
 
 L<FS::Record>, schema.html from the base documentation.