1 package FS::log_context;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
7 # Items in @default_contexts will always be included in the
8 # output of contexts() method
9 my @default_contexts = ( qw(
11 FS::cust_main::Billing::bill_and_collect
12 FS::cust_main::Billing::bill
13 FS::cust_main::Billing_Realtime::realtime_verify_bop
15 FS::Misc::Geo::standardize_uscensus
16 FS::saved_search::send
17 FS::saved_search::render
18 FS::cust_location::process_district_update
25 upgrade_taxable_billpkgnum
26 freeside-ipifony-download
27 freeside-paymentech-upload
28 freeside-paymentech-download
30 FS::TaxEngine::billsoft
38 FS::log_context - Object methods for log_context records
44 $record = new FS::log_context \%hash;
45 $record = new FS::log_context { 'column' => 'value' };
47 $error = $record->insert;
49 $error = $new_record->replace($old_record);
51 $error = $record->delete;
53 $error = $record->check;
57 An FS::log_context object represents a context tag attached to a log entry
58 (L<FS::log>). FS::log_context inherits from FS::Record. The following
59 fields are currently supported:
63 =item logcontextnum - primary key
65 =item lognum - lognum (L<FS::log> foreign key)
67 =item context - context
77 Creates a new context tag. To add the example to the database, see
80 Note that this stores the hash reference, not a distinct copy of the hash it
81 points to. You can ask the object for a copy with the I<hash> method.
85 sub table { 'log_context'; }
89 Adds this record to the database. If there is an error, returns the error,
90 otherwise returns false.
94 Delete this record from the database.
96 =item replace OLD_RECORD
98 Replaces the OLD_RECORD with this one in the database. If there is an error,
99 returns the error, otherwise returns false.
103 Checks all fields to make sure this is a valid example. If there is
104 an error, returns the error, otherwise returns false. Called by the insert
113 $self->ut_numbern('logcontextnum')
114 || $self->ut_number('lognum')
115 || $self->ut_text('context') #|| $self->ut_enum('context', \@contexts)
117 return $error if $error;
130 Returns a list of all log contexts, by combining @default_contexts
131 with all context values seen in the log_context table
138 my %contexts = map { $_ => 1 } @default_contexts;
140 $contexts{ $_->context } = 1
142 select => 'DISTINCT context AS context',
143 table => 'log_context',
147 sort { lc $a cmp lc $b } keys %contexts;
156 L<FS::Log>, L<FS::Record>, schema.html from the base documentation.