1 package FS::part_bill_event;
5 use FS::Record qw( qsearch qsearchs );
11 FS::part_bill_event - Object methods for part_bill_event records
15 use FS::part_bill_event;
17 $record = new FS::part_bill_event \%hash;
18 $record = new FS::part_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::part_bill_event object represents an invoice event definition -
31 a callback which is triggered when an invoice is a certain amount of time
32 overdue. FS::part_bill_event inherits from
33 FS::Record. The following fields are currently supported:
37 =item eventpart - primary key
39 =item payby - CARD, BILL, or COMP
41 =item event - event name
43 =item eventcode - event action
45 =item seconds - how long after the invoice date events of this type are triggered
47 =item weight - ordering for events with identical seconds
49 =item plan - eventcode plan
51 =item plandata - additional plan data
53 =item disabled - Disabled flag, empty or `Y'
63 Creates a new invoice event definition. To add the example to the database,
66 Note that this stores the hash reference, not a distinct copy of the hash it
67 points to. You can ask the object for a copy with the I<hash> method.
71 # the new method can be inherited from FS::Record, if a table method is defined
73 sub table { 'part_bill_event'; }
77 Adds this record to the database. If there is an error, returns the error,
78 otherwise returns false.
82 # the insert method can be inherited from FS::Record
86 Delete this record from the database.
90 # the delete method can be inherited from FS::Record
92 =item replace OLD_RECORD
94 Replaces the OLD_RECORD with this one in the database. If there is an error,
95 returns the error, otherwise returns false.
99 # the replace method can be inherited from FS::Record
103 Checks all fields to make sure this is a valid invoice event definition. If
104 there is an error, returns the error, otherwise returns false. Called by the
105 insert and replace methods.
109 # the check method should currently be supplied - FS::Record contains some
110 # data checking routines
115 $self->weight(0) unless $self->weight;
117 $self->ut_numbern('eventpart')
118 || $self->ut_enum('payby', [qw( CARD BILL COMP )] )
119 || $self->ut_text('event')
120 || $self->ut_anything('eventcode')
121 || $self->ut_number('seconds')
122 || $self->ut_enum('disabled', [ '', 'Y' ] )
123 || $self->ut_number('weight')
124 || $self->ut_alphan('plan')
125 || $self->ut_anything('plandata')
137 L<FS::cust_bill>, L<FS::cust_bill_event>, L<FS::Record>, schema.html from the