Freeside:1.9:Documentation:Developer/FS/svc Common

From Freeside
Jump to: navigation, search

NAME

FS::svc_Common - Object method for all svc_ records

SYNOPSIS

use FS::svc_Common;

@ISA = qw( FS::svc_Common );

DESCRIPTION

FS::svc_Common is intended as a base class for table-specific classes to inherit from, i.e. FS::svc_acct. FS::svc_Common inherits from FS::Record.

METHODS

search_sql_field FIELD STRING
Class method which returns an SQL fragment to search for STRING in FIELD.
It is now case-insensitive by default.
new; label
svc_Common provides a fallback label subroutine that just returns the svcnum.
check
Checks the validity of fields in this record.
At present, this does nothing but call FS::Record::check (which, in turn, does nothing but run virtual field checks).
insert [ , OPTION => VALUE ... ]
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
The additional fields pkgnum and svcpart (see FS::cust_svc) should be defined. An FS::cust_svc record will be created and inserted.
Currently available options are: jobnums, child_objects and depend_jobnum.
If jobnum is set to an array reference, the jobnums of any export jobs will be added to the referenced array.
If child_objects is set to an array reference of FS::tablename objects (for example, FS::acct_snarf objects), they will have their svcnum field set and will be inserted after this record, but before any exports are run. Each element of the array can also optionally be a two-element array reference containing the child object and the name of an alternate field to be filled in with the newly-inserted svcnum, for example [ $svc_forward, 'srcsvc' ]
If depend_jobnum is set (to a scalar jobnum or an array reference of jobnums), all provisioning jobs will have a dependancy on the supplied jobnum(s) (they will not run until the specific job(s) complete(s)).
If export_args is set to an array reference, the referenced list will be passed to export commands.
delete [ , OPTION => VALUE ... ]
Deletes this account from the database. If there is an error, returns the error, otherwise returns false.
The corresponding FS::cust_svc record will be deleted as well.
replace [ OLD_RECORD ] [ HASHREF | OPTION => VALUE ]
Replaces OLD_RECORD with this one. If there is an error, returns the error, otherwise returns false.
setfixed
Sets any fixed fields for this service (see FS::part_svc). If there is an error, returns the error, otherwise returns the FS::part_svc object (use ref() to test the return). Usually called by the check method.
setdefault
Sets all fields to their defaults (see FS::part_svc), overriding their current values. If there is an error, returns the error, otherwise returns the FS::part_svc object (use ref() to test the return).
set_default_and_fixed; setx FLAG | FLAG_ARRAYREF , [ CALLBACK_HASHREF ]
Sets fields according to the passed in flag or arrayref of flags.
Optionally, a hashref of field names and callback coderefs can be passed. If a coderef exists for a given field name, instead of setting the field, the coderef is called with the column value (part_svc_column.columnvalue) as the single parameter.
set_auto_inventory
Sets any fields which auto-populate from inventory (see FS::part_svc). If there is an error, returns the error, otherwise returns false.
return_inventory; inventory_item
Returns the inventory items associated with this svc_ record, as FS::inventory_item objects (see FS::inventory_item.
cust_svc
Returns the cust_svc record associated with this svc_ record, as a FS::cust_svc object (see FS::cust_svc).
suspend
Runs export_suspend callbacks.
unsuspend
Runs export_unsuspend callbacks.
export_links
Runs export_links callbacks and returns the links.
export HOOK [ EXPORT_ARGS ]
Runs the provided export hook (i.e. "suspend", "unsuspend") for this service.
overlimit
Sets or retrieves overlimit date.
cancel
Stub - returns false (no error) so derived classes don't need to define this methods. Called by the cancel method of FS::cust_pkg (see FS::cust_pkg).
This method is called *before* the deletion step which actually deletes the services. This method should therefore only be used for "pre-deletion" cancellation steps, if necessary.
clone_suspended
Constructor used by FS::part_export::_export_suspend fallback. Stub returning same object for svc_ classes which don't implement a suspension fallback (everything except svc_acct at the moment). Document better.
clone_kludge_unsuspend
Constructor used by FS::part_export::_export_unsuspend fallback. Stub returning same object for svc_ classes which don't implement a suspension fallback (everything except svc_acct at the moment). Document better.

BUGS

The setfixed method return value.

export method isn't used by insert and replace methods yet.

SEE ALSO

FS::Record, FS::cust_svc, FS::part_svc, FS::cust_pkg, schema.html from the base documentation.