Freeside:1.9:Documentation:Developer/FS/part bill event

From Freeside
Jump to: navigation, search


FS::part_bill_event - Object methods for part_bill_event records


 use FS::part_bill_event;

 $record = new FS::part_bill_event \%hash;
 $record = new FS::part_bill_event { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

 $error = $record->do_event( $direct_object );
 @events = due_events ( { 'record' => $event_triggering_record,
                          'payby'  => $payby,
                          'event_time => $_date,
                          'extra_sql  => $extra } );


An FS::part_bill_event object represents a deprecated, old-style invoice event definition - a callback which is triggered when an invoice is a certain amount of time overdue. FS::part_bill_event inherits from FS::Record. The following fields are currently supported:

eventpart - primary key; payby - CARD, DCRD, CHEK, DCHK, LECB, BILL, or COMP; event - event name; eventcode - event action; seconds - how long after the invoice date events of this type are triggered; weight - ordering for events with identical seconds; plan - eventcode plan; plandata - additional plan data; reason - an associated reason for this event to fire; disabled - Disabled flag, empty or `Y'


Old-style invoice events are only useful for legacy migrations - if you are looking for current events see FS::part_event.


Creates a new invoice event definition. To add the invoice event definition to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
Delete this record from the database.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
Checks all fields to make sure this is a valid invoice event definition. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
Returns the alternate invoice template name, if any, or false if there is no alternate template for this invoice event.
Returns the list of events due, if any, or false if there is none. Requires record and payby, but event_time and extra_sql are optional.
Performs the event and returns any errors that occur. Requires a record on which to perform the event. Should only be performed inside a transaction.
Returns the text of any reason associated with this event.


The whole "eventcode" idea is bunk. This should be refactored with subclasses like part_pkg/ and part_export/


FS::cust_bill, FS::cust_bill_event, FS::Record, schema.html from the base documentation.