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