<% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>

FS::cust_event

NAME

FS::cust_event - Object methods for cust_event records

SYNOPSIS

  use FS::cust_event;

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

  $error = $record->insert;

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

  $error = $record->delete;

  $error = $record->check;

DESCRIPTION

An FS::cust_event object represents an completed event. FS::cust_event inherits from FS::Record. The following fields are currently supported:

eventnum - primary key
eventpart - event definition (see FS::part_event)
tablenum - customer, package or invoice, depending on the value of part_event.eventtable (see FS::cust_main, FS::cust_pkg, and FS::cust_bill)
_date - specified as a UNIX timestamp; see "time" in perlfunc. Also see Time::Local and Date::Parse for conversion functions.
status - event status: new, locked, done or failed. Note: done indicates the event is complete and should not be retried (statustext may still be set to an optional message), while failed indicates the event failed and should be retried.
statustext - additional status detail (i.e. error or progress message)
no_action - 'Y' if the event action wasn't performed. Some actions contain an internal check to see if the action is going to be impossible (for example, emailing a notice to a customer who has no email address), and if so, won't attempt the action. It shouldn't be reported as a failure because there's no need to retry it. However, the action should set no_action = 'Y' so that there's a record.

METHODS

new HASHREF

Creates a new completed invoice event. To add the compelted invoice event 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 completed invoice event. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.

part_event

Returns the event definition (see FS::part_event) for this completed event.

cust_X

Returns the customer, package, invoice or batched payment (see FS::cust_main, FS::cust_pkg, FS::cust_bill or FS::cust_pay_batch) for this completed invoice event.

test_conditions [ OPTION => VALUE ... ]

Tests conditions for this event, returns true if all conditions are satisfied, false otherwise.

do_event

Runs the event action.

retry

Changes the status of this event from done to failed, allowing it to be retried.

join_sql
search_sql_where HASHREF

Class method which returns an SQL WHERE fragment to search for parameters specified in HASHREF. Valid parameters are

agentnum
custnum
invnum
pkgnum
svcnum
failed
beginning
ending

SUBROUTINES

reprint
reemail
refax

SEE ALSO

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

<% include ('/elements/footer.html' ) %>