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

From Freeside
< Freeside:1.9:Documentation:Developer‎ | FS
Revision as of 16:25, 3 October 2007 by Ivan (talk | contribs) (import from POD)

Jump to: navigation, search

NAME

FS::part_event - Object methods for part_event records

SYNOPSIS

 use FS::part_event;

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

 $error = $record->insert( { 'option' => 'value' } );
 $error = $record->insert( \%options );

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

 $error = $record->delete;

 $error = $record->check;

 $error = $record->do_event( $direct_object );
 

DESCRIPTION

An FS::part_event object represents an event definition - a billing, collection or other callback which is triggered when certain customer, invoice, package or other conditions are met. FS::part_event inherits from FS::Record. The following fields are currently supported:

eventpart - primary key; agentnum - Optional agentnum (see FS::agent); event - event name; eventtable - table name against which this event is triggered; currently "cust_bill" (the traditional invoice events), "cust_main" (customer events) or "cust_pkg (package events); check_freq - how often events of this type are checked; currently "1d" (daily) and "1m" (monthly) are recognized. Note that the apprioriate freeside-daily and/or freeside-monthly cron job needs to be in place.; weight - ordering for events; action - event action (like part_bill_event.plan - eventcode plan); 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 [ HASHREF ]
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
If a list or hash reference of options is supplied, part_export_option records are created (see FS::part_event_option).
delete
Delete this record from the database.
replace OLD_RECORD [ HASHREF | OPTION => VALUE ... ]
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
If a list or hash reference of options is supplied, part_event_option records are created or modified (see FS::part_event_option).
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.
_rebless
Reblesses the object into the FS::part_event::Action::ACTION class, where ACTION is the object's action field.
part_event_condition
Returns the conditions associated with this event, as FS::part_event_condition objects (see FS::part_event_condition)
new_cust_event OBJECT
Creates a new customer event (see FS::cust_event) for the provided object.
agent
Returns the associated agent for this event, if any, as an FS::agent object.
templatename
Returns the alternate invoice template name, if any, or false if there is no alternate template for this event.

CLASS METHODS

eventtable_labels
Returns a hash reference of labels for eventtable values, i.e. 'cust_main'=>'Customer'
eventtable_pkey_sql
Returns a hash reference of full SQL primary key names for eventtable values, i.e. 'cust_main'=>'cust_main.custnum'
eventtables
Returns a list of eventtable values (default ordering; suited for display).
eventtables_runorder
Returns a list of eventtable values (run order).
check_freq_labels
Returns a hash reference of labels for check_freq values, i.e. '1d'=>'daily'
actions [ EVENTTABLE ]
Return information about the available actions. If an eventtable is specified, only return information about actions available for that eventtable.
Information is returned as key-value pairs. Keys are event names. Values are hashrefs with the following keys:
description
; eventtable_hashref:; option_fields:; default_weight:; deprecated
See FS::part_event::Action for more information.
all_actions [ EVENTTABLE ]
Returns a list of just the action names

SEE ALSO

FS::part_event_option, FS::part_event_condition, FS::cust_main, FS::cust_pkg, FS::cust_bill, FS::cust_bill_event, FS::Record, schema.html from the base documentation.