Freeside:1.7:Documentation:Developer/FS/part bill event
From Freeside
Contents
NAME
FS::part_bill_event - Object methods for part_bill_event records
SYNOPSIS
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 } );
DESCRIPTION
An FS::part_bill_event object represents an 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'
METHODS
- new HASHREF
- 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.
- insert
- Adds this record to the database. If there is an error, returns the error, otherwise returns false.
- delete
- 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.
- check
- 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.
- templatename
- Returns the alternate invoice template name, if any, or false if there is no alternate template for this invoice event.
- due_events
- 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.
- do_event
- 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.
- reasontext
- Returns the text of any reason associated with this event.
BUGS
The whole "eventcode" idea is bunk. This should be refactored with subclasses like part_pkg/ and part_export/
SEE ALSO
FS::cust_bill, FS::cust_bill_event, FS::Record, schema.html from the base documentation.