4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs dbdef );
6 use FS::UID qw( dbh driver_name );
10 FS::log_email - Object methods for log email records
16 $record = new FS::log_email \%hash;
17 $record = new FS::log_email { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
29 An FS::log object represents the conditions for sending an email
30 when a log entry is created. FS::log inherits from FS::Record.
31 The following fields are currently supported:
35 =item logemailnum - primary key
37 =item context - the context that will trigger the email (all contexts if unspecified)
39 =item min_level - the minimum log level that will trigger the email (all levels if unspecified)
41 =item msgnum - the msg_template that will be used to send the email
43 =item to_addr - who the email will be sent to (in addition to any bcc on the template)
45 =item context_height - number of context stack levels to match against
46 (0 or null matches against full stack, 1 only matches lowest level context, 2 matches lowest two levels, etc.)
56 Creates a new log_email entry.
60 sub table { 'log_email'; }
64 Adds this record to the database. If there is an error, returns the error,
65 otherwise returns false.
69 Delete this record from the database.
71 =item replace OLD_RECORD
73 Replaces the OLD_RECORD with this one in the database. If there is an error,
74 returns the error, otherwise returns false.
78 Checks all fields to make sure this is a valid record. If there is
79 an error, returns the error, otherwise returns false. Called by the insert
88 $self->ut_numbern('logemailnum')
89 || $self->ut_textn('context') # not validating against list of contexts in log_context,
90 # because not even log_context check currently does so
91 || $self->ut_number('min_level')
92 || $self->ut_foreign_key('msgnum', 'msg_template', 'msgnum')
93 || $self->ut_textn('to_addr')
94 || $self->ut_numbern('context_height')
96 return $error if $error;
107 L<FS::Record>, schema.html from the base documentation.