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_bop
14 FS::cust_main::Billing_Realtime::realtime_tokenize
15 FS::cust_main::Billing_Realtime::realtime_verify_bop
16 FS::cust_main::Billing_Realtime::token_check
17 FS::pay_batch::import_from_gateway
19 FS::Misc::Geo::standardize_uscensus
20 FS::saved_search::send
21 FS::saved_search::render
22 FS::cust_location::process_district_update
30 upgrade_taxable_billpkgnum
31 freeside-ipifony-download
32 freeside-paymentech-upload
33 freeside-paymentech-download
35 FS::TaxEngine::billsoft
43 FS::log_context - Object methods for log_context records
49 $record = new FS::log_context \%hash;
50 $record = new FS::log_context { 'column' => 'value' };
52 $error = $record->insert;
54 $error = $new_record->replace($old_record);
56 $error = $record->delete;
58 $error = $record->check;
62 An FS::log_context object represents a context tag attached to a log entry
63 (L<FS::log>). FS::log_context inherits from FS::Record. The following
64 fields are currently supported:
68 =item logcontextnum - primary key
70 =item lognum - lognum (L<FS::log> foreign key)
72 =item context - context
82 Creates a new context tag. To add the example to the database, see
85 Note that this stores the hash reference, not a distinct copy of the hash it
86 points to. You can ask the object for a copy with the I<hash> method.
90 sub table { 'log_context'; }
94 Adds this record to the database. If there is an error, returns the error,
95 otherwise returns false.
99 Delete this record from the database.
101 =item replace OLD_RECORD
103 Replaces the OLD_RECORD with this one in the database. If there is an error,
104 returns the error, otherwise returns false.
108 Checks all fields to make sure this is a valid example. If there is
109 an error, returns the error, otherwise returns false. Called by the insert
118 $self->ut_numbern('logcontextnum')
119 || $self->ut_number('lognum')
120 || $self->ut_text('context') #|| $self->ut_enum('context', \@contexts)
122 return $error if $error;
135 Returns a list of all log contexts, by combining @default_contexts
136 with all context values seen in the log_context table
143 my %contexts = map { $_ => 1 } @default_contexts;
145 $contexts{ $_->context } = 1
147 select => 'DISTINCT context AS context',
148 table => 'log_context',
152 sort { lc $a cmp lc $b } keys %contexts;
161 L<FS::Log>, L<FS::Record>, schema.html from the base documentation.