RT#38722: DFH: paymentech upload and download retry
[freeside.git] / FS / FS / log_context.pm
1 package FS::log_context;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6
7 my @contexts = ( qw(
8   test
9   bill_and_collect
10   FS::cust_main::Billing::bill_and_collect
11   FS::cust_main::Billing::bill
12   FS::pay_batch::import_from_gateway
13   Cron::bill
14   Cron::backup
15   Cron::upload
16   spool_upload
17   daily
18   queue
19   upgrade
20   upgrade_taxable_billpkgnum
21   freeside-paymentech-upload
22   freeside-paymentech-download
23 ) );
24
25 =head1 NAME
26
27 FS::log_context - Object methods for log_context records
28
29 =head1 SYNOPSIS
30
31   use FS::log_context;
32
33   $record = new FS::log_context \%hash;
34   $record = new FS::log_context { 'column' => 'value' };
35
36   $error = $record->insert;
37
38   $error = $new_record->replace($old_record);
39
40   $error = $record->delete;
41
42   $error = $record->check;
43
44 =head1 DESCRIPTION
45
46 An FS::log_context object represents a context tag attached to a log entry
47 (L<FS::log>).  FS::log_context inherits from FS::Record.  The following 
48 fields are currently supported:
49
50 =over 4
51
52 =item logcontextnum - primary key
53
54 =item lognum - lognum (L<FS::log> foreign key)
55
56 =item context - context
57
58 =back
59
60 =head1 METHODS
61
62 =over 4
63
64 =item new HASHREF
65
66 Creates a new context tag.  To add the example to the database, see 
67 L<"insert">.
68
69 Note that this stores the hash reference, not a distinct copy of the hash it
70 points to.  You can ask the object for a copy with the I<hash> method.
71
72 =cut
73
74 sub table { 'log_context'; }
75
76 =item insert
77
78 Adds this record to the database.  If there is an error, returns the error,
79 otherwise returns false.
80
81 =item delete
82
83 Delete this record from the database.
84
85 =item replace OLD_RECORD
86
87 Replaces the OLD_RECORD with this one in the database.  If there is an error,
88 returns the error, otherwise returns false.
89
90 =item check
91
92 Checks all fields to make sure this is a valid example.  If there is
93 an error, returns the error, otherwise returns false.  Called by the insert
94 and replace methods.
95
96 =cut
97
98 sub check {
99   my $self = shift;
100
101   my $error = 
102     $self->ut_numbern('logcontextnum')
103     || $self->ut_number('lognum')
104     || $self->ut_text('context') #|| $self->ut_enum('context', \@contexts)
105   ;
106   return $error if $error;
107
108   $self->SUPER::check;
109 }
110
111 =back
112
113 =head1 CLASS METHODS
114
115 =over 4
116
117 =item contexts
118
119 Returns a list of all valid contexts.
120
121 =cut
122
123 sub contexts { @contexts }
124
125 =back
126
127 =head1 BUGS
128
129 =head1 SEE ALSO
130
131 L<FS::Log>, L<FS::Record>, schema.html from the base documentation.
132
133 =cut
134
135 1;
136