Freeside:4:Documentation:Developer/FS/part event condition

From Freeside
Jump to: navigation, search

NAME

FS::part_event_condition - Object methods for part_event_condition records

SYNOPSIS

 use FS::part_event_condition;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

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

eventconditionnum - primary key; eventpart - Event definition (see FS::part_event); conditionname - Condition name - defines which FS::part_event::Condition::conditionname evaluates this condition

METHODS

new HASHREF
Creates a new event. To add the example 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 | OPTION => VALUE ... ]
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_event_condition_option records are created (see FS::part_event_condition_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_condition_option records are created or modified (see FS::part_event_condition_option).
check
Checks all fields to make sure this is a valid example. 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::Condition::CONDITIONNAME class, where CONDITIONNAME is the object's conditionname field.

CLASS METHODS

conditions [ EVENTTABLE ]
Return information about the available conditions. If an eventtable is specified, only return information about conditions available for that eventtable.
Information is returned as key-value pairs. Keys are condition names. Values are hashrefs with the following keys:
description
; option_fields
  1. =item default_weight
  1. =item deprecated
See FS::part_event::Condition for more information.
all_conditionnames [ EVENTTABLE ]
Returns a list of just the condition names
join_conditions_sql [ EVENTTABLE [, OPTIONS ] ]
Returns an SQL fragment selecting joining all condition options for an event as tables titled "cond_conditionname". Typically used in conjunction with where_conditions_sql. OPTIONS should include 'time', the time to use in testing event conditions.
where_conditions_sql [ EVENTTABLE [ , OPTION => VALUE, ... ] ]
Returns an SQL fragment to select events which have unsatisfied conditions. Must be used in conjunction with join_conditions_sql.
The only current option is "time", the current time (or "pretend" current time as passed to freeside-daily), as a UNIX timestamp.
order_conditions_sql [ EVENTTABLE ]
Returns an SQL fragment to order selected events. Must be used in conjunction with join_conditions_sql.

BUGS

SEE ALSO

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