1 package FS::log_context;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
19 FS::log_context - Object methods for log_context records
25 $record = new FS::log_context \%hash;
26 $record = new FS::log_context { 'column' => 'value' };
28 $error = $record->insert;
30 $error = $new_record->replace($old_record);
32 $error = $record->delete;
34 $error = $record->check;
38 An FS::log_context object represents a context tag attached to a log entry
39 (L<FS::log>). FS::log_context inherits from FS::Record. The following
40 fields are currently supported:
44 =item logcontextnum - primary key
46 =item lognum - lognum (L<FS::log> foreign key)
48 =item context - context
58 Creates a new context tag. To add the example to the database, see
61 Note that this stores the hash reference, not a distinct copy of the hash it
62 points to. You can ask the object for a copy with the I<hash> method.
66 # the new method can be inherited from FS::Record, if a table method is defined
68 sub table { 'log_context'; }
72 Adds this record to the database. If there is an error, returns the error,
73 otherwise returns false.
77 # the insert method can be inherited from FS::Record
81 Delete this record from the database.
85 # the delete method can be inherited from FS::Record
87 =item replace OLD_RECORD
89 Replaces the OLD_RECORD with this one in the database. If there is an error,
90 returns the error, otherwise returns false.
94 # the replace method can be inherited from FS::Record
98 Checks all fields to make sure this is a valid example. If there is
99 an error, returns the error, otherwise returns false. Called by the insert
104 # the check method should currently be supplied - FS::Record contains some
105 # data checking routines
111 $self->ut_numbern('logcontextnum')
112 || $self->ut_number('lognum')
113 || $self->ut_enum('context', \@contexts)
115 return $error if $error;
128 Returns a list of all valid contexts.
132 sub contexts { @contexts }
140 L<FS::Log>, L<FS::Record>, schema.html from the base documentation.