Difference between revisions of "Freeside:3:Documentation:Developer/FS/svc Common"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
m (Edit via perl MediaWiki framework (1.13))
 
Line 16: Line 16:
 
:Checks the validity of fields in this record.
 
: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).
+
:Only checks fields marked as required in table_info or part_svc_column definition. Should be invoked by service-specific check using SUPER. Invokes FS::Record::check using SUPER.
 
; insert [ , OPTION => VALUE ... ]
 
; insert [ , OPTION => VALUE ... ]
 
:Adds this record to the database. If there is an error, returns the error, otherwise returns false.
 
:Adds this record to the database. If there is an error, returns the error, otherwise returns false.

Latest revision as of 11:58, 26 May 2015

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

new; label
svc_Common provides a fallback label subroutine that just returns the svcnum.
check
Checks the validity of fields in this record.
Only checks fields marked as required in table_info or part_svc_column definition. Should be invoked by service-specific check using SUPER. Invokes FS::Record::check using SUPER.
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::svc_export_machine or 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.
expire DATE
Currently this will only run expire exports if any are attached
replace [ OLD_RECORD ] [ HASHREF | OPTION => VALUE ]
Replaces OLD_RECORD with this one. If there is an error, returns the error, otherwise returns false.
Currently available options are: child_objects, export_args and depend_jobnum.
If child_objects is set to an array reference of FS::tablename objects (for example, FS::svc_export_machine or FS::acct_snarf objects), they will have their svcnum field set and will be inserted or replaced 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.
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.
svc_pbx
Returns the FS::svc_pbx record for this service, if any (see FS::svc_pbx).
Only makes sense if the service has a pbxsvc field (currently, svc_phone and svc_acct).
pbx_title
Returns the title of the FS::svc_pbx record associated with this service, if any.
Only makes sense if the service has a pbxsvc field (currently, svc_phone and svc_acct).
pbx_select_hash %OPTIONS
Can be called as an object method or a class method.
Returns a hash SVCNUM => TITLE ... representing the PBXes this customer that may be associated with this service.
Currently available options are: pkgnum svcpart
Only makes sense if the service has a pbxsvc field (currently, svc_phone and svc_acct).
set_auto_inventory
Sets any fields which auto-populate from inventory (see FS::part_svc), and also check any manually populated inventory fields.
If there is an error, returns the error, otherwise returns false.
return_inventory
Release all inventory items attached to this service's fields. Call when unprovisioning the service.
inventory_item
Returns the inventory items associated with this svc_ record, as FS::inventory_item objects (see FS::inventory_item.
release_router
Delete any routers associated with this service. This will release their address blocks, also.
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_getsettings
Runs export_getsettings callbacks and returns the two hashrefs.
export_getstatus
Runs export_getstatus callbacks and returns a two item list consisting of an HTML status and a status hashref.
export_setstatus
Runs export_setstatus callbacks. If there is an error, returns the error, otherwise returns false.
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.
find_duplicates MODE FIELDS...
Method used by _check_duplicate routines to find services with duplicate values in specified fields. Set MODE to 'global' to search across all services, or 'export' to limit to those that share one or more exports with this service. FIELDS is a list of field names; only services matching in all fields will be returned. Empty fields will be skipped.
getstatus_html; nms_ip_insert; nms_delip; 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.
search HASHREF
Class method which returns a qsearch hash expression to search for parameters specified in HASHREF.
Parameters:
unlinked - set to search for all unlinked services. Overrides all other options.
; agentnum:; custnum:; svcpart:; ip_addr:; pkgpart - arrayref:; routernum - arrayref:; sectornum - arrayref:; towernum - arrayref:; order_by

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.