1 package FS::cust_bill_event;
5 use FS::Record qw( qsearch qsearchs );
11 FS::cust_bill_event - Object methods for cust_bill_event records
15 use FS::cust_bill_event;
17 $record = new FS::cust_bill_event \%hash;
18 $record = new FS::cust_bill_event { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::cust_bill_event object represents an complete invoice event.
31 FS::cust_bill_event inherits from FS::Record. The following fields are
36 =item eventnum - primary key
38 =item invnum - invoice (see L<FS::cust_bill>)
40 =item eventpart - event definition (see L<FS::part_bill_event>)
42 =item _date - specified as a UNIX timestamp; see L<perlfunc/"time">. Also see
43 L<Time::Local> and L<Date::Parse> for conversion functions.
53 Creates a new completed invoice event. To add the compelted invoice event to
54 the database, see L<"insert">.
56 Note that this stores the hash reference, not a distinct copy of the hash it
57 points to. You can ask the object for a copy with the I<hash> method.
61 # the new method can be inherited from FS::Record, if a table method is defined
63 sub table { 'cust_bill_event'; }
67 Adds this record to the database. If there is an error, returns the error,
68 otherwise returns false.
72 # the insert method can be inherited from FS::Record
76 Delete this record from the database.
80 # the delete method can be inherited from FS::Record
82 =item replace OLD_RECORD
84 Replaces the OLD_RECORD with this one in the database. If there is an error,
85 returns the error, otherwise returns false.
89 # the replace method can be inherited from FS::Record
93 Checks all fields to make sure this is a valid completed invoice event. If
94 there is an error, returns the error, otherwise returns false. Called by the
95 insert and replace methods.
99 # the check method should currently be supplied - FS::Record contains some
100 # data checking routines
105 my $error = $self->ut_numbern('eventnum')
106 || $self->ut_number('invnum')
107 || $self->ut_number('eventpart')
108 || $self->ut_number('_date')
111 return "Unknown invnum"
112 unless qsearchs( 'cust_bill' ,{ 'invnum' => $self->invnum } );
114 return "Unknown eventpart"
115 unless qsearchs( 'part_bill_event' ,{ 'eventpart' => $self->eventpart } );
124 Far too early in the morning.
128 L<FS::part_bill_event>, L<FS::cust_bill>, L<FS::Record>, schema.html from the